diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java
index 43d0c6892..df0e34dad 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Zip.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java
@@ -122,6 +122,13 @@ public class Zip extends MatchingTask {
}
+ /** Possible behaviors when there are no matching files for the task. */
+ public static class WhenEmpty extends EnumeratedAttribute {
+ public String[] getValues() {
+ return new String[] {"fail", "skip", "create"};
+ }
+ }
+
/**
* Sets behavior of the task when no files match.
* Possible values are: fail
(throw an exception
@@ -131,12 +138,8 @@ public class Zip extends MatchingTask {
* Default for zip tasks is skip
;
* for jar tasks, create
.
*/
- public void setWhenempty(String we) throws BuildException {
- we = we.toLowerCase();
- // XXX could instead be using EnumeratedAttribute, but this works
- if (!"fail".equals(we) && !"skip".equals(we) && !"create".equals(we))
- throw new BuildException("Unrecognized whenempty attribute: " + we);
- emptyBehavior = we;
+ public void setWhenempty(WhenEmpty we) {
+ emptyBehavior = we.getValue();
}
public void execute() throws BuildException {