The equals() method for both Duration and XMLGregorianCalendar specify
that a NullPointerException is thrown if the parameter passed to the
method is null. This seems to violate the general contract of
Object.equals() which says: "For any non-null reference value x,
x.equals(null) should return false". A generic method such as:
public boolean isEqual(Object a, Object b) {
return (a == b || (a != null && a.equals(b)));
}
should work for all Objects but would fail unexpectedly with a
NullPointerException if it's passed instances of Duration or
XMLGregorianCalendar along with null as the second parameter.
The API JavaDocs have been updated.
that a NullPointerException is thrown if the parameter passed to the
method is null. This seems to violate the general contract of
Object.equals() which says: "For any non-null reference value x,
x.equals(null) should return false". A generic method such as:
public boolean isEqual(Object a, Object b) {
return (a == b || (a != null && a.equals(b)));
}
should work for all Objects but would fail unexpectedly with a
NullPointerException if it's passed instances of Duration or
XMLGregorianCalendar along with null as the second parameter.
The API JavaDocs have been updated.