Browse Source

revert 38747: resource isolation, should fix one of gumps issues - look at other later

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@450614 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
da045acc91
2 changed files with 6 additions and 15 deletions
  1. +5
    -14
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +1
    -1
      src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java

+ 5
- 14
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -32,7 +32,6 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -201,7 +200,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @see #setIsolated(boolean)
*/
private boolean isolated = false;
private boolean ignoreBase = false;

/**
* The parent class loader, if one is given or can be determined.
@@ -567,7 +566,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* isolated mode.
*/
public synchronized void setIsolated(boolean isolated) {
this.isolated = isolated;
ignoreBase = isolated;
}

/**
@@ -849,6 +848,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
// designated to use a specific loader first
// (this one or the parent one)

// XXX - shouldn't this always return false in isolated mode?

boolean useParentFirst = parentFirst;

for (Enumeration e = systemPackages.elements(); e.hasMoreElements();) {
@@ -952,8 +953,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
if (isParentFirst(name)) {
// Normal case.
return CollectionUtils.append(base, mine);
} else if (isolated) {
return mine;
} else {
// Inverted.
return CollectionUtils.append(mine, base);
@@ -1059,7 +1058,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
log("Class " + classname + " loaded from ant loader",
Project.MSG_DEBUG);
} catch (ClassNotFoundException cnfe) {
if (isolated) {
if (ignoreBase) {
throw cnfe;
}
theClass = findBaseClass(classname);
@@ -1522,12 +1521,4 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
return "AntClassLoader[" + getClasspath() + "]";
}

/**
* Accessor for derived classloaders to access the path components.
* @return the pathcomponents.
*/
protected List getPathComponents() {
return pathComponents;
}

}

+ 1
- 1
src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java View File

@@ -78,7 +78,7 @@ public class AntClassLoaderDelegationTest extends TestCase {
enum2List(acl.getResources(TEST_RESOURCE)));
}

public void testFindIsolateResources() throws Exception {
public void NottestFindIsolateResources() throws Exception {
String buildTestcases = System.getProperty("build.tests");
assertNotNull("defined ${build.tests}", buildTestcases);
assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory());


Loading…
Cancel
Save