You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Sandro Martini (JIRA)" <ji...@apache.org> on 2011/04/18 12:19:05 UTC

[jira] [Issue Comment Edited] (PIVOT-704) JSONSerializer can't deserialize to BigDecimal

    [ https://issues.apache.org/jira/browse/PIVOT-704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020580#comment-13020580 ] 

Sandro Martini edited comment on PIVOT-704 at 4/18/11 10:18 AM:
----------------------------------------------------------------

Sorry, too much in hurry and made a big mistake (generated getters/setters) ... sorry. 
I'll continue my work on this this week.

Bye,
Sandro


      was (Author: smartini):
    Probably I've found the problem (at least in my environment, with Java 6 Update 24 both @32bit and @64 bit):
inside BeanAdapter#PropertyIterator .. it's something related to our usage of reflection (I think).
Or could be a Java bug ... someone is aware of this ?

Some info:
http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getMethods%28%29

In the Test class just created, try to add the following method, and run it in debug mode, setting a breakpoint on the last line in the method.
You'll see that in the returned methods and fields, we should use the second block of instructions ... at least in this case.

    @Test
    public void testReflection()
    {
        Method[] methods = BeanAdapterTestObject.class.getMethods();
        Field[]  fields  = BeanAdapterTestObject.class.getFields();

        Method[] methodsDeclared = BeanAdapterTestObject.class.getDeclaredMethods();
        Field[]  fieldsDeclared  = BeanAdapterTestObject.class.getDeclaredFields();
        
        int i = 0;  // set a breakpoint here
    }
    


Greg (and others), what do you think ?

  
> JSONSerializer can't deserialize to BigDecimal
> ----------------------------------------------
>
>                 Key: PIVOT-704
>                 URL: https://issues.apache.org/jira/browse/PIVOT-704
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-beans, core-json, core-serialization
>    Affects Versions: 2.0
>            Reporter: Augustus Thoo
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: BeanAdapterTest.java, TestObject.java, patch.patch
>
>
> JSONSerializer would throw an IllegalArgumentException "Unable to coerce double to BigDecimal" when the object class contains at least one BigDecimal field.
> Exception is traced to BeanAdapter.java , line 916, where coerce(Object, Class) has no else-if for BigDecimal class.
> Re: http://apache-pivot-users.399431.n3.nabble.com/JSONSerializer-can-t-deserialize-to-BigDecimal-td2464302.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira