Browse Source

move to constants to define policy strings; change so that ignore loads print out something at -v level. Why so? to debug antlib namespace declarations.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278532 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
0d66fda8af
2 changed files with 26 additions and 4 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/ComponentHelper.java
  2. +25
    -3
      src/main/org/apache/tools/ant/taskdefs/Definer.java

+ 1
- 1
src/main/org/apache/tools/ant/ComponentHelper.java View File

@@ -781,7 +781,7 @@ public class ComponentHelper {
uri.substring(ANTLIB_PREFIX.length()).replace('.', '/')
+ "/antlib.xml");
// a fishing expedition :- ignore errors if antlib not present
definer.setOnError(new Typedef.OnError("ignore"));
definer.setOnError(new Typedef.OnError(Typedef.OnError.POLICY_IGNORE));
definer.init();
definer.execute();
}


+ 25
- 3
src/main/org/apache/tools/ant/taskdefs/Definer.java View File

@@ -41,6 +41,7 @@ import org.apache.tools.ant.types.EnumeratedAttribute;
* handling is handled by DefBase
*
* @since Ant 1.4
* @noinspection ParameterHidesMemberVariable
*/
public abstract class Definer extends DefBase {
private static class ResourceStack extends ThreadLocal {
@@ -74,6 +75,24 @@ public abstract class Definer extends DefBase {
public static class OnError extends EnumeratedAttribute {
/** Enumerated values */
public static final int FAIL = 0, REPORT = 1, IGNORE = 2, FAIL_ALL = 3;

/**
* text value of onerror option {@value}
*/
public static final String POLICY_FAIL = "fail";
/**
* text value of onerror option {@value}
*/
public static final String POLICY_REPORT = "report";
/**
* text value of onerror option {@value}
*/
public static final String POLICY_IGNORE = "ignore";
/**
* text value of onerror option {@value}
*/
public static final String POLICY_FAILALL = "failall";

/**
* Constructor
*/
@@ -94,7 +113,7 @@ public abstract class Definer extends DefBase {
* @return an array of the allowed values for this attribute.
*/
public String[] getValues() {
return new String[] {"fail", "report", "ignore", "failall"};
return new String[] {POLICY_FAIL, POLICY_REPORT, POLICY_IGNORE, POLICY_FAILALL};
}
}

@@ -270,7 +289,9 @@ public abstract class Definer extends DefBase {
log(message, Project.MSG_WARN);
break;
case OnError.IGNORE:
// Fall Through
// log at a lower level
log(message, Project.MSG_VERBOSE);
break;
default:
// Ignore the problem
break;
@@ -298,7 +319,8 @@ public abstract class Definer extends DefBase {
log(message, Project.MSG_WARN);
break;
case OnError.IGNORE:
// Fall Through
log(message, Project.MSG_VERBOSE);
break;
default:
// Ignore the problem
break;


Loading…
Cancel
Save