kyle o created CXF-6364:
---------------------------

             Summary: Large Temporary Files Aren't Deleted After DataHandler 
InputStream Close
                 Key: CXF-6364
                 URL: https://issues.apache.org/jira/browse/CXF-6364
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: Occurs on Ubuntu and Windows
            Reporter: kyle o


This appears to be a re-occurrence of CXF-2016 
(https://issues.apache.org/jira/browse/CXF-2106). I'm closing the DataHandler 
InputStream, but the temporary file isn't being deleted.

Sample code:
if (null != message.getAttachments()) {
        Collection<Attachment> attachmentCollection = message.getAttachments();
        
        if (attachmentCollection.size() > 0) {
                for (Attachment attachment : attachmentCollection) {
                        
                        DataHandler handler = attachment.getDataHandler();
                        
                        if (null != handler.getInputStream()) {
                                attachmentMap.put(attachment.getId(), 
Utils.convertStreamToString(handler.getInputStream()));
                        }
                        
                        if(handler != null)
                                if(handler.getInputStream() != null)
                                        handler.getInputStream().close();
                        
                }
        }
}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to