axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "indika priyantha kumara (JIRA)" <>
Subject [jira] Created: (AXIS2-1397) MTOM attachment Streaming -problem when deal with multiple attachment- got NPE
Date Mon, 16 Oct 2006 09:19:35 GMT
MTOM attachment Streaming -problem when deal with multiple attachment- got NPE

                 Key: AXIS2-1397
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: om
            Reporter: indika priyantha kumara

 I have got NPE when iterating multiple attachment using API method isReadyToGetNextStream()
	at org.apache.axiom.attachments.MultipartAttachmentStreams.getNextStream(

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)),

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message