From bf7c94af20275e4a66bc656e3fe7ba6fa7dc07ee Mon Sep 17 00:00:00 2001 From: twogee Date: Wed, 6 Nov 2019 22:35:49 +0100 Subject: [PATCH] antlib: is a magic name --- src/main/org/apache/tools/ant/ComponentHelper.java | 2 +- src/main/org/apache/tools/ant/ProjectHelper.java | 4 ++-- src/main/org/apache/tools/ant/taskdefs/Definer.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java index 23211b412..5d8c3db67 100644 --- a/src/main/org/apache/tools/ant/ComponentHelper.java +++ b/src/main/org/apache/tools/ant/ComponentHelper.java @@ -824,7 +824,7 @@ public class ComponentHelper { if (uri.isEmpty()) { uri = ProjectHelper.ANT_CORE_URI; } - if (!uri.startsWith(ProjectHelper.ANTLIB_URI)) { + if (!uri.startsWith(MagicNames.ANTLIB_PREFIX)) { return; // namespace that does not contain antlib } if (checkedNamespaces.contains(uri)) { diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index db71d9ae2..a84038a88 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -38,7 +38,7 @@ import org.xml.sax.AttributeList; */ public class ProjectHelper { /** The URI for ant name space */ - public static final String ANT_CORE_URI = "antlib:org.apache.tools.ant"; + public static final String ANT_CORE_URI = MagicNames.ANTLIB_PREFIX + "org.apache.tools.ant"; /** The URI for antlib current definitions */ public static final String ANT_CURRENT_URI = "ant:current"; @@ -49,7 +49,7 @@ public class ProjectHelper { public static final String ANT_ATTRIBUTE_URI = "ant:attribute"; /** The URI for defined types/tasks - the format is antlib:<package> */ - public static final String ANTLIB_URI = "antlib:"; + public static final String ANTLIB_URI = MagicNames.ANTLIB_PREFIX; /** Polymorphic attribute */ public static final String ANT_TYPE = "ant-type"; diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index 33b585a98..09df1c991 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -463,12 +463,12 @@ public abstract class Definer extends DefBase { if (definerSet) { tooManyDefinitions(); } - if (!antlib.startsWith("antlib:")) { + if (!antlib.startsWith(MagicNames.ANTLIB_PREFIX)) { throw new BuildException( "Invalid antlib attribute - it must start with antlib:"); } setURI(antlib); - this.resource = antlib.substring("antlib:".length()).replace('.', '/') + this.resource = antlib.substring(MagicNames.ANTLIB_PREFIX.length()).replace('.', '/') + "/antlib.xml"; definerSet = true; }