system classpath first. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269308 13f79535-47bb-0310-9956-ffa450edef68master
@@ -229,10 +229,6 @@ public class AntClassLoader extends ClassLoader { | |||||
public AntClassLoader(Project project, Path classpath) { | public AntClassLoader(Project project, Path classpath) { | ||||
this.project = project; | this.project = project; | ||||
this.classpath = classpath.concatSystemClasspath("ignore"); | this.classpath = classpath.concatSystemClasspath("ignore"); | ||||
// JDK > 1.1 should add these by default, but some VMs don't | |||||
addSystemPackageRoot("java"); | |||||
addSystemPackageRoot("javax"); | |||||
} | } | ||||
/** | /** | ||||
@@ -244,6 +240,8 @@ public class AntClassLoader extends ClassLoader { | |||||
public AntClassLoader(Project project, Path classpath, boolean systemFirst) { | public AntClassLoader(Project project, Path classpath, boolean systemFirst) { | ||||
this(project, classpath); | this(project, classpath); | ||||
this.systemFirst = systemFirst; | this.systemFirst = systemFirst; | ||||
addSystemPackageRoot("java"); | |||||
addSystemPackageRoot("javax"); | |||||
} | } | ||||
/** | /** | ||||
@@ -137,7 +137,7 @@ public class Available extends Task { | |||||
} | } | ||||
if (classpath != null) { | if (classpath != null) { | ||||
this.loader = new AntClassLoader(project, classpath, false); | |||||
this.loader = new AntClassLoader(project, classpath); | |||||
} | } | ||||
if ((classname != null) && !checkClass(classname)) { | if ((classname != null) && !checkClass(classname)) { | ||||
@@ -96,17 +96,12 @@ public abstract class Definer extends Task { | |||||
throw new BuildException(msg); | throw new BuildException(msg); | ||||
} | } | ||||
try { | try { | ||||
boolean systemFirst = false; | |||||
String bscp = project.getProperty("build.sysclasspath"); | |||||
if (bscp != null && bscp.equals("only")) { | |||||
systemFirst = true; | |||||
} | |||||
ClassLoader loader = null; | ClassLoader loader = null; | ||||
AntClassLoader al = null; | AntClassLoader al = null; | ||||
if (classpath != null) { | if (classpath != null) { | ||||
al = new AntClassLoader(project, classpath, systemFirst); | |||||
al = new AntClassLoader(project, classpath); | |||||
} else { | } else { | ||||
al = new AntClassLoader(project, Path.systemClasspath, systemFirst); | |||||
al = new AntClassLoader(project, Path.systemClasspath); | |||||
} | } | ||||
// need to load Task via system classloader or the new | // need to load Task via system classloader or the new | ||||
// task we want to define will never be a Task but always | // task we want to define will never be a Task but always | ||||
@@ -214,7 +214,7 @@ public class Property extends Task { | |||||
InputStream is = null; | InputStream is = null; | ||||
if (classpath != null) { | if (classpath != null) { | ||||
cL = new AntClassLoader(project, classpath, false); | |||||
cL = new AntClassLoader(project, classpath); | |||||
} else { | } else { | ||||
cL = this.getClass().getClassLoader(); | cL = this.getClass().getClassLoader(); | ||||
} | } | ||||
@@ -366,7 +366,7 @@ public class SQLExec extends Task { | |||||
log( "Loading " + driver + " using AntClassLoader with classpath " + classpath, | log( "Loading " + driver + " using AntClassLoader with classpath " + classpath, | ||||
Project.MSG_VERBOSE ); | Project.MSG_VERBOSE ); | ||||
loader = new AntClassLoader(project, classpath, false); | |||||
loader = new AntClassLoader(project, classpath); | |||||
dc = loader.loadClass(driver); | dc = loader.loadClass(driver); | ||||
} | } | ||||
else { | else { | ||||
@@ -262,8 +262,8 @@ public class XMLValidateTask extends Task { | |||||
//Class readerImpl = null; | //Class readerImpl = null; | ||||
//Class parserImpl = null; | //Class parserImpl = null; | ||||
if (classpath != null) { | if (classpath != null) { | ||||
AntClassLoader loader = new AntClassLoader(project, classpath, false); | |||||
loader.addSystemPackageRoot("org.xml"); // needed to avoid conflict | |||||
AntClassLoader loader = new AntClassLoader(project, classpath); | |||||
// loader.addSystemPackageRoot("org.xml"); // needed to avoid conflict | |||||
readerClass = loader.loadClass(readerClassName); | readerClass = loader.loadClass(readerClassName); | ||||
AntClassLoader.initializeClass(readerClass); | AntClassLoader.initializeClass(readerClass); | ||||
} else | } else | ||||