Issue Type: Bug Bug
Affects Versions: current
Assignee: Unassigned
Components: subversion
Created: 21/Jul/14 6:13 PM
Description:

Hi. This code:

DescriptorExtensionList<SCM, SCMDescriptor<?>> desc = SubversionSCM.all();
DescriptorImpl ss = (DescriptorImpl) desc.get(DescriptorImpl.class);
StringWriter log = new StringWriter();
PrintWriter logWriter = new PrintWriter(log);
UserProvidedCredential upc =
new UserProvidedCredential(user, password, null,
request.findAncestorObject(AbstractProject.class));

ss.postCredential(url[0], upc, logWriter);

causes:

Caused by: java.lang.NullPointerException
at hudson.scm.SubversionSCM$DescriptorImpl$1.onSuccess(SubversionSCM.java:2249)
at hudson.scm.UserProvidedCredential$AuthenticationManagerImpl.acknowledgeAuthentication(UserProvidedCredential.java:233)
at org.tmatesoft.svn.core.auth.BasicAuthenticationManager.acknowledgeAuthentication(BasicAuthenticationManager.java:56)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection._request(HTTPConnection.java:749)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:382)

In:

public void postCredential(String url, final UserProvidedCredential upc, PrintWriter logWriter) throws SVNException, IOException {
SVNRepository repository = null;

try {
// the way it works with SVNKit is that
// 1) svnkit calls AuthenticationManager asking for a credential.
// this is when we can see the 'realm', which identifies the user domain.
// 2) DefaultSVNAuthenticationManager returns the username and password we set below
// 3) if the authentication is successful, svnkit calls back acknowledgeAuthentication
// (so we store the password info here)
repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
repository.setTunnelProvider( createDefaultSVNOptions() );
AuthenticationManagerImpl authManager = upc.new AuthenticationManagerImpl(logWriter) {
@Override
protected void onSuccess(String realm, Credential cred) { LOGGER.info("Persisted "+cred+" for "+realm); credentials.put(realm, cred); save(); if (upc.inContextOf!=null) new PerJobCredentialStore(upc.inContextOf).acknowledgeAuthentication(realm,cred); }
};
authManager.setAuthenticationForced(true);
repository.setAuthenticationManager(authManager);
repository.testConnection();
authManager.checkIfProtocolCompleted();
} finally { if (repository != null) repository.closeSession(); }
}

Because:
credentials is null in "credentials.put(realm, cred);" statement.

version 1.54 works fine

Environment: Jenkins 1.572 and lower
Project: Jenkins
Priority: Major Major
Reporter: dmatag
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to