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>
This commit is contained in:
parent
7960b4e09f
commit
b3a4ace695
|
@ -191,12 +191,12 @@ public Git call() throws GitAPIException, InvalidRemoteException,
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue