java.sql.Date with alternative type binding causes ClassCastException ---------------------------------------------------------------------
Key: CXF-2057 URL: https://issues.apache.org/jira/browse/CXF-2057 Project: CXF Issue Type: Bug Components: Aegis Databinding Affects Versions: 2.1.4 Environment: Java 1.5 Reporter: Dennis Kieselhorst Put a java.sql.Date from a ResultSet in a DTO as java.util.Date. The value is correctly serialized as xsd:dateTime. After adding the following mapping (found at http://cwiki.apache.org/CXF20DOC/aegis-21.html), a ClassCastException is thrown: <mappings xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <mapping> <property name="birthday" type="org.apache.cxf.aegis.type.basic.DateType" typeName="xsd:date"/> </mapping> </mappings> java.lang.ClassCastException: java.sql.Date at org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType.writeObject(XMLGregorianCalendarType.java:54) at org.apache.cxf.aegis.type.basic.BeanType.writeElement(BeanType.java:377) at org.apache.cxf.aegis.type.basic.BeanType.writeObjectInternal(BeanType.java:356) at org.apache.cxf.aegis.type.basic.BeanType.writeObject(BeanType.java:293) at org.apache.cxf.aegis.type.basic.BeanType.writeElement(BeanType.java:377) at org.apache.cxf.aegis.type.basic.BeanType.writeObjectInternal(BeanType.java:356) at org.apache.cxf.aegis.type.basic.BeanType.writeObject(BeanType.java:293) at org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:92) at org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:43) at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:113) at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:285) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:168) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175) at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:153) I can create a testcase, if needed. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.