You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/04/15 15:33:49 UTC
svn commit: r765188 -
/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
Author: sebb
Date: Wed Apr 15 13:33:48 2009
New Revision: 765188
URL: http://svn.apache.org/viewvc?rev=765188&view=rev
Log:
Fix bug: deleteDir should not delete file with matching name
Don't exit loop if name does not match
Use startsWith() rather than match() as it's simpler and quicker
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
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=765188&r1=765187&r2=765188&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 15 13:33:48 2009
@@ -89,8 +89,7 @@
break;
}
} else if(type == Change.TYPE_DELETE_DIR && name != null) {
- if (name.matches(
- change.targetFile() + "/.*")) {
+ if (name.startsWith(change.targetFile() + "/")) {
copy = false;
break;
}
@@ -121,14 +120,13 @@
for (Iterator it = workingSet.iterator(); it.hasNext();) {
Change change = (Change) it.next();
final int type = change.type();
- if (type == Change.TYPE_DELETE || type == Change.TYPE_DELETE_DIR) {
- String target = change.targetFile();
-
- if (source.equals(target)) {
- return true;
- }
+ String target = change.targetFile();
+ if (type == Change.TYPE_DELETE && source.equals(target)) {
+ return true;
+ }
- return (type == Change.TYPE_DELETE_DIR) && source.matches(target + "/.*");
+ if (type == Change.TYPE_DELETE_DIR && source.startsWith(target + "/")){
+ return true;
}
}
}