Skip to content

Commit

Permalink
Fixing an issue, when if you open a task with any defined Subversion …
Browse files Browse the repository at this point in the history
…configuration, opening a job settigns page will cause the connections opened by this action to hang indefinitely
  • Loading branch information
iandrey77888 committed Nov 13, 2024
1 parent c8837f9 commit a8f711c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/hudson/scm/SubversionSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -3256,10 +3256,11 @@ public FormValidation checkCredentialsId(/* TODO unused, delete */StaplerRequest
return FormValidation.warning("The repository URL is parameterized, connection check skipped");
}

SVNRepository repo = null;
try {
SVNURL repoURL = SVNURL.parseURIEncoded(remote);
StandardCredentials credentials = lookupCredentials(context, value, repoURL);
SVNRepository repo = descriptor().getRepository(context, repoURL, credentials, Collections.emptyMap(), null);
repo = descriptor().getRepository(context, repoURL, credentials, Collections.emptyMap(), null);
String repoRoot = repo.getRepositoryRoot(true).toDecodedString();
String repoPath = repo.getLocation().toDecodedString().substring(repoRoot.length());
SVNPath path = new SVNPath(repoPath, true, true);
Expand All @@ -3270,6 +3271,12 @@ public FormValidation checkCredentialsId(/* TODO unused, delete */StaplerRequest
} catch (SVNException e) {
LOGGER.log(Level.SEVERE, e.getErrorMessage().getMessage());
return FormValidation.error("Unable to access the repository");
} finally {
/* TODO: Quick and dirty fix (best to make SVNRepository implement AutoCloseable and remove this method as

Check warning on line 3275 in src/main/java/hudson/scm/SubversionSCM.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Quick and dirty fix (best to make SVNRepository implement AutoCloseable and remove this method as
jenkins.scm.impl.subversion.SubversionSCMSource.DescriptorImpl.doCheckCredentialsId seems to be doing the exact same thing
*/
if (repo != null)

Check warning on line 3278 in src/main/java/hudson/scm/SubversionSCM.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 3278 is only partially covered, one branch is missing
repo.closeSession();
}
return FormValidation.ok();
}
Expand Down

0 comments on commit a8f711c

Please sign in to comment.