Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4380

JAXBElementProvider is calling wrong method for classes extending JAXBElement

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.1
    • Fix Version/s: 2.4.9, 2.5.5, 2.6.2, 2.7
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      JAXBElementProvider line 170 - 176:

      This piece 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

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

      to

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

        Attachments

        1. RevokeGrantsTaskParamTO.java
          0.9 kB
          Marko Voss
        2. ParamTypeTO.java
          3 kB
          Marko Voss
        3. FilterTypeTO.java
          3 kB
          Marko Voss
        4. package-info.java
          0.6 kB
          Marko Voss
        5. ObjectFactory.java
          4 kB
          Marko Voss

          Activity

            People

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              marko voss Marko Voss
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: