Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.4
-
None
-
None
-
Axis 1.4
Description
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 AttachmentsImpl.java as shown below
// disabling the automatic deletion of the data sources
// for (java.util.Iterator i = orderedAttachments.iterator();
// i.hasNext() {
// AttachmentPart part = (AttachmentPart) i.next();
// DataHandler dh =
// AttachmentUtils.getActivationDataHandler(part);
// DataSource ds = dh.getDataSource();
//
// if ((ds != null) && (ds instanceof ManagedMemoryDataSource))
// }
I am not sure if this needs to be configurable using a property value.
Regards, Aki