提交 101a96ea 编写于 作者: M mchung

6961506: TEST_BUG: ResourceBundle/Bug4168625Test.java and TestBug4179766.java fails in samevm mode

Summary: Set the proper parent class loader of Loader and SimpleLoader
Reviewed-by: naoto
上级 52093748
......@@ -1233,10 +1233,6 @@ java/util/logging/LoggingMXBeanTest2.java generic-all
java/util/logging/LoggingNIOChange.java generic-all
java/util/logging/ParentLoggersTest.java generic-all
# Need to be marked othervm, or changed to be samevm safe
java/util/ResourceBundle/Bug4168625Test.java generic-all
java/util/ResourceBundle/TestBug4179766.java generic-all
# Need to be marked othervm, or changed to be samevm safe
java/util/WeakHashMap/GCDuringIteration.java generic-all
......
......@@ -431,9 +431,11 @@ public class Bug4168625Test extends RBTestFmwk {
private boolean network = false;
public SimpleLoader() {
super(SimpleLoader.class.getClassLoader());
this.network = false;
}
public SimpleLoader(boolean simulateNetworkLoad) {
super(SimpleLoader.class.getClassLoader());
this.network = simulateNetworkLoad;
}
public Class loadClass(final String className, final boolean resolveIt)
......@@ -448,7 +450,7 @@ public class Bug4168625Test extends RBTestFmwk {
} catch (java.lang.InterruptedException e) {
}
}
result = super.findSystemClass(className);
result = getParent().loadClass(className);
if ((result != null) && resolveIt) {
resolveClass(result);
}
......@@ -464,11 +466,13 @@ public class Bug4168625Test extends RBTestFmwk {
private String[] classesToWaitFor;
public Loader() {
super(Loader.class.getClassLoader());
classesToLoad = new String[0];
classesToWaitFor = new String[0];
}
public Loader(final String[] classesToLoadIn, final String[] classesToWaitForIn) {
super(Loader.class.getClassLoader());
classesToLoad = classesToLoadIn;
classesToWaitFor = classesToWaitForIn;
}
......@@ -544,10 +548,12 @@ public class Bug4168625Test extends RBTestFmwk {
}
/**
* Delegate loading to the system loader
* Delegate loading to its parent class loader that loads the test classes.
* In othervm mode, the parent class loader is the system class loader;
* in samevm mode, the parent class loader is the jtreg URLClassLoader.
*/
private Class loadFromSystem(String className) throws ClassNotFoundException {
return super.findSystemClass(className);
return getParent().loadClass(className);
}
public void logClasses(String title) {
......
......@@ -209,6 +209,7 @@ public class TestBug4179766 extends RBTestFmwk {
* Create a new loader
*/
public Loader(boolean sameHash) {
super(Loader.class.getClassLoader());
if (sameHash) {
thisHashCode = SAME_HASH_CODE;
} else {
......@@ -287,7 +288,7 @@ public class TestBug4179766 extends RBTestFmwk {
*/
private Class loadFromSystem(String className) throws ClassNotFoundException {
try {
Class result = super.findSystemClass(className);
Class result = getParent().loadClass(className);
printInfo(" ***Returning system class: "+className, result);
return result;
} catch (ClassNotFoundException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册