Uploaded image for project: 'DMR'
  1. DMR
  2. DMR-6

JSON parser throws exception for valid JSON string

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.2.0.Beta2, 1.1.7.Final
    • None
    • None
    • Hide

      Run the following code:

      ModelNode node = new ModelNode();
      String string = "A string with unicode characters: \u0000\u0001\u001F\u0020\u007F\u0080\u009F\u2000\u2001\u20FF";
      node.get("test").set(string);
      node = ModelNode.fromJSONString(node.toJSONString(false));
      System.out.println(node.toJSONString(false));

      Show
      Run the following code: ModelNode node = new ModelNode(); String string = "A string with unicode characters: \u0000\u0001\u001F\u0020\u007F\u0080\u009F\u2000\u2001\u20FF"; node.get("test").set(string); node = ModelNode.fromJSONString(node.toJSONString(false)); System.out.println(node.toJSONString(false));

    Description

      JSONParserImpl.java(113) incorrectly parses escaped unicode characters. Should use radix 16, however I question the escaping logic in ModelValue.java(202).

      I believe this can be more relaxed and just escape the unicode characters from 0000 to 001F as json rtf 4627 suggests.

      Attachments

        Activity

          People

            bstansbe@redhat.com Brian Stansberry
            nscavell_jira Nick Scavelli (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: