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

JAXBElementProvider is calling wrong method for classes extending JAXBElement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.1
    • 2.4.9, 2.5.5, 2.6.2, 2.7
    • JAX-RS
    • None
    • 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. package-info.java
          0.6 kB
          Marko Voss
        4. ObjectFactory.java
          4 kB
          Marko Voss
        5. FilterTypeTO.java
          3 kB
          Marko Voss

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: