Json stackoverflow issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Json stackoverflow issues

Christian McHugh
Howdy all,

Recently, I've gotten bug reports for a jenkins plugin involving json issues. After setting up a development environment, I was able to replicate, but I'm a bit stumped as these parts used to work, and are now throwing various errors from the net.sf.json library. 

java.lang.StackOverflowError
        at org
.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptors(PropertyUtilsBean.java:1084)
        at org
.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:912)
        at org
.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1319)
        at org
.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:770)
        at org
.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
        at org
.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
        at net
.sf.json.JSONObject.defaultBeanProcessing(JSONObject.java:692)
        at net
.sf.json.JSONObject._fromBean(JSONObject.java:642)
        at net
.sf.json.JSONObject.fromObject(JSONObject.java:169)
        at net
.sf.json.JSONSerializer.toJSON(JSONSerializer.java:108)
        at net
.sf.json.AbstractJSON._processValue(AbstractJSON.java:239)
        at net
.sf.json.JSONArray._processValue(JSONArray.java:2492)
        at net
.sf.json.JSONArray.processValue(JSONArray.java:2517)
        at net
.sf.json.JSONArray.addValue(JSONArray.java:2504)
        at net
.sf.json.JSONArray.element(JSONArray.java:1719)
        at net
.sf.json.JSONArray.fromObject(JSONArray.java:159)
        at net
.sf.json.JSONSerializer.toJSON(JSONSerializer.java:113)
        at net
.sf.json.AbstractJSON._processValue(AbstractJSON.java:239)
        at net
.sf.json.JSONArray._processValue(JSONArray.java:2492)
        at net
.sf.json.JSONArray.processValue(JSONArray.java:2517)
        at net
.sf.json.JSONArray.addValue(JSONArray.java:2504)
        at net
.sf.json.JSONArray.element(JSONArray.java:1719)
        at net
.sf.json.JSONArray.fromObject(JSONArray.java:159)
        at net
.sf.json.JSONSerializer.toJSON(JSONSerializer.java:113)
        at net
.sf.json.AbstractJSON._processValue(AbstractJSON.java:239)
       
...


The line in question is https://github.com/jenkinsci/saltstack-plugin/blob/master/src/main/java/com/waytta/Builds.java#L273 or to paste here:
returnArray.add(httpArray.getJSONObject(0).getJSONObject("Result"));

Where returnArray is a JSONArray and the object being passed in in a JSONObject. If I change the returnArray.add to returnArray.element, then the recursion errors move to another area of the code. I seem to be able to "fix" this problem by deserializing the JSONObject with .toString() and adding to the array with returnArray.element(), but this is pretty inefficient and causes issues with large JSON responses. 

Basically, I've been staring at these issues for a little while now and since this code used to function and now seems to have issues I thought it was worth asking around here if others might have any hints or tips. Is it possible anything could have changed in Jenkins or popular plugins that might affect the net.sf.json library?

Thanks much

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c43c4c04-b4e2-47df-85ae-fa142952cc55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.