JsonParser fails to find certain Syntax Errors

18 views
Skip to first unread message

fleipold

unread,
May 22, 2013, 5:36:56 AM5/22/13
to Lift
Hi Group,

I have just come across an issue, where I had an invalid JSON string
and didn't get the feedback from the parser I expected.

My expectation would be along those lines:

@Test def shouldFindSyntaxError {
try {
val json = net.liftweb.json.parse(
"""
|{
| "x":"y"
""".stripMargin)
fail("Expected parser to throw but returned " + json)
}
catch { case e: Exception => {/*optionally assert on the
exception message*/} }
}

The output of executing that against 2.5-RC5 was
'java.lang.AssertionError: Expected parser to throw but returned
JNothing'

This lead to a really confusing error message, when trying to marshal
a case class instance.

Does my expectation make sense? Should I file a bug?

BTW: I tried to write the test in the lift code base, but found out
that the current trunk has a flaky test case ("Any valid json can be
parsed"), which fails when a Buffer has exactly the size of the input
to be parsed.
Is there documentation on the development process (I could find
neither branch nor tag associated with 2.5-RC5)?

Best Regards,

Felix Leipold

Joni Freeman

unread,
May 23, 2013, 12:58:43 AM5/23/13
to lif...@googlegroups.com
Hi,

Yes, this should be a parsing error. You can file a bug or send a pull request which fixes the issue.

Cheers Joni
Reply all
Reply to author
Forward
0 new messages