You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by re...@apache.org on 2010/03/11 11:08:22 UTC
svn commit: r921768 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
Author: regisxu
Date: Thu Mar 11 10:08:22 2010
New Revision: 921768
URL: http://svn.apache.org/viewvc?rev=921768&view=rev
Log:
Apply patch for HARMONY-6468: [classlib][luni]Resource may not be close in the JarURLConnectionImpl.java
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java?rev=921768&r1=921767&r2=921768&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java Thu Mar 11 10:08:22 2010
@@ -150,12 +150,12 @@ public class JarURLConnectionImpl extend
jar = AccessController
.doPrivileged(new PrivilegedAction<JarFile>() {
public JarFile run() {
+ FileOutputStream fos = null;
try {
File tempJar = File.createTempFile(
"hyjar_", ".tmp", null);
tempJar.deleteOnExit();
- FileOutputStream fos = new FileOutputStream(
- tempJar);
+ fos = new FileOutputStream(tempJar);
byte[] buf = new byte[4096];
int nbytes = 0;
while ((nbytes = is.read(buf)) > -1) {
@@ -167,6 +167,12 @@ public class JarURLConnectionImpl extend
| ZipFile.OPEN_DELETE);
} catch (IOException e) {
return null;
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {}
+ }
}
}
});