Re: [rest-assured] New to rest-assured: getting stackoverflow error on simple usage of JsonPath

296 views
Skip to first unread message

Johan Haleby

unread,
Mar 26, 2013, 3:15:10 PM3/26/13
to rest-a...@googlegroups.com
Hi, 

No this is not a known issue. Could you please provide a full JSON example so that I can try it out? Btw, what version of REST Assured are you using?

Regards,
/Johan

On Tue, Mar 26, 2013 at 7:36 PM, <pmik...@gmail.com> wrote:
I'm working on my first rest-assured class. Everything was going well until I tried anything with JsonPath. I have no idea what the issue is with my setup. Greatly appreciate any help or pointers!


When I try to use JsonPath, I get a stack overflow error immediately when I try to compile. Is this a known issue? Do I need to change something in my setup?

Even just adding the line below results in error:
JsonPath jsonPath = new JsonPath(js);


The stacktrace on the error looks like this:
java.lang.StackOverflowError
	at java.util.regex.Pattern$CharProperty.match(Unknown Source)
	at java.util.regex.Pattern$Curly.match0(Unknown Source)
	at java.util.regex.Pattern$Curly.match(Unknown Source)
        ...

My Json looks like this:
 {
  "data" : {
    "id" : 13,
    "address" : {
      "address1" : "",
      ...
    },
    "businessSectors" : {
      "total" : 0,
      "data" : [ ]
    },

   ....
 }
}

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

pmik...@gmail.com

unread,
Mar 26, 2013, 3:42:04 PM3/26/13
to rest-a...@googlegroups.com
Hi Johan. 
I just tried limiting the fields that are returned in my response. The parsing works fine with a subset of the fields, so must be something in one of the remaining fields. I'll try expanding the set of fields little by little and look for anything obvious. Thanks!

Johan Haleby

unread,
Mar 26, 2013, 4:05:18 PM3/26/13
to rest-a...@googlegroups.com
I've tried to do this:

JsonPath jsonPath = new JsonPath(" {\n" +
                "  \"data\" : {\n" +
                "    \"id\" : 13,\n" +
                "    \"address\" : {\n" +
                "      \"address1\" : \"\"\n" +
                "    },\n" +
                "    \"businessSectors\" : {\n" +
                "      \"total\" : 0,\n" +
                "      \"data\" : [ ]\n" +
                "    }" +
                " }\n" +
                "}");

and it works. I'm using the latest and greatest unreleased trunk version though so there could be something wrong in the currently released version that has now been fixed. Are you using version 1.7.2?

I've uploaded the latest version to the snapshot repository so if you want to try it out depend on version 1.7.3-SNAPSHOT after having added the following repo in your maven pom.xml file:

<repositories>
        <repository>
            <id>sonatype</id>
            <snapshots />
        </repository>
</repositories>

Regards,
/Johan

pmik...@gmail.com

unread,
Apr 3, 2013, 11:00:41 AM4/3/13
to rest-a...@googlegroups.com
Hi Johan. I think the issue I'm seeing is related to HTML in one of my returned fields. I didn't include that in my sample response. That field comes back like this. I think that the parser is choking on the HTML.
"description": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\r\n<html>\r\n<head>\r\n
   <title><\/title>\r\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-16\" />\r\n<\/head>\r\n<body>\r\n<div align=\"center\">

<font face=\"Times New Roman\" size=\"3\"><b><i>Activities/Honors<\/i><\/b><\/font>\n<br />
<font face=\"Times New Roman\" size=\"3\">Honors Student<\/font>\n<br />
<font face=\"Times New Roman\" size=\"3\">Dean s List: Fall 2005 and Spring 2006<\/font>\n<br />&nbsp;<br />&nbsp;<\/body>\r\n<\/html>",

Johan Haleby

unread,
Apr 3, 2013, 12:05:01 PM4/3/13
to rest-a...@googlegroups.com
Ok so what you have is a JSON document containing HTML? Have you tried with the lastest release (1.8.0)?

Regards,
/Johan

pmik...@gmail.com

unread,
Apr 4, 2013, 9:01:41 AM4/4/13
to rest-a...@googlegroups.com
Thanks Johan! I'll swap in the 1.8.0 jars.

pmik...@gmail.com

unread,
Apr 4, 2013, 10:07:01 AM4/4/13
to rest-a...@googlegroups.com
Tried it with 1.8 (and its dependencies). Works! Thanks again. This is a great framework.

Johan Haleby

unread,
Apr 5, 2013, 10:32:53 AM4/5/13
to rest-a...@googlegroups.com
Thanks for sharing.

Regards
/Johan
Reply all
Reply to author
Forward
0 new messages