Author: noel
Date: Thu Aug 3 06:55:57 2006
New Revision: 428404
URL: http://svn.apache.org/viewvc?rev=428404&view=rev
Log:
JAMES-585. Remove the temporary file immediately if there is an IOException
creating it, rather than cleaning up later.
Modified:
james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java
Modified:
james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java
URL:
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java?rev=428404&r1=428403&r2=428404&view=diff
==============================================================================
---
james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java
(original)
+++
james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java
Thu Aug 3 06:55:57 2006
@@ -81,6 +81,22 @@
sourceId = file.getCanonicalPath();
} catch (IOException ioe) {
+ // We had an IOException preparing the temporary file, so
+ // don't just leave it around to garbage collect later.
+ // It isn't as if we are going to use it after we throw
+ // the MessagingException.
+ if (fout != null) try {
+ fout.close();
+ fout = null;
+ } catch (IOException _) {
+ // Ignored - logging unavailable to log this error.
+ }
+
+ if (file != null) {
+ file.delete();
+ file = null;
+ }
+
throw new MessagingException("Unable to retrieve the data: " +
ioe.getMessage(), ioe);
} finally {
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]