Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-711

Unmarshaller Decorator for JAXBXmlTypeProvider doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.3.4.Final
    • 2.3.3.Final
    • None
    • None
    • Compatibility/Configuration
    • Workaround Exists
    • Hide

      introduce a class to override the readFrom() method in JAXBXmlTypeProvider, in the overriding class, invoke decorateUnmarshaller();

      unmarshaller = decorateUnmarshaller(type, annotations, mediaType, unmarshaller);

      Show
      introduce a class to override the readFrom() method in JAXBXmlTypeProvider, in the overriding class, invoke decorateUnmarshaller(); unmarshaller = decorateUnmarshaller(type, annotations, mediaType, unmarshaller);

    Description

      In the JAXBXmlTypeProvider, the readFrom() method doesn't invoke the decorateUnmarshaller() method, that cause the @XmlType classes which have been generated by XJC can't use "Decorator" feature for Unmarshaller.

      ------------------------------------------------------
      Below is source code pasted from JAXBXmlTypeProvider:

      public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException
      {
      try
      {
      JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
      if (suppressExpandEntityExpansion())

      { unmarshaller = new ExternalEntityUnmarshaller(unmarshaller); }

      Object obj = unmarshaller.unmarshal(entityStream);
      if (obj instanceof JAXBElement)

      { JAXBElement element = (JAXBElement) obj; return element.getValue(); }

      else

      { return obj; }

      }
      catch (JAXBException e)

      { throw new JAXBUnmarshalException(e); }

      }

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            kongzzzz Zzzz Kong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: