[
https://issues.apache.org/jira/browse/SYNAPSE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600949#action_12600949
]
Andreas Veithen commented on SYNAPSE-309:
-----------------------------------------
Setting a default contentType inside the default constructor is not a solution
because in this case getSOAPPartContentID falls back to the ID of the first
MIME part, which would be incorrect. The basic question is actually to find a
clean way to distinguish the SOAP part from non SOAP parts that works for any
Attachments instance (no matter whether it has been created from an incoming
message or programmatically using the default constructor). I've posted a
message on the WS commons mailing list about that.
> Adding an attachment causes failure in MessageHelper.clonePartially
> -------------------------------------------------------------------
>
> Key: SYNAPSE-309
> URL: https://issues.apache.org/jira/browse/SYNAPSE-309
> Project: Synapse
> Issue Type: Bug
> Components: Core
> Reporter: Andreas Veithen
> Fix For: 1.3
>
>
> The failure occurs in the following scenario:
> * The incoming message is not a SwA message.
> * A mediator adds an attachment using one of the
> org.apache.axis2.context.MessageContext#addAttachment methods.
> This causes MessageContext to create a new Attachments object using the
> default constructor. When the message is sent out later,
> MessageHelper.clonePartially fails on the following instruction:
> String soapPart = attachments.getSOAPPartContentID();
> A NullPointerException is triggered inside the
> Attachments#getSOAPPartContentID method because it tries to use the
> contentType attribute which is null in this case (Attachments object created
> using the default constructor).
> The problem can be solved easily by catching the NPE in clonePartially. Using
> this workaround I was able to successfully send out the message with the
> attachment, but intercepting NullPointerException is not a very clean
> solution.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]