Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-10340

NXQL fails on backslash at end of string

    XMLWordPrintable

    Details

    • Tags:
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      NXQL incompatibility:
      used to mean
      but now means \

      i.e., two consecutive backslashes inside a strings were previously interpreted as two backslashes. Now they are interpreted as only one backslash.

      There are two new helper methods to do string escaping:

      • NXQL.escapeString
      • NXQL.escapeStringInner
      Show
      NXQL incompatibility: used to mean but now means \ i.e., two consecutive backslashes inside a strings were previously interpreted as two backslashes. Now they are interpreted as only one backslash. There are two new helper methods to do string escaping: NXQL.escapeString NXQL.escapeStringInner

      Description

      A string literal with a backslash as last character cannot be parsed. This should work but does not:

      SELECT * FROM Document WHERE dc:title='foo\\'
      

      Which has double escaping from Java code:

      session.query("SELECT * FROM Document WHERE dc:title='foo\\\\'")
      

      Failure:

      org.nuxeo.ecm.core.query.QueryParseException: org.nuxeo.ecm.core.query.QueryParseException: Syntax error: Invalid token <null> at offset -1 in query: SELECT * FROM Document WHERE dc:title='foo\\'
      	at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:51)
      Caused by: org.nuxeo.ecm.core.query.QueryParseException: org.nuxeo.ecm.core.query.QueryParseException: Syntax error: Invalid token <null> at offset -1
      	at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:41)
      	at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:47)
      	... 23 more
      Caused by: org.nuxeo.ecm.core.query.QueryParseException: Syntax error: Invalid token <null> at offset -1
      	at org.nuxeo.ecm.core.query.sql.parser.parser.parseFailed(parser.java:466)
      	at org.nuxeo.ecm.core.query.sql.parser.parser.unrecovered_syntax_error(parser.java:457)
      	at java_cup.runtime.lr_parser.parse(lr_parser.java:601)
      	at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:39)
      	... 24 more
      

        Attachments

          Activity

            People

            • Assignee:
              fguillaume Florent Guillaume
              Reporter:
              fguillaume Florent Guillaume
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: