You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/10/29 17:56:44 UTC
svn commit: r1028815 -
/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
Author: bodewig
Date: Fri Oct 29 15:56:44 2010
New Revision: 1028815
URL: http://svn.apache.org/viewvc?rev=1028815&view=rev
Log:
comments and indentation only
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=1028815&r1=1028814&r2=1028815&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Fri Oct 29 15:56:44 2010
@@ -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 (emptyBehavior.equals("skip")) {
- if (doUpdate) {
- logWhenWriting(archiveType + " archive " + zipFile
- + " not updated because no new files were"
- + " included.", Project.MSG_VERBOSE);
+ 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);
+ } 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