[freenet-cvs] r17916 - trunk/freenet/src/net/i2p/util

nextgens at freenetproject.org nextgens at freenetproject.org
Fri Feb 15 06:18:35 UTC 2008


Author: nextgens
Date: 2008-02-15 06:18:35 +0000 (Fri, 15 Feb 2008)
New Revision: 17916

Modified:
   trunk/freenet/src/net/i2p/util/NativeBigInteger.java
Log:
NativeBigInteger maybe fix a temporary temporary file leak

Modified: trunk/freenet/src/net/i2p/util/NativeBigInteger.java
===================================================================
--- trunk/freenet/src/net/i2p/util/NativeBigInteger.java	2008-02-15 05:18:05 UTC (rev 17915)
+++ trunk/freenet/src/net/i2p/util/NativeBigInteger.java	2008-02-15 06:18:35 UTC (rev 17916)
@@ -486,10 +486,12 @@
 	try {
 	    is=resource.openStream();
 	} catch(IOException e) {
+		f.delete();
 	    throw new FileNotFoundException();
 	}
 	
 	try {
+		f.deleteOnExit();
 	    FileOutputStream fos=new FileOutputStream(f);
 	    byte[] buf=new byte[4096*1024];
 	    int read;
@@ -497,15 +499,15 @@
 		fos.write(buf,0,read);
 	    fos.close();
 	    System.load(f.getAbsolutePath());
-	    f.deleteOnExit();
 	    return true;
 	} catch(IOException e) {
-	    f.delete();
 	} catch(UnsatisfiedLinkError ule) {
 	    f.delete();
 	    // likely to be "noexec" 
 	    if(ule.toString().toLowerCase().indexOf("not permitted")==-1)
 	    	throw ule;
+	} finally {
+		f.delete();
 	}
 
 	return false;	




More information about the cvs mailing list