From 67df4986cef270144c7cae3485dc8541ca180649 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 14 Mar 2018 09:39:48 +0900 Subject: [PATCH] UploadPack: Suppress resource warning about PackWriter PackWriter is auto-closeable and should be opened in try-with-resource, but this is not possible since the variable is being referenced in the finally block before being explicitly closed there. Suppress the warning and add an explanatory comment. Change-Id: I161923f35142132234fd951c0146d3cb30920b7b Signed-off-by: David Pursehouse --- org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 520d37ecab..86c6a148fa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1541,6 +1541,8 @@ public class UploadPack { PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); + @SuppressWarnings("resource") // PackWriter is referenced in the finally + // block, and is closed there final PackWriter pw = new PackWriter(cfg, walk.getObjectReader(), accumulator); try { -- 2.39.5