|
[jira] Created: (XSTR-442) array class attributes corrupt JSON using Jettis: msg#00016java.xstream.cvs
array class attributes corrupt JSON using JettisonMappedXmlDriver unless they are the last class attribute ---------------------------------------------------------------------------------------------------------- Key: XSTR-442 URL: http://jira.codehaus.org/browse/XSTR-442 Project: XStream Issue Type: Bug Affects Versions: 1.2.2 Reporter: david wilson Attachments: Test.java Serializing a class that has an array as an attrubute creates invalid JSON that wont reload into original Java class. It seems to misplace the } at the end of the array data in the generated JSON text, see below. {"customer":{"ids":{"string":["1","2","3","4"],"name":"david","postCode":"gu27 8uu"}}} BTW if you use the default XML driver all works fine. In the attached class if the ids attribute of the testCustomer class is the last attribute then all works fine if not it produces the following error : Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: name : name ---- Debugging information ---- message : name : name cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : name : name class : json.test.TestCustomer required-type : [Ljava.lang.String; path : /customer/ids/name line number : -1 ------------------------------- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:63) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117) at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:781) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:773) at json.test.Test.JSONToJava(Test.java:22) at json.test.Test.main(Test.java:30) Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: name : name at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:49) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:76) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:60) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:76) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:34) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:62) at com.thoughtworks.xstream.converters.collections.ArrayConverter.unmarshal(ArrayConverter.java:44) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) ... 16 more -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira <hr/> <p> To unsubscribe from this list please visit: </p> <p> <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [jira] Commented: (XSTR-431) xStream unable to use Sun14ReflectionProvider with SAP VM, Norbert Kuck (JIRA) |
|---|---|
| Next by Date: | [1271] trunk/xstream-distribution/src/content: Support for SAP JVM (XSTR-431)., joehni-yCVjj/EcxBJg9hUCZPvPmw |
| Previous by Thread: | [jira] Created: (XSTR-441) xstream over http, Will Johnson (JIRA) |
| Next by Thread: | [1271] trunk/xstream-distribution/src/content: Support for SAP JVM (XSTR-431)., joehni-yCVjj/EcxBJg9hUCZPvPmw |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |