You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Davanum Srinivas (JIRA)" <ji...@apache.org> on 2007/06/09 21:36:27 UTC
[jira] Commented: (AXIS2-1397) MTOM attachment Streaming -problem
when deal with multiple attachment- got NPE
[ https://issues.apache.org/jira/browse/AXIS2-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503117 ]
Davanum Srinivas commented on AXIS2-1397:
-----------------------------------------
Indika,
Please upload some sample code to recreate the issue with latest release or nightly.
thanks,
dims
> MTOM attachment Streaming -problem when deal with multiple attachment- got NPE
> ------------------------------------------------------------------------------
>
> Key: AXIS2-1397
> URL: https://issues.apache.org/jira/browse/AXIS2-1397
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: om
> Reporter: indika priyantha kumara
> Assignee: Thilina Gunarathne
>
> I have got NPE when iterating multiple attachment using API method isReadyToGetNextStream() and
> getNextStream()
> java.lang.NullPointerException
> at org.apache.axiom.attachments.MultipartAttachmentStreams.getNextStream(MultipartAttachmentStreams.java:63)
> It is seem as even stream comes to end ,the boolean value of isReadyToGetNextStream() is true;
> Java Code
> Attachments attachments = null;
> if (this.opcts != null) {
> attachments = (Attachments) this.opcts.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getProperty(MTOMConstants.ATTACHMENTS);
> }
> else {
> throw new AxisFault("Message context not set/Attachments not set");
> }
> // Get image data
> IncomingAttachmentStreams streams = attachments.getIncomingAttachmentStreams();
> int i = 0;
> while (streams.isReadyToGetNextStream()) {
>
> OMElement file = fac.createOMElement("file" + (i + 1), null);
> IncomingAttachmentInputStream stream = streams.getNextStream();
> if(stream !=null) {
> byte[] data = IOUtils.getStreamAsByteArray(stream);
> //setting response
> OMText omText = fac.createOMText(new DataHandler(new ByteArrayDataSource(data)), true);
> file.addChild(omText);
> elem.addChild(file);
> }
> }
>
> }
--
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org