You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2008/05/12 11:25:55 UTC

[jira] Created: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Resolved: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved SYNAPSE-309.
-------------------------------------

    Resolution: Fixed

> 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
>            Assignee: 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Commented: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Assigned: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen reassigned SYNAPSE-309:
---------------------------------------

    Assignee: Andreas Veithen

> 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
>            Assignee: 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Commented: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


[jira] Commented: (SYNAPSE-309) Adding an attachment causes failure in MessageHelper.clonePartially

Posted by "Kalani Ruwanpathirana (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org