Trying to diagnose recent CI failures of HtmlUnit calls.

For example https://jenkins.ci.cloudbees.com/job/core/job/jenkins-core-validated-merge/38/testReport/lib.layout/LayoutTest/rejectedLinks/ failed with:
java.io.IOException: GET http://localhost:52099/jenkins/login failed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:152)
	at java.net.SocketInputStream.read(SocketInputStream.java:122)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
	at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
	at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
	at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
	at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
	at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:101)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1456)
	at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1387)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:328)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:389)
	at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
	at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:1944)
	at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:1926)
	at lib.layout.LayoutTest.rejectedLinks(LayoutTest.java:44)
which makes little sense since the named IOException is actually thrown from HttpWebConnection.java:130.
Perhaps Surefire is not reporting the original cause correctly, conflating the wrapper’s message with the original stack trace.
As a temporary measure, printing the original stack trace to stderr if there is any.
This commit is contained in:
Jesse Glick committed 2014-02-23 16:57:05 -05:00
1 parent 0d77f1795c
commit 3ec7e562fe
2 files changed
+18 -2

No files matched your search

@@ -1815,7 +1815,15 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
}
public Page goTo(String relative, String expectedContentType) throws IOException, SAXException {
Page p = super.getPage(getContextPath() + relative);
Page p;
try {
p = super.getPage(getContextPath() + relative);
} catch (IOException x) {
if (x.getCause() != null) {
x.getCause().printStackTrace();
}
throw x;
}
assertEquals(expectedContentType,p.getWebResponse().getContentType());
return p;
}
@@ -1941,7 +1941,15 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
*/
public Page goTo(String relative, @CheckForNull String expectedContentType) throws IOException, SAXException {
assert !relative.startsWith("/");
Page p = super.getPage(getContextPath() + relative);
Page p;
try {
p = super.getPage(getContextPath() + relative);
} catch (IOException x) {
if (x.getCause() != null) {
x.getCause().printStackTrace();
}
throw x;
}
if (expectedContentType != null) {
assertThat(p.getWebResponse().getContentType(), is(expectedContentType));
}