Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-2425

Incorrect and inconsistent escaping of property names used in JcrPropertyMap


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: JCR Resource 2.0.10
    • Fix Version/s: JCR Resource 2.1.0
    • Component/s: JCR
    • Labels:


      The JcrPropertyMap uses the (wrong) ISO9075 encoding for property names, and this also behaves differently between the read() and readFully() variants.

      1) ISO9075 is needed for XML names, e.g. for mapping JCR names into Xpath queries. But the set of valid JCR names is much larger (for example "-" is valid, while it is not allowed in ISO9075 and becomes "x002d"). org.apache.jackrabbit.util.Text#escapeIllegalJcrChars() must be used instead to escape any string for use as JCR names. [0]

      2) Inconsistency:
      a) read() will take the key and use ISO9075#encodePath(), before looking up the jcr property using the encoded variant
      b) readFully() will go through all jcr properties and cache them with the key using ISO9075#decode()

      Hence for all valid JCR names, which are not valid under ISO9075 (like "1_prop", "-foo"), these can be looked up using the cached variant b) (as decode() won't touch them), while they cannot be looked up using read() at all due to the forced "arbitrary" escaping.

      I think there should be no auto-magically escaping at all (also not in the accompanying JcrModifiablePropertyMap). Incorrect naming errors should simply be passed through, it is the job of the application to handle that. The framework should not run an arbitrary & undocumented escaping, if it cannot enforce that anyway, since there are other ways to create properties with a different valid char set (using the JCR API).

      [0] http://wiki.apache.org/jackrabbit/EncodingAndEscaping


        1. SLING-2425-test-dots.patch
          1 kB
          Alexander Klimetschek

          Issue Links



              • Assignee:
                cziegeler Carsten Ziegeler
                alexander.klimetschek Alexander Klimetschek
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: