Bug 395851

Summary: NPE when authenticating at Hudson server via NTLM
Product: z_Archived Reporter: Christian Janz <christian.janz>
Component: MylynAssignee: Christian Janz <christian.janz>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: christian.janz, shawn.minto
Version: unspecifiedKeywords: contributed
Target Milestone: 3.8.3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Changing the value for "workstation" to empty string fixes the problem none

Description Christian Janz CLA 2012-12-05 14:19:20 EST
Created attachment 224328 [details]
Changing the value for "workstation" to empty string fixes the problem

While validating the connection to a Hudson server that is configured to authenticate via NTLM, a NPE is thrown.

Environment: Our Hudson/Jenkins server is located behind a reverse-proxy that enforces authentication via NTLM.

Steps to reproduce the problem:

1. "Add Build Server..." in Builds View
2. Choose "Hudson"
3. Fill in correct server URL and label
4. Leave "Anonymous" checked
5. In Section "HTTP authentication" check "Enable HTTP authentication"
5a. Fill in a username like 'mydomain\foo'
5b. Fill in password
6. Press "Validate"

Expected behavior: Validation succeeds

Actual Behavior: NullPointerException

java.lang.reflect.InvocationTargetException
	at org.eclipse.mylyn.commons.repositories.ui.RepositoryLocationPart$2.run(RepositoryLocationPart.java:563)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.NullPointerException
	at org.apache.http.impl.auth.NTLMEngineImpl.stripDotSuffix(NTLMEngineImpl.java:175)
	at org.apache.http.impl.auth.NTLMEngineImpl.convertHost(NTLMEngineImpl.java:183)
	at org.apache.http.impl.auth.NTLMEngineImpl.access$400(NTLMEngineImpl.java:45)
	at org.apache.http.impl.auth.NTLMEngineImpl$Type1Message.<init>(NTLMEngineImpl.java:764)
	at org.apache.http.impl.auth.NTLMEngineImpl.getType1Message(NTLMEngineImpl.java:128)
	at org.apache.http.impl.auth.NTLMEngineImpl.generateType1Msg(NTLMEngineImpl.java:1298)
	at org.apache.http.impl.auth.NTLMScheme.authenticate(NTLMScheme.java:125)
	at org.apache.http.impl.auth.AuthSchemeBase.authenticate(AuthSchemeBase.java:124)
	at org.apache.http.client.protocol.RequestTargetAuthentication.process(RequestTargetAuthentication.java:105)
	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:108)
	at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:174)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:462)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
	at org.eclipse.mylyn.commons.repositories.http.core.HttpUtil$1.execute(HttpUtil.java:178)
	at org.eclipse.mylyn.commons.repositories.http.core.HttpUtil$1.execute(HttpUtil.java:1)
	at org.eclipse.mylyn.commons.core.operations.MonitoredOperation.call(MonitoredOperation.java:82)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

The attached patch fixes the problem for me.
Comment 1 Steffen Pingel CLA 2012-12-06 14:02:21 EST
Thanks a lot for the patch! Would you be able to push that as a Gerrit review (see http://wiki.eclipse.org/Mylyn/Contributor_Reference#Reviews)?

Shawn, I think we discussed null vs. empty string at the time. Are you okay with the proposed change?
Comment 2 Christian Janz CLA 2012-12-08 15:19:46 EST
Hi Steffen,

thank you for the feedback.
I pushed the patch as a review to gerrit: https://git.eclipse.org/r/#/c/9123/
Comment 3 Steffen Pingel CLA 2012-12-10 04:52:57 EST
The fix was merged into master and the 3.8.x branch. Thanks for the contribution!