From 814e95b745cc4f5b90795d03ad07eef0e67b83b6 Mon Sep 17 00:00:00 2001 From: twogee Date: Wed, 6 Nov 2019 22:41:59 +0100 Subject: [PATCH] More magic names --- src/main/org/apache/tools/ant/MagicNames.java | 2 +- src/main/org/apache/tools/ant/taskdefs/Definer.java | 2 +- src/tests/junit/org/apache/tools/ant/ExecutorTest.java | 2 +- .../apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/MagicNames.java b/src/main/org/apache/tools/ant/MagicNames.java index e90d4edaf..6e7fc702c 100644 --- a/src/main/org/apache/tools/ant/MagicNames.java +++ b/src/main/org/apache/tools/ant/MagicNames.java @@ -218,7 +218,7 @@ public final class MagicNames { * Value: {@value} */ public static final String PROJECT_HELPER_SERVICE = - "META-INF/services/org.apache.tools.ant.ProjectHelper"; + "META-INF/services/" + PROJECT_HELPER_CLASS; /** * Name of ProjectHelper reference that we add to a project. diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index 09df1c991..adfde30d1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -465,7 +465,7 @@ public abstract class Definer extends DefBase { } if (!antlib.startsWith(MagicNames.ANTLIB_PREFIX)) { throw new BuildException( - "Invalid antlib attribute - it must start with antlib:"); + "Invalid antlib attribute - it must start with " + MagicNames.ANTLIB_PREFIX); } setURI(antlib); this.resource = antlib.substring(MagicNames.ANTLIB_PREFIX.length()).replace('.', '/') diff --git a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java index 923d86b02..e96f209f0 100644 --- a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java +++ b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java @@ -92,7 +92,7 @@ public class ExecutorTest implements BuildListener { private Project getProject(String e, boolean f, boolean k) { Project p = buildRule.getProject(); - p.setNewProperty("ant.executor.class", e); + p.setNewProperty(MagicNames.ANT_EXECUTOR_CLASSNAME, e); p.setKeepGoingMode(k); if (f) { p.setNewProperty("failfoo", "foo"); diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java index 6ecf4c3fb..0c561a4b3 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java @@ -37,6 +37,7 @@ import java.util.Properties; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildFileRule; +import org.apache.tools.ant.MagicNames; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; import org.junit.After; import org.junit.Before; @@ -182,7 +183,7 @@ public class EchoPropertiesTest { buildRule.executeTarget("testWithRegex"); // the following line has been changed from checking ant.home to ant.version // so the test will still work when run outside of an Ant script - assertThat(buildRule.getFullLog(), containsString("ant.version=")); + assertThat(buildRule.getFullLog(), containsString(MagicNames.ANT_VERSION + "=")); } private void testEchoPrefixVarious(String target) throws Exception {