cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Kieselhorst (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (CXF-2057) java.sql.Date with alternative type binding causes ClassCastException
Date Wed, 25 Feb 2009 13:23:02 GMT

    [ https://issues.apache.org/jira/browse/CXF-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676644#action_12676644
] 

deki edited comment on CXF-2057 at 2/25/09 5:22 AM:
------------------------------------------------------------------

Register as rootClass against DateType?

This didn't work:
      typeMapping.register(java.util.Date.class, XMLSchemaQNames.XSD_DATE, new org.apache.cxf.aegis.type.basic.DateType());
      typeMapping.register(java.sql.Date.class, XMLSchemaQNames.XSD_DATE, new org.apache.cxf.aegis.type.basic.DateType());

I assume you meant XMLGregorianCalendarType and not XMLGregorianDateType. Tried to remove
it with:

    TypeMapping typeMapping = aegisContext.getTypeMapping();
    if (typeMapping!=null) {
      LOG.info("XMLGregorianCalendarType registered? "+typeMapping.isRegistered(XMLGregorianCalendarType.class));
      LOG.info("XMLGregorianCalendar registered? "+typeMapping.isRegistered(XMLGregorianCalendar.class));
      Type type = typeMapping.getType(XMLSchemaQNames.XSD_DATE);
      if (type!=null) {
        LOG.info("removing "+type.getTypeClass());
        typeMapping.removeType(type);
      } else {
        LOG.info("no type present for "+XMLSchemaQNames.XSD_DATE);
      }
      LOG.info("XMLGregorianCalendarType registered? "+typeMapping.isRegistered(XMLGregorianCalendarType.class));
      LOG.info("XMLGregorianCalendar registered? "+typeMapping.isRegistered(XMLGregorianCalendar.class));
     
    } else {
      LOG.warn("no typeMapping present");
    }

Seems to be removed:

0225 14:18:21 INFO  XMLGregorianCalendarType registered? false
0225 14:18:21 INFO  XMLGregorianCalendar registered? true
0225 14:18:21 INFO  removing class javax.xml.datatype.XMLGregorianCalendar
0225 14:18:21 INFO  XMLGregorianCalendarType registered? false
0225 14:18:21 INFO  XMLGregorianCalendar registered? false

But exception stays the same afterwards.

      was (Author: deki):
    Register as rootClass against DateType?

This didn't work:
      typeMapping.register(java.util.Date.class, XMLSchemaQNames.XSD_DATE, new org.apache.cxf.aegis.type.basic.DateType());
      typeMapping.register(java.sql.Date.class, XMLSchemaQNames.XSD_DATE, new org.apache.cxf.aegis.type.basic.DateType());

I assume you meant XMLGregorianCalendarType and not XMLGregorianDateType. Tried to remove
it with:

    TypeMapping typeMapping = aegisContext.getTypeMapping();
    if (typeMapping!=null) {
      LOG.info("XMLGregorianCalendarType registered? "+typeMapping.isRegistered(XMLGregorianCalendarType.class));
      LOG.info("XMLGregorianCalendar registered? "+typeMapping.isRegistered(XMLGregorianCalendar.class));
      Type type = typeMapping.getType(XMLSchemaQNames.XSD_DATE);
      if (type!=null) {
        LOG.info("removing "+type.getTypeClass());
        typeMapping.removeType(type);
      } else {
        LOG.info("no type present for "+XMLSchemaQNames.XSD_DATE);
      }
      LOG.info("XMLGregorianCalendarType registered? "+typeMapping.isRegistered(XMLGregorianCalendarType.class));
      LOG.info("XMLGregorianCalendar registered? "+typeMapping.isRegistered(XMLGregorianCalendar.class));
     
    } else {
      LOG.warn("no typeMapping present");
    }

Seems to be removed:

0225 14:18:21 INFO  de.ewetel.b2b.backend.core.util.AegisContextHelper XMLGregorianCalendarType
registered? false
0225 14:18:21 INFO  de.ewetel.b2b.backend.core.util.AegisContextHelper XMLGregorianCalendar
registered? true
0225 14:18:21 INFO  de.ewetel.b2b.backend.core.util.AegisContextHelper removing class javax.xml.datatype.XMLGregorianCalendar
0225 14:18:21 INFO  de.ewetel.b2b.backend.core.util.AegisContextHelper XMLGregorianCalendarType
registered? false
0225 14:18:21 INFO  de.ewetel.b2b.backend.core.util.AegisContextHelper XMLGregorianCalendar
registered? false

But exception stays the same afterwards.
  
> 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
>             Fix For: 2.2
>
>
> 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.


Mime
View raw message