Json stackoverflow issues

24 views
Skip to first unread message

Christian McHugh

unread,
Nov 11, 2017, 2:18:39 PM11/11/17
to Jenkins Developers
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)
       
...


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
Reply all
Reply to author
Forward
0 new messages