提交 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,29 +249,31 @@ public abstract class HudsonTestCase extends TestCase {
}
protected void tearDown() throws Exception {
// cancel pending asynchronous operations, although this doesn't really seem to be working
for (WeakReference<WebClient> client : clients) {
WebClient c = client.get();
if(c==null) continue;
// unload the page to cancel asynchronous operations
c.getPage("about:blank");
try {
// cancel pending asynchronous operations, although this doesn't really seem to be working
for (WeakReference<WebClient> client : clients) {
WebClient c = client.get();
if(c==null) continue;
// unload the page to cancel asynchronous operations
c.getPage("about:blank");
}
clients.clear();
} finally {
server.stop();
for (LenientRunnable r : tearDowns)
r.run();
hudson.cleanUp();
env.dispose();
ExtensionList.clearLegacyInstances();
DescriptorExtensionList.clearLegacyInstances();
// Hudson creates ClassLoaders for plugins that hold on to file descriptors of its jar files,
// but because there's no explicit dispose method on ClassLoader, they won't get GC-ed until
// at some later point, leading to possible file descriptor overflow. So encourage GC now.
// see http://bugs.sun.com/view_bug.do?bug_id=4950148
System.gc();
}
clients.clear();
server.stop();
for (LenientRunnable r : tearDowns)
r.run();
hudson.cleanUp();
env.dispose();
ExtensionList.clearLegacyInstances();
DescriptorExtensionList.clearLegacyInstances();
// Hudson creates ClassLoaders for plugins that hold on to file descriptors of its jar files,
// but because there's no explicit dispose method on ClassLoader, they won't get GC-ed until
// at some later point, leading to possible file descriptor overflow. So encourage GC now.
// see http://bugs.sun.com/view_bug.do?bug_id=4950148
System.gc();
}
protected void runTest() throws Throwable {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册