Browse Source

DirCache: Suppress resource warning related to TemporaryBuffer

In #writeTo, the TemporaryBuffer can't be opened in try-with-resource
because it's referenced in the finally block. Instead it is explicitly
closed within the try block. Suppress the warning with an explanatory
comment.

Change-Id: I02009f77f9630d5d55afc34eb86d304ff103b8b0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
7bd2a4a7c6
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java

2
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -702,6 +702,8 @@ public class DirCache {
} }
if (writeTree) { if (writeTree) {
@SuppressWarnings("resource") // Explicitly closed in try block, and
// destroyed in finally
TemporaryBuffer bb = new TemporaryBuffer.LocalFile(dir, 5 << 20); TemporaryBuffer bb = new TemporaryBuffer.LocalFile(dir, 5 << 20);
try { try {
tree.write(tmp, bb); tree.write(tmp, bb);

Loading…
Cancel
Save