peterreilly 2004/08/23 06:32:22 Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH DefBase.java Log: Sync with head ... forgot this for 1.6.2 Revision Changes Path No revision No revision 1.6.2.5 +20 -13 ant/src/main/org/apache/tools/ant/taskdefs/DefBase.java Index: DefBase.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/DefBase.java,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -u -r1.6.2.4 -r1.6.2.5 --- DefBase.java 9 Mar 2004 17:01:33 -0000 1.6.2.4 +++ DefBase.java 23 Aug 2004 13:32:22 -0000 1.6.2.5 @@ -42,7 +42,7 @@ * @ant.attribute ignore="true" */ public void setReverseLoader(boolean reverseLoader) { - this.cpDelegate.setReverseLoader(reverseLoader); + getDelegate().setReverseLoader(reverseLoader); log("The reverseloader attribute is DEPRECATED. It will be removed", Project.MSG_WARN); } @@ -51,14 +51,14 @@ * @return the classpath for this definition */ public Path getClasspath() { - return cpDelegate.getClasspath(); + return getDelegate().getClasspath(); } /** * @return the reverse loader attribute of the classpath delegate. */ public boolean isReverseLoader() { - return cpDelegate.isReverseLoader(); + return getDelegate().isReverseLoader(); } /** @@ -66,7 +66,7 @@ * @return the loader id */ public String getLoaderId() { - return cpDelegate.getClassLoadId(); + return getDelegate().getClassLoadId(); } /** @@ -74,7 +74,7 @@ * @return the class path id */ public String getClasspathId() { - return cpDelegate.getClassLoadId(); + return getDelegate().getClassLoadId(); } /** @@ -83,7 +83,7 @@ * @param classpath an Ant Path object containing the classpath. */ public void setClasspath(Path classpath) { - this.cpDelegate.setClasspath(classpath); + getDelegate().setClasspath(classpath); } /** @@ -92,7 +92,7 @@ * @return the classpath of the this definition */ public Path createClasspath() { - return this.cpDelegate.createClasspath(); + return getDelegate().createClasspath(); } /** @@ -101,7 +101,7 @@ * @param r the reference to the classpath */ public void setClasspathRef(Reference r) { - this.cpDelegate.setClasspathref(r); + getDelegate().setClasspathref(r); } /** @@ -117,7 +117,7 @@ * @since Ant 1.5 */ public void setLoaderRef(Reference r) { - this.cpDelegate.setLoaderRef(r); + getDelegate().setLoaderRef(r); } /** @@ -125,11 +125,14 @@ * @return the classloader from the cpDelegate */ protected ClassLoader createLoader() { - if (getAntlibClassLoader() != null) { + if (getAntlibClassLoader() != null && cpDelegate == null) { return getAntlibClassLoader(); } + if (cpDelegate == null) { + cpDelegate = ClasspathUtils.getDelegate(this); + } if (createdLoader == null) { - createdLoader = this.cpDelegate.getClassLoader(); + createdLoader = cpDelegate.getClassLoader(); // need to load Task via system classloader or the new // task we want to define will never be a Task but always // be wrapped into a TaskAdapter. @@ -144,9 +147,13 @@ * @since Ant 1.6 */ public void init() throws BuildException { - this.cpDelegate = ClasspathUtils.getDelegate(this); super.init(); } - + private ClasspathUtils.Delegate getDelegate() { + if (cpDelegate == null) { + cpDelegate = ClasspathUtils.getDelegate(this); + } + return cpDelegate; + } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]