From 0d66fda8afb68be5649679aaa11c71c57b4ac25c Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 22 Aug 2005 16:51:16 +0000 Subject: [PATCH] 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 --- .../org/apache/tools/ant/ComponentHelper.java | 2 +- .../apache/tools/ant/taskdefs/Definer.java | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java index 64ab30abc..6ecd7e161 100644 --- a/src/main/org/apache/tools/ant/ComponentHelper.java +++ b/src/main/org/apache/tools/ant/ComponentHelper.java @@ -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(); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index 6fc42fc1b..02ca5b014 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -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;