Browse Source

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 <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
67df4986ce
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

2
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 {

Loading…
Cancel
Save