Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-226

DataContentHandler for text/xml expects Source objects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jboss-ws4ee-4.0.3
    • jboss-ws4ee-4.0.2
    • jbossws-native
    • None

      The JAFConfigService installs mappings for text/xml and application/xml to use the class org.jboss.webservice.jaf.XMLDataContentHandler.

      The writeTo() method of this class expects the object that is to be written to an OutputStream to be of type javax.xml.transform.Source and doesn't guard against other Object types or provide support for them.

      For example, if application code like the following is used

      Datahandler dh = new DataHandler( "<? xml version=....etc.", "text/xml" );
      InputStream istream = dh.getInputStream();

      the first time the InputStream is read, an EOF indication will be returned.

      I would suggest that the code block starting at XMLDataContentHandler.writeTo() on line 133

      if (obj instanceof StreamSource)

      should have an addition else block after

      else if (obj instanceof SAXSource)

      something along the lines of

      else
      {
      String charset = getCharSetFromMimeType( mimeType );
      os.write( obj.toString().getBytes( charset );
      }

            jgreene@redhat.com Jason Greene
            mark_wilson Mark Wilson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: