Browse Source

use the StrictMode enumerated class rather than a string for the setStrict method

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@558067 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
0e11c9965d
1 changed files with 16 additions and 9 deletions
  1. +16
    -9
      src/main/org/apache/tools/ant/taskdefs/Jar.java

+ 16
- 9
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -148,7 +148,8 @@ public class Jar extends Zip {
* Strict mode for checking rules of the JAR-Specification.
* @see http://java.sun.com/j2se/1.3/docs/guide/versioning/spec/VersioningSpecification.html#PackageVersioning
*/
private StrictMode strict;
private StrictMode strict = new StrictMode("ignore");

// CheckStyle:LineLength ON

/**
@@ -167,7 +168,6 @@ public class Jar extends Zip {
emptyBehavior = "create";
setEncoding("UTF8");
rootEntries = new Vector();
strict = new StrictMode("ignore");
}

/**
@@ -198,9 +198,10 @@ public class Jar extends Zip {
* Activate the strict mode. When set to <i>true</i> a BuildException
* will be thrown if the Jar-Packaging specification was broken.
* @param strict New value of the strict mode.
* @since Ant 1.7.1
*/
public void setStrict(String strict) {
this.strict = new StrictMode(strict);
public void setStrict(StrictMode strict) {
this.strict = strict;
}

/**
@@ -1031,14 +1032,22 @@ public class Jar extends Zip {
}
}

// CheckStyle:JavadocType OFF - simple enum
public class StrictMode extends EnumeratedAttribute {
// CheckStyle:JavadocMethod OFF - simple enum
/** The strict enumerated type. */
public static class StrictMode extends EnumeratedAttribute {
/** Public no arg constructor. */
public StrictMode() {
}
/**
* Constructor with an arg.
* @param value the enumerated value as a string.
*/
public StrictMode(String value) {
setValue(value);
}
/**
* Get List of valid strings.
* @return the list of values.
*/
public String[] getValues() {
return new String[]{"fail", "warn", "ignore"};
}
@@ -1048,7 +1057,5 @@ public class Jar extends Zip {
public int getLogLevel() {
return (getValue().equals("ignore")) ? Project.MSG_VERBOSE : Project.MSG_WARN;
}
// CheckStyle:JavadocMethod ON
}
// CheckStyle:JavadocType ON
}

Loading…
Cancel
Save