You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Marko Voss (JIRA)" <ji...@apache.org> on 2012/06/14 17:06:43 UTC

[jira] [Updated] (CXF-4380) JAXBElementProvider is calling wrong method for classes extending JAXBElement

     [ https://issues.apache.org/jira/browse/CXF-4380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marko Voss updated CXF-4380:
----------------------------

    Description: 
JAXBElementProvider line 170 - 176:

This peace of code performs a special handling for classes, which extends JAXBElement but it calls the wrong unmarshal method.

Unmarshaller.unmarshal(Source source, Class<?> declaredType)
Unmarshaller.unmarshal(XMLStreamReader reader, Class<?> declaredType)
Unmarshaller.unmarshal(XMLEventReader reader, Class<?> declaredType)
Unmarshaller.unmarshal(Node node, Class<?> declaredType)

These methods are not able to deal with classes, which extend JAXBElement, because they explicitly check, if the declaredType is part of the known classes of the JAXBContext. This is not the case.

Please use the other methods instead.

Suggested solution: Change

{code}
response = unmarshaller.unmarshal(TransformUtils.createNewReaderIfNeeded(reader, is), theType);
{code}

to

{code}
response = unmarshaller.unmarshal(TransformUtils.createNewReaderIfNeeded(reader, is));
{code}

  was:
JAXBElementProvider line 170 - 176:

This peace of code performs a special handling for classes, which extends JAXBElement but it calls the wrong unmarshal method.

Unmarshaller.unmarshal(Source source, Class<?> declaredType)
Unmarshaller.unmarshal(XMLStreamReader reader, Class<?> declaredType)
Unmarshaller.unmarshal(XMLEventReader reader, Class<?> declaredType)
Unmarshaller.unmarshal(Node node, Class<?> declaredType)

These methods are not able to deal with classes, which extend JAXBElement, because they explicitly check, if the declaredType is part of the known classes of the JAXBContext. This is not the case.

Please use the other methods instead.

    
> JAXBElementProvider is calling wrong method for classes extending JAXBElement
> -----------------------------------------------------------------------------
>
>                 Key: CXF-4380
>                 URL: https://issues.apache.org/jira/browse/CXF-4380
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.6.1
>            Reporter: Marko Voss
>
> JAXBElementProvider line 170 - 176:
> This peace of code performs a special handling for classes, which extends JAXBElement but it calls the wrong unmarshal method.
> Unmarshaller.unmarshal(Source source, Class<?> declaredType)
> Unmarshaller.unmarshal(XMLStreamReader reader, Class<?> declaredType)
> Unmarshaller.unmarshal(XMLEventReader reader, Class<?> declaredType)
> Unmarshaller.unmarshal(Node node, Class<?> declaredType)
> These methods are not able to deal with classes, which extend JAXBElement, because they explicitly check, if the declaredType is part of the known classes of the JAXBContext. This is not the case.
> Please use the other methods instead.
> Suggested solution: Change
> {code}
> response = unmarshaller.unmarshal(TransformUtils.createNewReaderIfNeeded(reader, is), theType);
> {code}
> to
> {code}
> response = unmarshaller.unmarshal(TransformUtils.createNewReaderIfNeeded(reader, is));
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira