JAXB: Can @XmlElement (nillable=true) cause NullPointerException?

I had code something like this previously:

@XmlRootElement public class Employee{  @XmlElement(name="FisrtName") private String name;  @XmlElement(name="MiddleName") private String middleName;  @XmlElement(name="LastName") private String lastName;  @XmlElement(name="City") private String city;  } 

I just added nillable=truein each fields. Like something below:

 @XmlElement(name="City", nillable=true)  private String city; 

I am not sure about the In and Out of the application. Now I am getting null pointer exception.

What I was thinking that adding nillable can cause the null pointer?

Or Do I need to add the default values (defaultValue) for each of the field?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.