Home › Forums › Integration › Messages › Suspect a bug: Getting exceptions on parsing valid json with null/blank values.
- This topic has 5 replies, 2 voices, and was last updated 7 years, 2 months ago by Ben Frando.
-
AuthorPosts
-
-
August 23, 2017 at 6:41 pm #8673Ben FrandoParticipant
Exception thrown when parsing null/blank values:
executing: (parse-message “{\”status\”:{}}” “testMsg”)
exception: Caused by: nexj.core.scripting.ParserException: Unexpected token “}”. (err.parser.unexpectedToken)
testMsg.message: attached
=============================
The following parses fine:
executing: (parse-message “{\”status\”:{\”code\”:200,\”reason\”:\”ok\”}}” “testMsg”); #<TO<testMsg, @1757836584>(
status=TO<testMsg, @1026935509>(
reason=”ok”,
code=200
)
)>
0 -
August 23, 2017 at 6:45 pm #8680Ben FrandoParticipant
testMsg.message:
<Message aggregation=”random” format=”JSON” lax=”true”>
<Parts>
<Message aggregation=”random” lax=”true” name=”status”>
<Parts>
<Value name=”code” type=”integer”/>
<Value name=”reason” type=”string”/>
</Parts>
</Message>
</Parts>
</Message>0 -
August 23, 2017 at 7:12 pm #8687Ed ShawKeymaster
Ben, you are totally right. This is a bug. The good news is that is is already squashed. 🙂 What version are you running? I ran your tests on the latest and got the following results.
Scheme123456789101112131415161718192021222324; I created some tests for null non require parts to check it out(define m (message (: :class "testMsg") (: status (message)))); #<TO<testMsg, @1519941089>(; status=TO<, @906137539>(); )>(define fm (format-message m)); "{\"status\":{}}"(define pm (parse-message fm "testMsg")); #<TO<testMsg, @593285382>(; status=TO<testMsg, @1566567300>(); )>; Now your examples(parse-message "{\"status\":{\"code\":200,\"reason\":\"ok\"}}" "testMsg"); #<TO<testMsg, @1985421550>(; status=TO<testMsg, @768626727>(; reason="ok",; code=200; );)>(parse-message "{\"status\":{}}" "testMsg"); #<TO<testMsg, @1757503610>(; status=TO<testMsg, @1256240429>();)>0 -
August 24, 2017 at 12:05 pm #8703Ben FrandoParticipant
It’s 6.1.1.14 – Opal SP1 HF14
0 -
August 24, 2017 at 5:46 pm #8710Ed ShawKeymaster
This was fixed, I believe, in Jade. Â For sure in Ruby.
0 -
August 25, 2017 at 12:08 pm #8723Ben FrandoParticipant
Thanks!
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.