You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <nm...@byteaction.de> on 2006/08/03 16:18:58 UTC

Re: svn commit: r428404 - /james/server/branches/v2.3/src/java/org/apache/james/core/MimeMessageInputStreamSource.java

That looks much better :-)

bye
Norman

Am Donnerstag, den 03.08.2006, 13:55 +0000 schrieb noel@apache.org:
> 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: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
> !EXCUBATOR:1,44d2008643381994124485!