[JBoss JIRA] Updated: (JBWS-800) ClassCastException when trying to marshal a subclass of Date
by Thomas Diesler (JIRA)
[ http://jira.jboss.com/jira/browse/JBWS-800?page=all ]
Thomas Diesler updated JBWS-800:
--------------------------------
Summary: ClassCastException when trying to marshal a subclass of Date (was: ClassCastException when trying to marshal a SybaseTimestamp)
> ClassCastException when trying to marshal a subclass of Date
> ------------------------------------------------------------
>
> Key: JBWS-800
> URL: http://jira.jboss.com/jira/browse/JBWS-800
> Project: JBoss Web Services
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: jaxrpc
> Affects Versions: jbossws-1.0.0.CR4
> Environment: Windows XP, JBoss 4.0.4.CR2
> Reporter: Chris Baxter
> Assigned To: Alexey Loubyansky
> Fix For: jbossws-1.2.0
>
>
> I have a EJB3 persistent bean mapped to a Sybase DB table. This table has datetime column that I have mapped back to a java.util.Date property on the persistent bean. This same bean class is returned from a webservice call. On JBoss 4.0.3SP1 (using Axis), I had no issues returning this object from my finder call. Now, when I switch to JBoss 4.0.4CR2 (using JBossWS), I get the following exception:
> Caused by: java.lang.ClassCastException: com.sybase.jdbc3.tds.SybTimestamp
> at org.jboss.xb.binding.SimpleTypeBindings.marshal(SimpleTypeBindings.java:1150)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalCharacters(XercesXsMarshaller.java:1169)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalSimpleType(XercesXsMarshaller.java:451)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMarshaller.java:405)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarshaller.java:380)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(XercesXsMarshaller.java:886)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarshaller.java:823)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroupSequence(XercesXsMarshaller.java:1102)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroup(XercesXsMarshaller.java:1057)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarshaller.java:729)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalComplexType(XercesXsMarshaller.java:685)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMarshaller.java:414)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarshaller.java:380)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(XercesXsMarshaller.java:886)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarshaller.java:810)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroupSequence(XercesXsMarshaller.java:1102)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroup(XercesXsMarshaller.java:1057)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarshaller.java:729)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalComplexType(XercesXsMarshaller.java:685)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMarshaller.java:414)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarshaller.java:380)
> at org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(XercesXsMarshaller.java:886)
> at org.jboss.xb.binding.XercesXsMarshaller.marshallInternal(XercesXsMarshaller.java:275)
> at org.jboss.xb.binding.XercesXsMarshaller.marshal(XercesXsMarshaller.java:222)
> at org.jboss.ws.jaxb.JAXBMarshallerImpl.marshal(JAXBMarshallerImpl.java:172)
> at org.jboss.ws.jaxrpc.encoding.JAXBSerializer.serialize(JAXBSerializer.java:100)
> at org.jboss.ws.soap.SOAPContentElement.getXMLFragment(SOAPContentElement.java:172)
> at org.jboss.ws.soap.SOAPContentElement.expandToDOM(SOAPContentElement.java:844)
> at org.jboss.ws.soap.SOAPContentElement.getChildNodes(SOAPContentElement.java:761)
> at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:201)
> at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:260)
> at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:260)
> at org.jboss.util.xml.DOMWriter.print(DOMWriter.java:177)
> at org.jboss.util.xml.DOMWriter.printNode(DOMWriter.java:126)
> at org.jboss.ws.server.ServiceEndpoint.postProcessResponse(ServiceEndpoint.java:306)
> ... 23 more
> In looking at the source code, I think I see why there may be a problem:
> else if(typeCode == XS_DATETIME)
> {
> Calendar c;
> if(value.getClass() == java.util.Date.class)
> {
> c = Calendar.getInstance();
> c.clear();
> c.setTime((java.util.Date)value);
> }
> else
> {
> c = (Calendar)value;
> }
> result = marshalDateTime(c);
> }
> The SybaseTimestamp class extends java.sql.Timestamp which in turn extends java.util.Date. That first 'if' should hit, but it won't because SybaseTimestamp.class != java.util.Date.class. Instead, I think the if statement should be:
> if(java.util.Date.class.isAssignableFrom(value.getClass()))
> I made this change and recompiled and everything works as expected now.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 10 months
[JBoss JIRA] Commented: (JBWS-1260) WSDL To Java - Parameter unwrapping fails for a lot of scenarios.
by Darran Lofthouse (JIRA)
[ http://jira.jboss.com/jira/browse/JBWS-1260?page=comments#action_12350666 ]
Darran Lofthouse commented on JBWS-1260:
----------------------------------------
Design discussions: -
such a part must refer to an element named after - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97638
Sequence containing 2 elements - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97270
What when we cannot unwrap the message parts? - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97271
Unwrapping empty sequences - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97608
Naming for anonymous types. - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97450
Unwrapping and complex types with attributes. - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97266
WSDL to Java Array Mappings - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=97264
> WSDL To Java - Parameter unwrapping fails for a lot of scenarios.
> -----------------------------------------------------------------
>
> Key: JBWS-1260
> URL: http://jira.jboss.com/jira/browse/JBWS-1260
> Project: JBoss Web Services
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: wstools
> Affects Versions: jbossws-1.0.4
> Reporter: Ole Matzura
> Assigned To: Darran Lofthouse
> Fix For: jbossws-1.2.0
>
>
> Testing parameter unwrapping when using wsdl to java with the following scenarios: -
> A - Element contains anonymous complex type which contains a single element.
> B - Element contains anonymous complex type which contains two elements.
> C - Element references complex type which contains a single element.
> D - Element references complex type which contains two elements.
> E - Element references complex type which contains an anonymous type which contains a single element.
> F - Element references complex type which contains an anonymous type which contains two elements.
> G - Element contains anonymous complex type which contains a single element which is an array. (1)
> H - Element references complex type which contains a single element which is an array. (3)
> I - Element references complex type which contains an anonymous type which contains a single element which is an array. (5)
> J - Element contains anonymout complex type which contains an empty sequence.
> K - Element references complex type which contains an empty sequence.
> L - Element references complex type which contains an anonymous type which contains an empty sequence.
> Scenarios A, B, and G are failing with the following error: -
> org.jboss.ws.WSException: String passed is null
> at org.jboss.ws.metadata.wsdl.WSDLUtils.firstLetterUpperCase(WSDLUtils.java:455)
> at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:137)
> at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:113)
> Scenario D
> The parameter is being unwrapped even though it contains two elements, one of the elements is being lost.
> Scenarios E, F, I, and L are failing with the following error: -
> java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
> at javax.xml.namespace.QName.<init>(Unknown Source)
> at javax.xml.namespace.QName.<init>(Unknown Source)
> at org.jboss.ws.tools.WSDLToJava.unwrapResponseParticles(WSDLToJava.java:316)
> Scenarios J, and K are failing with the following error: -
> org.jboss.ws.WSException: Attempt to unwrap a response type with no particles
> at org.jboss.ws.tools.WSDLToJava.unwrapResponse(WSDLToJava.java:285)
> at org.jboss.ws.tools.WSDLToJava.getReturnType(WSDLToJava.java:540)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 10 months
[JBoss JIRA] Reopened: (JBWS-1260) WSDL To Java - Parameter unwrapping fails for a lot of scenarios.
by Darran Lofthouse (JIRA)
[ http://jira.jboss.com/jira/browse/JBWS-1260?page=all ]
Darran Lofthouse reopened JBWS-1260:
------------------------------------
Add JAX-RPC spec section numbers to errors raised when unwrapping can not occur.
> WSDL To Java - Parameter unwrapping fails for a lot of scenarios.
> -----------------------------------------------------------------
>
> Key: JBWS-1260
> URL: http://jira.jboss.com/jira/browse/JBWS-1260
> Project: JBoss Web Services
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: wstools
> Affects Versions: jbossws-1.0.4
> Reporter: Ole Matzura
> Assigned To: Darran Lofthouse
> Fix For: jbossws-1.2.0
>
>
> Testing parameter unwrapping when using wsdl to java with the following scenarios: -
> A - Element contains anonymous complex type which contains a single element.
> B - Element contains anonymous complex type which contains two elements.
> C - Element references complex type which contains a single element.
> D - Element references complex type which contains two elements.
> E - Element references complex type which contains an anonymous type which contains a single element.
> F - Element references complex type which contains an anonymous type which contains two elements.
> G - Element contains anonymous complex type which contains a single element which is an array. (1)
> H - Element references complex type which contains a single element which is an array. (3)
> I - Element references complex type which contains an anonymous type which contains a single element which is an array. (5)
> J - Element contains anonymout complex type which contains an empty sequence.
> K - Element references complex type which contains an empty sequence.
> L - Element references complex type which contains an anonymous type which contains an empty sequence.
> Scenarios A, B, and G are failing with the following error: -
> org.jboss.ws.WSException: String passed is null
> at org.jboss.ws.metadata.wsdl.WSDLUtils.firstLetterUpperCase(WSDLUtils.java:455)
> at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:137)
> at org.jboss.ws.tools.XSDTypeToJava.createJavaFile(XSDTypeToJava.java:113)
> Scenario D
> The parameter is being unwrapped even though it contains two elements, one of the elements is being lost.
> Scenarios E, F, I, and L are failing with the following error: -
> java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
> at javax.xml.namespace.QName.<init>(Unknown Source)
> at javax.xml.namespace.QName.<init>(Unknown Source)
> at org.jboss.ws.tools.WSDLToJava.unwrapResponseParticles(WSDLToJava.java:316)
> Scenarios J, and K are failing with the following error: -
> org.jboss.ws.WSException: Attempt to unwrap a response type with no particles
> at org.jboss.ws.tools.WSDLToJava.unwrapResponse(WSDLToJava.java:285)
> at org.jboss.ws.tools.WSDLToJava.getReturnType(WSDLToJava.java:540)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 10 months