Browse Source

Don't delete existing file when trying to update a read-only archive, PR: 28419

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276327 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
b561447312
2 changed files with 12 additions and 1 deletions
  1. +4
    -1
      WHATSNEW
  2. +8
    -0
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 4
- 1
WHATSNEW View File

@@ -114,7 +114,10 @@ Fixed bugs:
behaved identically. behaved identically.


* <xslt> now sets the context classloader if you've specified a nested * <xslt> now sets the context classloader if you've specified a nested
<classpath>. Bugzilla report 24802.
<classpath>. Bugzilla Report 24802.

* <zip> and friends would delete the original file when trying to update
a read-only archive. Bugzilla Report 28419.


Other changes: Other changes:
-------------- --------------


+ 8
- 0
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -338,6 +338,14 @@ public class Zip extends MatchingTask {
+ archiveType + " file to create!"); + archiveType + " file to create!");
} }


if (zipFile.exists() && !zipFile.isFile()) {
throw new BuildException(zipFile + " is not a file.");
}

if (zipFile.exists() && !zipFile.canWrite()) {
throw new BuildException(zipFile + " is read-only.");
}

// Renamed version of original file, if it exists // Renamed version of original file, if it exists
File renamedFile = null; File renamedFile = null;
// Whether or not an actual update is required - // Whether or not an actual update is required -


Loading…
Cancel
Save