users@jaxb-verification.java.net

Comparing two jaxb-generated objects by value

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Mon, 24 Jan 2005 11:40:02 +0100

Hi.

   public boolean equals(java.lang.Object obj) {
     System.out.println("geoColorTabImpl -equals");
       if (this == obj) {
           return true;
       }
       if ((null == obj)||(obj.getClass()!= this.getClass())) {
           return false;
       }
       meteorage.jobs.params.configuration.impl.GeoColorTabImpl target =
((meteorage.jobs.params.configuration.impl.GeoColorTabImpl) obj);
       {
           java.util.List value = this.getGeoColor();
           java.util.List targetValue = target.getGeoColor();
           if (!((value == targetValue)||((value!=
null)&&value.equals(targetValue)))) {
               return false;
           }
       }
       return true;
   }

> the condition " value.equals(targetValue)" in fact calls method
> "boolean equals(Object o);"
> in interface List and not method
> "public boolean equals(java.lang.Object obj)" in
> file GeoColorImpl.java

Actually, value.equals(targetValue) should compare two lists here, not
GeoColorImpls. The problem was that JAXB list implementation broke List
contract by not implementing the equals method correctly.
I have corrected this by hard-coding list comparision instead of
list.equals(anotherList) (which is, actually, also supposed to work).

Please check out a newer distribution.

Bye.
/lexi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb-verification.dev.java.net
For additional commands, e-mail: users-help_at_jaxb-verification.dev.java.net