diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-20 11:28:18 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-03-24 22:15:45 +0100 |
commit | b3a4ace695328945fcebb85be102733c97c498ac (patch) | |
tree | 5c92c76e86b5afa0eba153cca30d84ab02b499ec /org.eclipse.jgit | |
parent | 7960b4e09fb8807d897b5b913ab43b2c8e07219d (diff) | |
download | jgit-b3a4ace695328945fcebb85be102733c97c498ac.tar.gz jgit-b3a4ace695328945fcebb85be102733c97c498ac.zip |
CloneCommand: Suppress resource warning about Repository
Repository is not opened in try-with-resource because it is wrapped
in a Git instance which should be closed by the caller. On exeptions
during fetch, it is explicitly closed in the catch blocks.
Suppress the warning with an explanatory comment.
Change-Id: Ib32c74ce39bb810077ab84db33002bdde806f3b6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index f368e836ae..6084375e37 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -191,12 +191,12 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { throw new InvalidRemoteException( MessageFormat.format(JGitText.get().invalidURL, uri)); } - Repository repository = null; + @SuppressWarnings("resource") // Closed by caller + Repository repository = init(); FetchResult fetchResult = null; Thread cleanupHook = new Thread(() -> cleanup()); Runtime.getRuntime().addShutdownHook(cleanupHook); try { - repository = init(); fetchResult = fetch(repository, u); } catch (IOException ioe) { if (repository != null) { |