JSON plugin suggest : parse String value "" to Number with null / 0

2010-11-22 Thread Knight Chen
exception for input String "". I check the JSONPopulator, that has process the null value to 0 when parse to Number type, but not process the String "", So can JSONPopulator to support process String "" to null or 0,that will be easier web front d

Re: JSON plugin suggest : parse String value "" to Number with null / 0

2010-11-22 Thread Knight Chen
be ognl conversion related. > For further details, could you provide the NPE stack? > > 2010/11/22 Knight Chen > >> Hi all, >> >> I often encounter Number format exception when I use JSON plugin to >> parse input String "" from AJAX request to Number,

Re: JSON plugin suggest : parse String value "" to Number with null / 0

2010-11-24 Thread Knight Chen
one know why convert method process is driven by value and type > instead of target type only? > > 2010/11/23 Knight Chen > >> Hi All, >> Thanks for reply, and sorry for my poor English. >> >> In this case: >> >> I have a POJO: >> public class

Re: JSON plugin suggest : parse String value "" to Number with null / 0

2010-11-24 Thread Knight Chen
; > > private Object convertPrimitive(Class clazz, Object value, Method method) > throws JSONException { >        if (value == null) { >            if (Short.TYPE.equals(clazz) || Short.class.equals(clazz)) >                return (short) 0; >            ... >        } e