drops all classpath entries that are not present at VM start time. PR: 2412 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269271 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -97,25 +97,20 @@ public abstract class Definer extends Task { | |||||
| } | } | ||||
| try { | try { | ||||
| ClassLoader loader = null; | ClassLoader loader = null; | ||||
| AntClassLoader al = null; | |||||
| if (classpath != null) { | if (classpath != null) { | ||||
| AntClassLoader al = new AntClassLoader(project, classpath, | |||||
| false); | |||||
| // 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. | |||||
| al.addSystemPackageRoot("org.apache.tools.ant"); | |||||
| loader = al; | |||||
| al = new AntClassLoader(project, classpath, false); | |||||
| } else { | } else { | ||||
| loader = this.getClass().getClassLoader(); | |||||
| al = new AntClassLoader(project, Path.systemClasspath, false); | |||||
| } | } | ||||
| // 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. | |||||
| al.addSystemPackageRoot("org.apache.tools.ant"); | |||||
| loader = al; | |||||
| Class c = null; | |||||
| if (loader != null) { | |||||
| c = loader.loadClass(value); | |||||
| AntClassLoader.initializeClass(c); | |||||
| } else { | |||||
| c = Class.forName(value); | |||||
| } | |||||
| Class c = loader.loadClass(value); | |||||
| AntClassLoader.initializeClass(c); | |||||
| addDefinition(name, c); | addDefinition(name, c); | ||||
| } catch (ClassNotFoundException cnfe) { | } catch (ClassNotFoundException cnfe) { | ||||
| String msg = getTaskName()+" class " + value + | String msg = getTaskName()+" class " + value + | ||||
| @@ -484,9 +484,14 @@ public class Path extends DataType implements Cloneable { | |||||
| Path result = new Path(project); | Path result = new Path(project); | ||||
| String order = project.getProperty("build.sysclasspath"); | |||||
| if (order == null) order=defValue; | |||||
| String order = defValue; | |||||
| if (project != null) { | |||||
| String o = project.getProperty("build.sysclasspath"); | |||||
| if (o != null) { | |||||
| order = o; | |||||
| } | |||||
| } | |||||
| if (order.equals("only")) { | if (order.equals("only")) { | ||||
| // only: the developer knows what (s)he is doing | // only: the developer knows what (s)he is doing | ||||
| result.addExisting(Path.systemClasspath); | result.addExisting(Path.systemClasspath); | ||||
| @@ -59,11 +59,11 @@ import java.util.zip.ZipException; | |||||
| /** | /** | ||||
| * General format of extra field data. | * General format of extra field data. | ||||
| * | * | ||||
| * <p>Extra fields usually apper twice per file, once in the local | |||||
| * <p>Extra fields usually appear twice per file, once in the local | |||||
| * file data and once in the central directory. Usually they are the | * file data and once in the central directory. Usually they are the | ||||
| * same, but they don't have to be. {@link | * same, but they don't have to be. {@link | ||||
| * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will | * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will | ||||
| * only use write the local file data at both places.</p> | |||||
| * only use the local file data in both places.</p> | |||||
| * | * | ||||
| * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| * @version $Revision$ | * @version $Revision$ | ||||