Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: The connection to a SVN repository will not be closed by the plugin #325

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
} 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
Loading