Erik Newton, Thorsten Schöning, I'm sorry but I could not to reproduce the NPE.
-
A fresh Jenkins 1.643 installation
-
Update (manually) Subversion Plugin to 2.5.5
-
Create a job with a subversion repository:
-
Update (using update center) Subversion Plugin 2.5.6
-
Edit the same job:
-
Create a new job with a subversion repository:
I don't you can reach this error in the UI when the validate method:
/**
* Validate the value for a remote (repository) location.
*/
public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath Item context,
@QueryParameter String remote, @QueryParameter String value) {
// Test the connection only if we have job configure permission
if (context == null || !context.hasPermission(Item.CONFIGURE)) {
return FormValidation.ok();
}
return checkCredentialsId(req, context, remote, value);
}
/**
* Validate the value for a remote (repository) location.
*/
public FormValidation checkCredentialsId(StaplerRequest req, @Nonnull Item context, String remote, String value) {
// Ignore validation if repository URL is empty
String url = Util.fixEmptyAndTrim(remote);
if (url == null) {
return FormValidation.ok();
}
// Is the repository URL parameterized?
if (remote.indexOf('$') != -1) {
return FormValidation.warning("The repository URL is parameterized, connection check skipped");
}
try {
SVNURL repoURL = SVNURL.parseURIEncoded(remote);
StandardCredentials credentials = lookupCredentials(context, value, repoURL);
SVNRepository repo = descriptor().getRepository(context, repoURL, credentials, Collections
.<String, Credentials>emptyMap(), null);
String repoRoot = repo.getRepositoryRoot(false).toDecodedString();
String repoPath = repo.getLocation().toDecodedString().substring(repoRoot.length());
SVNPath path = new SVNPath(repoPath, true, true);
SVNNodeKind svnNodeKind = repo.checkPath(path.getTarget(), path.getPegRevision().getNumber());
if (svnNodeKind != SVNNodeKind.DIR) {
return FormValidation.error("Credentials looks fine but the repository URL is invalid");
}
} catch (SVNException e) {
LOGGER.log(Level.SEVERE, e.getErrorMessage().getMessage());
return FormValidation.error("Unable to access to repository");
}
return FormValidation.ok();
does not use FormValidation.errorWithMarkup()
Maybe, a step by step process would be useful to catch this NPE.
|