[ 
https://issues.apache.org/jira/browse/SYNAPSE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600438#action_12600438
 ] 

Kalani Ruwanpathirana commented on SYNAPSE-309:
-----------------------------------------------

I had a look into this issue and seems like this occurs due to an issue in 
Axiom code. 

The default constructor of the "org.apache.axiom.attachments.Attachments" class 
allows to create an Attachment instance without setting a default value to the 
"contentType" attribute. Inside the method getSOAPPartContentID(), the 
getParameter() method is called on contentType attribue without performing a 
null check.

We can easily get this fixed by adding a null check to the 
getSOAPPartContentID() method or by setting a default contentType inside the 
default constructor.

So we will have to file this against AXIOM, I guess. What do you think?

> 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