You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Peter Cowan (JIRA)" <xe...@xml.apache.org> on 2013/09/27 17:28:02 UTC

[jira] [Created] (XERCESJ-1620) ClassCastException in XMLGregorianCalendar when comparing different implementations of XMLGregorianCalendar

Peter Cowan created XERCESJ-1620:
------------------------------------

             Summary: ClassCastException in XMLGregorianCalendar when comparing different implementations of XMLGregorianCalendar
                 Key: XERCESJ-1620
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1620
             Project: Xerces2-J
          Issue Type: Bug
          Components: JAXP (javax.xml.datatype)
    Affects Versions: 2.11.0
            Reporter: Peter Cowan


When using the compare method on the XMLGregorianCalendarImpl, it attempts to cast both the lhs and the rhs XMLGregorianCalendars to an XMLGregorianCalendarImpl.
If a user supplies a non-Xerces or repackaged implementation of XMLGregorianCalendar to this method a ClassCastException is thrown.
The objects P and Q that are created from the cast to XMLGregorianCalendarImpl are then passed to the internalCompare method which only requires the arguments to be the abstract class, rendering the cast irrelevant.

Since the equality of a Xerces XMLGregorianCalendar delegates to compare, the equals method is then prone to throwing the ClassCastException if a non-Xerces or repackaged implementation is supplied.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org