Browse Source

comments and indentation only

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1028815 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 14 years ago
parent
commit
b6422c58be
1 changed files with 46 additions and 44 deletions
  1. +46
    -44
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 46
- 44
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -1244,11 +1244,11 @@ public class Zip extends MatchingTask {
}

/*
* This is yet a hacky construct to extend the getResourcesToAdd
* method so we can pass the information whether non-fileset
* resources have been available to it without having to move the
* withEmpty behavior checks (since it would break subclasses in
* several ways otherwise).
* This is yet another hacky construct to extend the FileSet[]
* getResourcesToAdd method so we can pass the information whether
* non-fileset resources have been available to it without having
* to move the withEmpty behavior checks (since either would break
* subclasses in several ways).
*/
private static ThreadLocal haveNonFileSetResourcesToAdd = new ThreadLocal() {
protected Object initialValue() {
@@ -1286,49 +1286,51 @@ public class Zip extends MatchingTask {
Resource[][] initialResources = grabResources(filesets);
if (isEmpty(initialResources)) {
if (Boolean.FALSE.equals(haveNonFileSetResourcesToAdd.get())) {
if (needsUpdate && doUpdate) {
/*
* This is a rather hairy case.
*
* One of our subclasses knows that we need to update the
* archive, but at the same time, there are no resources
* known to us that would need to be added. Only the
* subclass seems to know what's going on.
*
* This happens if <jar> detects that the manifest has changed,
* for example. The manifest is not part of any resources
* because of our support for inline <manifest>s.
*
* If we invoke createEmptyZip like Ant 1.5.2 did,
* we'll loose all stuff that has been in the original
* archive (bugzilla report 17780).
*/
return new ArchiveState(true, initialResources);
}
if (needsUpdate && doUpdate) {
/*
* This is a rather hairy case.
*
* One of our subclasses knows that we need to
* update the archive, but at the same time, there
* are no resources known to us that would need to
* be added. Only the subclass seems to know
* what's going on.
*
* This happens if <jar> detects that the manifest
* has changed, for example. The manifest is not
* part of any resources because of our support
* for inline <manifest>s.
*
* If we invoke createEmptyZip like Ant 1.5.2 did,
* we'll loose all stuff that has been in the
* original archive (bugzilla report 17780).
*/
return new ArchiveState(true, initialResources);
}

if (emptyBehavior.equals("skip")) {
if (doUpdate) {
logWhenWriting(archiveType + " archive " + zipFile
+ " not updated because no new files were"
+ " included.", Project.MSG_VERBOSE);
if (emptyBehavior.equals("skip")) {
if (doUpdate) {
logWhenWriting(archiveType + " archive " + zipFile
+ " not updated because no new files were"
+ " included.", Project.MSG_VERBOSE);
} else {
logWhenWriting("Warning: skipping " + archiveType
+ " archive " + zipFile
+ " because no files were included.",
Project.MSG_WARN);
}
} else if (emptyBehavior.equals("fail")) {
throw new BuildException("Cannot create " + archiveType
+ " archive " + zipFile
+ ": no files were included.",
getLocation());
} else {
logWhenWriting("Warning: skipping " + archiveType
+ " archive " + zipFile
+ " because no files were included.",
Project.MSG_WARN);
}
} else if (emptyBehavior.equals("fail")) {
throw new BuildException("Cannot create " + archiveType
+ " archive " + zipFile
+ ": no files were included.",
getLocation());
} else {
// Create.
if (!zipFile.exists()) {
needsUpdate = true;
// Create.
if (!zipFile.exists()) {
needsUpdate = true;
}
}
}
}

// either we there are non-fileset resources or we
// (re-)create the archive anyway


Loading…
Cancel
Save