users@saaj.java.net

Re: [SAAJ-USR] Issue in XmlDataContentHandler

From: Arjen Poutsma <arjen.poutsma_at_springsource.com>
Date: Fri, 4 Jul 2008 14:58:54 +0200

As a workaround, I did the following:

CommandMap.setDefaultCommandMap(new MailcapCommandMap());

which resets the command map to the default, thus removing the custom
SAAJ content handlers. This solved the issue for me.

Still, the issue described below needs to be fixed, IMO.

Arjen

On 4 jul 2008, at 14:06, Arjen Poutsma wrote:

> Hi,
>
> I think there's a bug in the
> com.sun.xml.messaging.saaj.soap.XmlDataContentHandler, specifically
> the writeTo method. Here are the reproducible steps:
>
> 1. Create a SOAPMessage
> 2. Add an AttachmentPart (registers the SAAJ content handlers)
> 3. Using the Java Activation CommandMap, request a
> DataContentHandler for text/xml. This should give you the
> XmlDataContentHandler.
> 4. call writeTo() on said content handler, with the parameter
> mimeType set to "text/xml; charset=UTF-8" (or any other character set)
> 5. Get a java.io.IOException: Invalid content type "text/xml;
> charset=UTF-8" for XmlDCH
>
> This seems due to the mime type check done in the content handler,
> which checks for equality with "text/xml" or "application/xml".
> Elsewhere in the code, a - more robust - startsWith() comparison is
> done.
>
> Let me know if you need any more information.
>
> Best regards,
>
> Arjen
> ---
> Arjen Poutsma
> Senior Software Engineer, SpringSource
> Spring Web Services Lead
> E: arjen.poutsma_at_springsource.com
> W: www.springsource.com
> B: blog.springsource.com/arjen
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_saaj.dev.java.net
> For additional commands, e-mail: users-help_at_saaj.dev.java.net
>