[ https://issues.apache.org/jira/browse/AXIS-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Akitoshi Yoshida updated AXIS-2782: ----------------------------------- Attachment: AttachmentPart.zip suggested modification to solve this issue. > AttachmentPart does not remove its temporary Axis???.att file, created by > ManagedMemoryDataSource, if this file is created by its flushToDisk method > ---------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: AXIS-2782 > URL: https://issues.apache.org/jira/browse/AXIS-2782 > Project: Axis > Issue Type: Bug > Components: Basic Architecture > Affects Versions: 1.4 > Environment: Windows XP > Axis 1.4 > Reporter: Akitoshi Yoshida > Fix For: current (nightly) > > Attachments: AttachmentPart.zip > > > org.apache.axis.attachments.AttachmentPart has its resource clean up method > dispose(), which gets called when the message is garbage collected. > This AttachmentPart uses org.apache.axis.attachments.ManagedMemoryDataSource > to hold the attachment content. > The ManagedMemoryDataSource class may create a temporary Axis???.att file and > flush the content into this file when there are too many mesages held in > memoryh. > When this happens, unfortunately the ManagedMemoryDataSource object's > delete() method is not called, when its associated AttachementPart object's > dispose() method gets called, as attribute attachmentFile is null as shown in > the following code segment: > public synchronized void dispose() { > if (attachmentFile != null) { > javax.activation.DataSource ds = datahandler.getDataSource(); > if (ds instanceof ManagedMemoryDataSource) { > ((ManagedMemoryDataSource) ds).delete(); //and delete the file > } else { > File f = new File(attachmentFile); > //no need to check for existence here. > f.delete(); > } > //set the filename to null to stop repeated use > setAttachmentFile(null); > } > Consequently, this temporary file is not removed. > To fix this problem, I think the ManagedMemoryDataSource's delete method > needs to be called independent of the attachmentFile attribute value, as in > public synchronized void dispose() { > javax.activation.DataSource ds = datahandler.getDataSource(); > // delete the ManagedMemoryDataSource (may have been flushed into a > temp file) > if (ds instanceof ManagedMemoryDataSource) { > ((ManagedMemoryDataSource) ds).delete(); //and delete the file > } > if (attachmentFile != null) { > File f = new File(attachmentFile); > //no need to check for existence here. > f.delete(); > //set the filename to null to stop repeated use > setAttachmentFile(null); > } > Regards, aki -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.