commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r767391 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/cpio/ main/java/org/apache/commons/compress/archivers/tar/ main/java/org/apache/commons/compress/archivers/zip/ main/java/org/apache/commons/co...
Date Wed, 22 Apr 2009 06:26:09 GMT
Author: grobmeier
Date: Wed Apr 22 06:26:09 2009
New Revision: 767391

URL: http://svn.apache.org/viewvc?rev=767391&view=rev
Log:
COMPRESS-64: finish() does not close archive entries by default any longer

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.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/jar/JarArchiveOutputStreamTest.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
Wed Apr 22 06:26:09 2009
@@ -333,7 +333,6 @@
      */
     public void close() throws IOException {
         if (!this.closed) {
-            this.finish();
             out.close();
             this.closed = true;
         }

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
Wed Apr 22 06:26:09 2009
@@ -118,14 +118,11 @@
     }
 
     /**
-     * Ends the TAR archive and closes the underlying OutputStream.
-     * This means that finish() is called followed by calling the
-     * TarBuffer's close().
+     * Closes the underlying OutputStream.
      * @throws IOException on error
      */
     public void close() throws IOException {
         if (!closed) {
-            finish();
             buffer.close();
             out.close();
             closed = true;

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
Wed Apr 22 06:26:09 2009
@@ -527,8 +527,6 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public void close() throws IOException {
-        finish();
-
         if (raf != null) {
             raf.close();
         }

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
Wed Apr 22 06:26:09 2009
@@ -53,6 +53,9 @@
      * Performs all changes collected in this ChangeSet on the input stream and
      * streams the result to the output stream. Perform may be called more than once.
      * 
+     * This method finishes the stream, no other entries should be added
+     * after that.
+     * 
      * @param in
      *            the InputStream to perform the changes on
      * @param out
@@ -122,7 +125,7 @@
                 results.addedFromChangeSet(change.getEntry().getName());
             }
         }
-        
+        out.finish();
         return results;
     }
 

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Wed Apr 22 06:26:09 2009
@@ -155,6 +155,7 @@
             addArchiveEntry(out, "something/bla", file6);
             addArchiveEntry(out, "test with spaces.txt", file6);
 
+            out.finish();
             return archive;
         } finally {
             if (out != null) {
@@ -196,6 +197,7 @@
             archive = File.createTempFile("empty", "." + archivename);
             stream = new FileOutputStream(archive);
             out = factory.createArchiveOutputStream(archivename, stream);
+            out.finish();
         } finally {
             if (out != null) {
                 out.close();
@@ -223,6 +225,7 @@
             out = factory.createArchiveOutputStream(archivename, stream);
             // Use short file name so does not cause problems for ar
             addArchiveEntry(out, "test1.xml", getFile("test1.xml"));
+            out.finish();
         } finally {
             if (out != null) {
                 out.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=767391&r1=767390&r2=767391&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
Wed Apr 22 06:26:09 2009
@@ -72,7 +72,7 @@
             os.putArchiveEntry(entry);
             IOUtils.copy(new FileInputStream(file2), os);
             os.closeArchiveEntry();
-
+            os.finish();
             os.close();
             out.close();
         }

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStreamTest.java
Wed Apr 22 06:26:09 2009
@@ -41,6 +41,7 @@
             out.closeArchiveEntry();
             out.putArchiveEntry(new ZipArchiveEntry("bar/"));
             out.closeArchiveEntry();
+            out.finish();
             out.close();
             out = null;
 

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java?rev=767391&r1=767390&r2=767391&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
Wed Apr 22 06:26:09 2009
@@ -273,6 +273,8 @@
             zos.putArchiveEntry(ze);
             zos.write("ascii".getBytes("US-ASCII"));
             zos.closeArchiveEntry();
+            
+            zos.finish();
         } finally {
             if (zos != null) {
                 try {



Mime
View raw message