axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akitoshi Yoshida (JIRA)" <>
Subject [jira] Created: (AXIS-2802) AttachmentsImpl.writeContentToStream automatically deletes ManagedMemoryDataSource instances
Date Wed, 26 Aug 2009 15:09:59 GMT
AttachmentsImpl.writeContentToStream automatically deletes ManagedMemoryDataSource instances

                 Key: AXIS-2802
             Project: Axis
          Issue Type: Bug
          Components: SAAJ
    Affects Versions: 1.4
         Environment: Axis 1.4 
            Reporter: Akitoshi Yoshida
             Fix For: current (nightly)

I couldn't find the answer to the following question in JIRA nor in
the mail archive.

Axis's AttachmentsImpl.writeContentToStream always automatically
delete the associated instances of ManagedMemoryDataSources.
This prevents from a message to be written to somewhere twice when one
of the attachments was instantiated using ManagedMemoryDataSource.

AttachmentsImpl has the dispose() method that can explicitly dispose
the attachments. And this dispose method will get called automatically
when the conainer mesage goes out of scope.
So I don't know why the above write method must automatically delete
the managed memory data sources.
Even if some use case requires such an automatic disposal after
writing, there should be an option to keep the attachments after
writing so that the message can be written out more than once.

Currently, to avoid this problem, one must swap the data handler
before writing out or use a local AttachmentsImpl implementation that
does not delete the data sources after writing out.

This automatic deletion after writing can be disabled by commenting out the following part
 starting at line500 of as shown below

        // disabling the automatic deletion of the data sources
//        for (java.util.Iterator i = orderedAttachments.iterator();
//             i.hasNext();) {
//            AttachmentPart part = (AttachmentPart);
//            DataHandler dh =
//                    AttachmentUtils.getActivationDataHandler(part);
//            DataSource ds = dh.getDataSource();
//            if ((ds != null) && (ds instanceof ManagedMemoryDataSource)) {
//                ((ManagedMemoryDataSource) ds).delete();
//            }
//        }

I am not sure if this needs to be configurable using a property value.

Regards, Aki

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message