I have what seems to be two simple errors but after a week, I can't find any
way to resolve them.

Environment JDK 1.4.2 with XStream 1.4.1 

 

--------------Error #1 

For some reason, the reflection seems to be trying to make this a number?

 

java.lang.InstantiationError: java.lang.Number

                at
sun.reflect.GeneratedSerializationConstructorAccessor31.newInstance(Unknown
Source)...

 

XML node

"<socialSecurity><number>666549588</number></socialSecurity>"

 

 

public class SocialSecurity {

   

   protected String number;  // can have dashes in it         

   protected Decease decease;

   protected Source source;

   protected Boolean masked;

 

   public String getNumber() {

       return number;

   }

 

   public void setNumber(String value) {

       this.number = value;

   }

   ...rest of class

}              

 

 

--------------Error #2

XStream thinks this is an array?

 

com.thoughtworks.xstream.converters.ConversionException: code : code

---- Debugging information ----

message             : code

cause-exception     :
com.thoughtworks.xstream.mapper.CannotResolveClassException

cause-message       : code

class               : java.util.ArrayList

required-type       : java.util.ArrayList

converter-type      :
com.thoughtworks.xstream.converters.collections.CollectionConverter

path                :
/productBureau/product/subject/subjectRecord/addOnProduct/code

class[1]            : com.mycom.xml.SubjectRecord

converter-type[1]   :
com.thoughtworks.xstream.converters.reflection.ReflectionConverter

class[2]            : com.mycom.xml.Subject

class[3]            : com.mycom.xml.Product

class[4]            : com.mycom.xml.ProductBureau

version             : null

-------------------------------

                at
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java
:79).

 

XML node

"<addOnProduct><code>00R95</code></addOnProduct>"

 

public class AddOnProduct {

                protected String code;

                

                public void setCode(String code) {

                                this.code = code;

                }

                public String getCode() {

                                return this.code;

 

}

Reply via email to