[ https://issues.apache.org/jira/browse/SLING-12269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Munteanu resolved SLING-12269. ------------------------------------- Resolution: Fixed Thanks for the PR [~rliechti], I have merged it. > Restore previous behaviour of JSONObject and JSONArray getString methods > ------------------------------------------------------------------------ > > Key: SLING-12269 > URL: https://issues.apache.org/jira/browse/SLING-12269 > Project: Sling > Issue Type: Bug > Components: Commons > Reporter: Remo Liechti > Assignee: Remo Liechti > Priority: Blocker > Fix For: Commons JSON 2.0.24 > > Attachments: SLING-12269.patch > > > With the new internal release 2.0.22, there seems to be a different behaviour > when it comes to get values from JSONObject. > The new version checks for types and throws an exception, as of the old > version simply called toString() on any object found. > *Old:* > {code:java} > public String getString(String key) throws JSONException { > return get(key).toString(); > }{code} > *New:* > {{}} > {code:java} > public String getString(String key) throws JSONException { > Objectobject=this.get(key); > if (objectinstanceofString) { > return (String) object; > } > throwwrongValueFormatException(key, "string", object, null); > }{code} > > Same is true for all other types, such as getInt, getLong etc. > There might be more such small differences in behaviour. -- This message was sent by Atlassian Jira (v8.20.10#820010)