You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Dave Johnson (JIRA)" <ji...@apache.org> on 2008/09/19 17:08:44 UTC

[jira] Created: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

Add support for integer and boolean primitives to BeanJsonConverter
-------------------------------------------------------------------

                 Key: SHINDIG-617
                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
             Project: Shindig
          Issue Type: Improvement
          Components: RESTful API (Java)
            Reporter: Dave Johnson
            Priority: Minor
         Attachments: fix-beanjsonconv-bug.patch

The JSON to Java object conversion does not support primitive integers or booleans.

No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?


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


[jira] Updated: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

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

Dave Johnson updated SHINDIG-617:
---------------------------------

    Attachment: fix-beanjsonconv-bug.patch

Patch fixes boolean and integer, just enough to support JSON to Person.java

> Add support for integer and boolean primitives to BeanJsonConverter
> -------------------------------------------------------------------
>
>                 Key: SHINDIG-617
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Dave Johnson
>            Priority: Minor
>         Attachments: fix-beanjsonconv-bug.patch
>
>
> The JSON to Java object conversion does not support primitive integers or booleans.
> No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?

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


[jira] Resolved: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

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

Cassie Doll resolved SHINDIG-617.
---------------------------------

    Resolution: Fixed
      Assignee: Cassie Doll

> Add support for integer and boolean primitives to BeanJsonConverter
> -------------------------------------------------------------------
>
>                 Key: SHINDIG-617
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Dave Johnson
>            Assignee: Cassie Doll
>            Priority: Minor
>         Attachments: fix-beanjsonconv-bug.patch
>
>
> The JSON to Java object conversion does not support primitive integers or booleans.
> No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?

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


[jira] Commented: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

Posted by "Cassie Doll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633971#action_12633971 ] 

Cassie Doll commented on SHINDIG-617:
-------------------------------------

Booleans and Integers should be covered by lines 334 and 332. (just if cases up from your patch)
I have written a test for this which currently passes:

  public void testJsonToPerson() throws Exception {
    String jsonPerson = "{age : '10', hasApp : 'true'}";
    Person result = beanJsonConverter.convertToObject(jsonPerson, Person.class);

    assertEquals(10, result.getAge().intValue());
    assertEquals(true, result.getHasApp().booleanValue());
  }

So, without your patch, does this still not work for you?
If not, can you write a failing test case to go along with your patch so that we can figure out exactly what's going on?

Thanks!

> Add support for integer and boolean primitives to BeanJsonConverter
> -------------------------------------------------------------------
>
>                 Key: SHINDIG-617
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Dave Johnson
>            Priority: Minor
>         Attachments: fix-beanjsonconv-bug.patch
>
>
> The JSON to Java object conversion does not support primitive integers or booleans.
> No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?

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


[jira] Commented: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

Posted by "Dave Johnson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633991#action_12633991 ] 

Dave Johnson commented on SHINDIG-617:
--------------------------------------

Thanks for looking into this.

> can you write a failing test case?

Yep, or I can make a slight mod to your test case. Your case only tests Integer and Boolean and not primitive fields. If you add isViewer, which is a boolean and not a Boolean, to jsonPerson and the test will fail.

    String jsonPerson = "{age : '10', hasApp : 'true', isViewer: 'true'}";

- Dave


> Add support for integer and boolean primitives to BeanJsonConverter
> -------------------------------------------------------------------
>
>                 Key: SHINDIG-617
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Dave Johnson
>            Priority: Minor
>         Attachments: fix-beanjsonconv-bug.patch
>
>
> The JSON to Java object conversion does not support primitive integers or booleans.
> No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?

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


[jira] Commented: (SHINDIG-617) Add support for integer and boolean primitives to BeanJsonConverter

Posted by "Cassie Doll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634187#action_12634187 ] 

Cassie Doll commented on SHINDIG-617:
-------------------------------------

brilliant. all fixed now. 

(ps - its weird that we are mixing types in PersonImpl, but oh well)

> Add support for integer and boolean primitives to BeanJsonConverter
> -------------------------------------------------------------------
>
>                 Key: SHINDIG-617
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-617
>             Project: Shindig
>          Issue Type: Improvement
>          Components: RESTful API (Java)
>            Reporter: Dave Johnson
>            Priority: Minor
>         Attachments: fix-beanjsonconv-bug.patch
>
>
> The JSON to Java object conversion does not support primitive integers or booleans.
> No sure why this has not been noticed before, perhaps it is because Shindig never converts JSON to Person?

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