bodewig 01/03/09 01:06:59
Modified: src/main/org/apache/tools/ant/taskdefs Zip.java
Log:
Make the whenempty attribute of zip use an EnumeratedAttribute - alows
the DTD to be stricter.
Submitted by: Jesse Glick <[EMAIL PROTECTED]>
Revision Changes Path
1.34 +9 -6
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- Zip.java 2001/03/08 13:42:06 1.33
+++ Zip.java 2001/03/09 09:06:58 1.34
@@ -122,6 +122,13 @@
}
+ /** 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: <code>fail</code> (throw an exception
@@ -131,12 +138,8 @@
* Default for zip tasks is <code>skip</code>;
* for jar tasks, <code>create</code>.
*/
- 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 {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]