commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r758771 - in /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers: ArTestCase.java CpioTestCase.java TarTestCase.java
Date Thu, 26 Mar 2009 17:50:21 GMT
Author: sebb
Date: Thu Mar 26 17:50:00 2009
New Revision: 758771

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

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java?rev=758771&r1=758770&r2=758771&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
Thu Mar 26 17:50:00 2009
@@ -65,6 +65,7 @@
 			IOUtils.copy(new FileInputStream(file2), os);
 			os.closeArchiveEntry();
 			os.close();
+			out.close();
 		}
 		
 		// UnArArchive Operation
@@ -80,6 +81,7 @@
     
         out.close();
         in.close();
+        is.close();
 	}
 
 }

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java?rev=758771&r1=758770&r2=758771&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/CpioTestCase.java
Thu Mar 26 17:50:00 2009
@@ -49,6 +49,7 @@
         os.closeArchiveEntry();
 
         os.close();
+        out.close();
     }
 
     public void testCpioUnarchive() throws Exception {
@@ -87,6 +88,7 @@
             result.put(entry.getName(), target);
         }
         in.close();
+        is.close();
 
         int lineSepLength = System.getProperty("line.separator").length();
 

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java?rev=758771&r1=758770&r2=758771&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/TarTestCase.java
Thu Mar 26 17:50:00 2009
@@ -67,9 +67,12 @@
         entry.setGroupName("excalibur");
         entry.setMode(0100000);
         os.putArchiveEntry(entry);
-        IOUtils.copy(new FileInputStream(file1), os);
+        FileInputStream in = new FileInputStream(file1);
+        IOUtils.copy(in, os);
         os.closeArchiveEntry();
         os.close();
+        out.close();
+        in.close();
         
         
         ArchiveOutputStream os2 = null;
@@ -93,6 +96,7 @@
         } finally {
         	if (os2 != null){
         	    os2.closeArchiveEntry();
+        	    os2.close();
         	}
         }
     }
@@ -104,8 +108,8 @@
         final TarArchiveEntry entry = (TarArchiveEntry)in.getNextEntry();
         final OutputStream out = new FileOutputStream(new File(dir, entry.getName()));
         IOUtils.copy(in, out);
-        out.close();
         in.close();
+        out.close();
     }
 
 }



Mime
View raw message