You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carl Hall (JIRA)" <ji...@apache.org> on 2009/04/24 15:47:31 UTC

[jira] Created: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Have JSONArray.getJSONObject(int) construct JSONObject if value is String
-------------------------------------------------------------------------

                 Key: SLING-942
                 URL: https://issues.apache.org/jira/browse/SLING-942
             Project: Sling
          Issue Type: Improvement
          Components: Commons JSON
    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
            Reporter: Carl Hall
         Attachments: sling-942.diff

JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Carl Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702508#action_12702508 ] 

Carl Hall commented on SLING-942:
---------------------------------

Looks good to me.  Thanks for extending the patch to getJSONArray and the opt* methods.

> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>            Assignee: Felix Meschberger
>         Attachments: SLING-942-fmeschbe.patch, sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-942.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: Commons JSON 2.0.4

Thanks for providing the initial patch.

I have applied the modified patch in Rev. 768406.

Please close this issue, if this ok for you. Thanks.

> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>            Assignee: Felix Meschberger
>             Fix For: Commons JSON 2.0.4
>
>         Attachments: SLING-942-fmeschbe.patch, sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated SLING-942:
------------------------------------

    Attachment: SLING-942-fmeschbe.patch

Modified patch, which applies the same logic to the getJSONArray method and also includes adaptions of the optJSONArray and optJSONObject methods to also support on-the-fly parsing and conversion. Finally the patch also catches any problems while parsing the string.

WDYT ?

> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>            Assignee: Felix Meschberger
>         Attachments: SLING-942-fmeschbe.patch, sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Carl Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Hall closed SLING-942.
---------------------------


> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>            Assignee: Felix Meschberger
>             Fix For: Commons JSON 2.0.4
>
>         Attachments: SLING-942-fmeschbe.patch, sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Carl Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carl Hall updated SLING-942:
----------------------------

    Attachment: sling-942.diff

Attaching a patch that performs the requested feature change.

> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>         Attachments: sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-942) Have JSONArray.getJSONObject(int) construct JSONObject if value is String

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-942:
---------------------------------------

    Assignee: Felix Meschberger

> Have JSONArray.getJSONObject(int) construct JSONObject if value is String
> -------------------------------------------------------------------------
>
>                 Key: SLING-942
>                 URL: https://issues.apache.org/jira/browse/SLING-942
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Commons JSON 2.0.4
>            Reporter: Carl Hall
>            Assignee: Felix Meschberger
>         Attachments: sling-942.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> JSONArray.getJSONObject(int) current checks for JSONObject and throws an exception if instanceof fails.  I discovered this after excepting to get back a JSONObject from this but debugging showed that the value was a JSON String.  This functionality could be enhanced by checking for String and converting to a JSONObject if possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.