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]

Reply via email to