Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-4855

matchesEncodedPattern in ISO9075 class fails with some values

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4.5
    • Component/s: Repository
    • Labels:
      None
    • Bug Priority:
      Category 1

      Description

      When you call the method ISO9075.decode("a_x0020") it fails with the following exception:

      11:56:02,213 User:admin ERROR [ui.common.Utils] Failed to execute import: java.lang.StringIndexOutOfBoundsException: String index out of range: 100
      java.lang.StringIndexOutOfBoundsException: String index out of range: 100
      at java.lang.String.charAt(String.java:686)

      This is because the method decode() uses the method matchesEncodedPattern() that doesn't control the position index:

      private static boolean matchesEncodedPattern(String string, int position)

      { return (string.length() >= position + 6) && (string.charAt(position) == '_') && (string.charAt(position + 1) == 'x') && isHexChar(string.charAt(position + 2)) && isHexChar(string.charAt(position + 3)) && isHexChar(string.charAt(position + 4)) && isHexChar(string.charAt(position + 5)) && (string.charAt(position + 6) == '_'); }

      First condition should be (string.length() > position + 6), or uses a regular expression instead.

      This scenario happen because the max length for a local name is 100 (you can see it at QName.MAX_LENGTH), and if you make a call to QName.createdValidLocalName("Any string of 95 characters_x0020_") it return "Any string of 95 characters_x0020" (e.g. when you export a node that as a cm:source property set, and some parts of this property is larger than 100 characters and then try to import it, it happen).

        Attachments

          Structure

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs (Inactive)
                Reporter:
                efoncubierta Ezequiel Foncubierta (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

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

                    Structure Helper Panel