[
https://issues.apache.org/jira/browse/SYNAPSE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601371#action_12601371
]
Andreas Veithen commented on SYNAPSE-309:
-----------------------------------------
Shortly after my post, a null check on contentType has been added to the
getSOAPPartContentID method:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java?r1=651600&r2=661562&diff_format=h
According to the commit comment this was done to solve issue AXIS2-3805, but it
should also solve our issue.
> 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]