[ https://issues.apache.org/jira/browse/CXF-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676474#action_12676474 ]
Benson Margulies commented on CXF-2057: --------------------------------------- Part of the problem: that doc you reference, which floated along from XFire, claims that Aegis respects a type= to specify the Type for the mapping. Well, there's a tiny shred of code that might imply this, but the rest of the implementation is just missing. I'm a bit in a quandry as to whether this feature should be invented, or whether the real issue here is that the actual type of the object is not being used to select the Type, only the static declaration. More news as I sort it out. > 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 > Assignee: Benson Margulies > > 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.