Dear List,

I am having a problem with a NullPointerException with a very specific case.

I have two classes that are pure value objects, one overriding the other.
Generally:

public class ParentClass
{
  public int id;

  public void setId(int id)
  {
    this.id = id;
  }

  public int getId()
  {
    return id;
  }
}

and

public class ChildClass extends ParentClass
{
  public void setId(int id)
  {
    this.id = id;
  }

  public int getId()
  {
    return id;
  }
}


The NPE occurs during unmarshalling.


Note that if I take out the overriding getters and setters, the problem goes
away. I can still unmarshall the id value from the parent class in the child
class. It is only when I override the getters and setters that this problem
occurs.



I traced the problem to this line in XMLClassDescriptorImpl:

  Line 891:
    FieldValidator fieldValidator = localElements[i].getValidator();


Each of the local elements that is overridden becomes null, so calling
getValidator throws a NPE.



Note that the same NPE happens when I override other values, too.


Any ideas about how to work around the problem?


Thanks!
Dave



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to