return authentication object instead of null if authentication is not
required - otherwise valid login fails with basic authentication
(cherry picked from commit 0176b6d902)
For reasons TBD, sometimes CI tests fail with (1.565.x):
java.lang.InterruptedException: null
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:503)
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:267)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:44)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:915)
at jenkins.model.Jenkins.<init>(Jenkins.java:814)
at hudson.model.Hudson.<init>(Hudson.java:82)
at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:539)
at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:331)
at org.jvnet.hudson.test.JenkinsRule$2.evaluate(JenkinsRule.java:479)
(cherry picked from commit 7bbf36b7f0)
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.
(cherry picked from commit 3ec7e562fe)
Conflicts:
test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
CONFIGURE permission shouldn't allow the type of the job to be changed.
That's more of CREATE+DELETE.
In any case, the code doesn't correctly handling submitting config.xml
for a different type.
Don't let UsernameNotFoundException vs BadCredentialsException
difference to be seen by the caller, for that tells whether the user
exists or not.
But to assist trouble-shooting, do report that error to the server. UUID
helps the user finds the information in the log file
java.lang.NullPointerException: null
at hudson.model.AbstractBuild.setWorkspace(AbstractBuild.java:296)
at hudson.model.ProjectTest.testCheckout(ProjectTest.java:423)