exo-ecms
  1. exo-ecms
  2. ECMS-2698

java.lang.ArrayIndexOutOfBoundsException appears when process by method splif of class NodeLocation

    Details

    • Similar issues:
      Show 9 results 
    • BV:
      0
    • Support Status:
      Fixed in Product
    • BO:
      0

      Description

      method split of class org.exoplatform.services.wcm.core.NodeLocation has bug which cause Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
      at org.exoplatform.services.wcm.core.NodeLocation.split(NodeLocation.java:306)
      at org.exoplatform.services.wcm.core.NodeLocation.getNodeLocationByExpression(NodeLocation.java:180)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:182)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:156)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:195)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:156)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:195)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:156)
      at org.exoplatform.wcm.webui.clv.UICLVPresentation.getCategories(UICLVPresentation.java:145)

      case study
      split(" repository:collaboration:/jcr:system/jcr:versionStorage/47972d920afb869f01c6d01013e0c1f6/1/jcr:frozenNode", ":")

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Phung Hai Nam added a comment - - edited

            When I configed for the category navigation by ContentListViewer that will show the Folder structure (not in category)

            in groovy template I called

            def categories = uicomponent.getCategories("nt:unstructured");
            

            This cause the above problem

            After investigated I saw in NodeLocation class we have a method

            private static final String[] split(String s, String ch) {
                String[] ss = new String[3];
                int prev = 0;
                int i=0;
                while(true) {
                  int next = s.indexOf(ch, prev);
                  if (next==-1) {
                    ss[i] = s.substring(prev);
                    break;
                  }
                  ss[i++] = s.substring(prev, next);
                  prev = next+1;
                }
            
                return ss;
            }
            
            

            Some where in recursive we have this method is called with:

            split(" repository:collaboration:/jcr:system/jcr:versionStorage/47972d920afb869f01c6d01013e0c1f6/1/jcr:frozenNode", ":")
            

            then i > 3

            I see you init an Array length 3. and some case variable i is greater than 3 -> problem occur

            Please check this. This is regression. So I would like we can fix it for ECMS 2.1.x and PLF 3.0.x (preparing to release)

            Show
            Phung Hai Nam added a comment - - edited When I configed for the category navigation by ContentListViewer that will show the Folder structure (not in category) in groovy template I called def categories = uicomponent.getCategories( "nt:unstructured" ); This cause the above problem After investigated I saw in NodeLocation class we have a method private static final String [] split( String s, String ch) { String [] ss = new String [3]; int prev = 0; int i=0; while ( true ) { int next = s.indexOf(ch, prev); if (next==-1) { ss[i] = s.substring(prev); break ; } ss[i++] = s.substring(prev, next); prev = next+1; } return ss; } Some where in recursive we have this method is called with: split( " repository:collaboration:/jcr:system/jcr:versionStorage/47972d920afb869f01c6d01013e0c1f6/1/jcr:frozenNode" , ":" ) then i > 3 I see you init an Array length 3. and some case variable i is greater than 3 -> problem occur Please check this. This is regression. So I would like we can fix it for ECMS 2.1.x and PLF 3.0.x (preparing to release)
            Hide
            Phung Hai Nam added a comment -

            exactly

            Show
            Phung Hai Nam added a comment - exactly
            Hide
            Minh Dang added a comment -

            VALIDATED ON BEHALF OF PM

            Show
            Minh Dang added a comment - VALIDATED ON BEHALF OF PM
            Hide
            CI Server added a comment -

            Integrated in ecms-2.1.x-ci #772
            ECMS-2698: java.lang.ArrayIndexOutOfBoundsException is thrown when using method split of class NodeLocation

            Fix description

            • Edit code to loop only three times to get three string items (repository, workspace, nodepath) (Revision 73273)

            Result = SUCCESS
            thanhtt :
            Files :

            • /ecms/branches/2.1.x/core/services/src/main/java/org/exoplatform/services/wcm/core/NodeLocation.java
            • /ecms/branches/2.1.x/patch/2.1.6/ECMS-2698
            • /ecms/branches/2.1.x/patch/2.1.6/ECMS-2698/ECMS-2698.patch
            • /ecms/branches/2.1.x/patch/2.1.6/ECMS-2698/readme.txt
            Show
            CI Server added a comment - Integrated in ecms-2.1.x-ci #772 ECMS-2698 : java.lang.ArrayIndexOutOfBoundsException is thrown when using method split of class NodeLocation Fix description Edit code to loop only three times to get three string items (repository, workspace, nodepath) (Revision 73273) Result = SUCCESS thanhtt : Files : /ecms/branches/2.1.x/core/services/src/main/java/org/exoplatform/services/wcm/core/NodeLocation.java /ecms/branches/2.1.x/patch/2.1.6/ ECMS-2698 /ecms/branches/2.1.x/patch/2.1.6/ ECMS-2698 / ECMS-2698 .patch /ecms/branches/2.1.x/patch/2.1.6/ ECMS-2698 /readme.txt
            Hide
            Tran Nam Chau added a comment -

            Tested OK plf 3.0.6

            Show
            Tran Nam Chau added a comment - Tested OK plf 3.0.6

              People

              • Assignee:
                Le Thanh Hai (Inactive)
                Reporter:
                Luu Thanh Thuy (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour Time Not Required
                  1h

                    Development