commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r758773 - in /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors: BZip2TestCase.java GZipTestCase.java
Date Thu, 26 Mar 2009 17:52:43 GMT
Author: sebb
Date: Thu Mar 26 17:52:19 2009
New Revision: 758773

URL: http://svn.apache.org/viewvc?rev=758773&view=rev
Log:
Tidy up streams and files after use

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java?rev=758773&r1=758772&r2=758773&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/BZip2TestCase.java
Thu Mar 26 17:52:19 2009
@@ -34,8 +34,10 @@
 		final File output = new File(dir, "test.txt.bz2");
 		final OutputStream out = new FileOutputStream(output);
 		final CompressorOutputStream cos = new CompressorStreamFactory().createCompressorOutputStream("bzip2",
out);
-		IOUtils.copy(new FileInputStream(input), cos);
+		FileInputStream in = new FileInputStream(input);
+		IOUtils.copy(in, cos);
 		cos.close();
+		in.close();
 	}
 	
 	public void testBzip2Unarchive() throws Exception {
@@ -43,8 +45,10 @@
 		final File output = new File(dir, "bla.txt");
         final InputStream is = new FileInputStream(input);
         final CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream("bzip2",
is);
-        IOUtils.copy(in, new FileOutputStream(output));
-		in.close();
+        FileOutputStream os = new FileOutputStream(output);
+        IOUtils.copy(in, os);
+		is.close();
+		os.close();
     }
 
 }

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java?rev=758773&r1=758772&r2=758773&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
Thu Mar 26 17:52:19 2009
@@ -43,8 +43,11 @@
 		final File output = new File(dir, "bla.tar");
         final InputStream is = new FileInputStream(input);
         final CompressorInputStream in = new CompressorStreamFactory().createCompressorInputStream("gz",
is);
-        IOUtils.copy(in, new FileOutputStream(output));
+        FileOutputStream out = new FileOutputStream(output);
+        IOUtils.copy(in, out);
 		in.close();
+		is.close();
+		out.close();
     }
 
 }



Mime
View raw message