提交 88857a6f 编写于 作者: K kohsuke

avoid "2nd instance" test failures. The stack trace was:

java.lang.NullPointerException
	at com.gargoylesoftware.htmlunit.html.HtmlPage.loadFrames(HtmlPage.java:1732)
	at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:153)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:455)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:340)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:390)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:377)
	at org.jvnet.hudson.test.HudsonTestCase$WebClient.getPage(HudsonTestCase.java:1002)
	at org.jvnet.hudson.test.HudsonTestCase.tearDown(HudsonTestCase.java:257)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21328 71c3de6d-444a-0410-be80-ed276b4c234a
上级 b0c76f7b
......@@ -249,6 +249,7 @@ public abstract class HudsonTestCase extends TestCase {
}
protected void tearDown() throws Exception {
try {
// cancel pending asynchronous operations, although this doesn't really seem to be working
for (WeakReference<WebClient> client : clients) {
WebClient c = client.get();
......@@ -257,7 +258,7 @@ public abstract class HudsonTestCase extends TestCase {
c.getPage("about:blank");
}
clients.clear();
} finally {
server.stop();
for (LenientRunnable r : tearDowns)
r.run();
......@@ -273,6 +274,7 @@ public abstract class HudsonTestCase extends TestCase {
// see http://bugs.sun.com/view_bug.do?bug_id=4950148
System.gc();
}
}
protected void runTest() throws Throwable {
System.out.println("=== Starting "+ getClass().getSimpleName() + "." + getName());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册