]> source.dussan.org Git - jgit.git/commitdiff
UploadPack: Suppress resource warning about PackWriter 75/119375/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 14 Mar 2018 00:39:48 +0000 (09:39 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Wed, 14 Mar 2018 01:44:23 +0000 (10:44 +0900)
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 <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

index 520d37ecab20fa3c7958b6e9e053cdd3279ef161..86c6a148faefd325aad656a74ac1c6df419e36e9 100644 (file)
@@ -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 {