commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r762792 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
Date Tue, 07 Apr 2009 14:31:33 GMT
Author: bodewig
Date: Tue Apr  7 14:31:33 2009
New Revision: 762792

URL: http://svn.apache.org/viewvc?rev=762792&view=rev
Log:
Make ChangeSet work for empty initial archives

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java?rev=762792&r1=762791&r2=762792&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
Tue Apr  7 14:31:33 2009
@@ -53,6 +53,15 @@
 
     public void perform(ArchiveInputStream in, ArchiveOutputStream out)
             throws IOException {
+        for (Iterator it = changes.iterator(); it.hasNext();) {
+            Change change = (Change) it.next();
+
+            if (change.type() == Change.TYPE_ADD) {
+                copyStream(change.getInput(), out, change.getEntry());
+                it.remove();
+            }
+        }
+
         ArchiveEntry entry = null;
         while ((entry = in.getNextEntry()) != null) {
             boolean copy = true;
@@ -60,11 +69,6 @@
             for (Iterator it = changes.iterator(); it.hasNext();) {
                 Change change = (Change) it.next();
 
-                if (change.type() == Change.TYPE_ADD) {
-                    copyStream(change.getInput(), out, change.getEntry());
-                    it.remove();
-                }
-
                 if (change.type() == Change.TYPE_DELETE
                         && entry.getName() != null) {
                     if (entry.getName().equals(change.targetFile())) {



Mime
View raw message