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

Internationalization: if sling:key contains invalid characters, query for resources fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • I18n 2.0.2
    • I18n 2.0.2
    • Extensions
    • None

    Description

      If a sling:Message with e.g. sling:key = "List of a rootpage's childpages" is defined, the org.apache.sling.jcr.resource.internal.JcrResourceResolver.queryResources(JcrResourceResolver.java:234) class will fail with a lexical query error due to the apostrophe in this case:

      resulting query:
      //element(,mix:language)[@jcr:language='en_US']/[@sling:key='Liste of a rootpage's childpages']/@sling:message

      resulting exception:

      rror while generating JSON componet list org.apache.sling.api.resource.QuerySyntaxException: Lexical error at line 1, column 133. Encountered: <EOF> after : "\']/@sling:message return $v": Lexical error at line 1, column 133. Encountered: <EOF> after : "\']/@sling:message return $v"
      at org.apache.sling.jcr.resource.internal.JcrResourceResolver.queryResources(JcrResourceResolver.java:234)
      at org.apache.sling.i18n.impl.JcrResourceBundle.loadResource(JcrResourceBundle.java:147)
      at org.apache.sling.i18n.impl.JcrResourceBundle.handleGetObject(JcrResourceBundle.java:96)
      at java.util.ResourceBundle.getObject(ResourceBundle.java:319)
      at java.util.ResourceBundle.getString(ResourceBundle.java:285)
      (...)

      should the natural language approach be the way to go, probably special characters should be allowed (escaped internally).

      Attachments

        Activity

          People

            cziegeler Carsten Ziegeler
            dominique.jaeggi Dominique Jäggi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: