You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2015/01/14 08:35:35 UTC
[jira] [Resolved] (SLING-4288) JSONObject.toString() returns null
when having a value of type map with a null value
[ https://issues.apache.org/jira/browse/SLING-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carsten Ziegeler resolved SLING-4288.
-------------------------------------
Resolution: Fixed
Fixed in rev 1651577 and updated test case to reflect the problem
> JSONObject.toString() returns null when having a value of type map with a null value
> ------------------------------------------------------------------------------------
>
> Key: SLING-4288
> URL: https://issues.apache.org/jira/browse/SLING-4288
> Project: Sling
> Issue Type: Bug
> Components: Commons
> Affects Versions: Commons JSON 2.0.8
> Reporter: Pulkit Agarwal
> Assignee: Carsten Ziegeler
> Labels: JSON
> Fix For: Commons JSON 2.0.10
>
>
> I am having a test case where I have to place a map in a JSONObject. Below is the sample code for the same.
> @Test
> public void testSample() throws JSONException
> {
> HashMap<String,Object> map=new HashMap<String,Object>();
> map.put("abc", "123456");
> map.put("id", null);
> List<String> list=new ArrayList<String>();
> list.add("Admin");
> list.add("password");
> map.put("groups", list);
> JSONObject response=new JSONObject();
> response.put("key", map);
> System.out.println(response.get("key"));
> }
> Now when I execute the code keeping org.apache.sling.commons.json version 2.0.8 in the classpath then response.get("key")returns null where as in case of bundle version 2.0.6 its returns map.
> Please note this issue is reproducible when the map is an element of type list.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)