Author: bodewig
Date: Sun Apr 13 08:56:31 2014
New Revision: 1586941

URL: http://svn.apache.org/r1586941
Log:
COMPRESS-274 unnanmed entries cause trouble for ChangeSet#delete*

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

Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1586941&r1=1586940&r2=1586941&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sun Apr 13 08:56:31 
2014
@@ -67,6 +67,10 @@ The <action> type attribute can be add,u
         ArjArchiveInputStream#canReadEntryData tested the current
         entry of the stream rather than its argument.
       </action>
+      <action type="fix" date="2014-04-13" issue="COMPRESS-274">
+        ChangeSet#delete and deleteDir now properly deal with unnamed
+        entries.
+      </action>
     </release>
     <release version="1.8" date="2014-03-12"
              description="Release 1.8">

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=1586941&r1=1586940&r2=1586941&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
 Sun Apr 13 08:56:31 2014
@@ -133,13 +133,17 @@ public final class ChangeSet {
         }
         String source = pChange.targetFile();
 
-        if (!changes.isEmpty()) {
+        if (source != null && !changes.isEmpty()) {
             for (Iterator<Change> it = changes.iterator(); it.hasNext();) {
                 Change change = it.next();
                 if (change.type() == Change.TYPE_ADD
                         && change.getEntry() != null) {
                     String target = change.getEntry().getName();
 
+                    if (target == null) {
+                        continue;
+                    }
+
                     if (Change.TYPE_DELETE == pChange.type() && 
source.equals(target)) {
                         it.remove();
                     } else if (Change.TYPE_DELETE_DIR == pChange.type() && 


Reply via email to