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>
This commit is contained in:
David Pursehouse 2018-03-14 10:56:18 +09:00
parent 3e1066d0a4
commit 7bd2a4a7c6
1 changed files with 2 additions and 0 deletions

View File

@ -702,6 +702,8 @@ void writeTo(File dir, final OutputStream os) throws IOException {
}
if (writeTree) {
@SuppressWarnings("resource") // Explicitly closed in try block, and
// destroyed in finally
TemporaryBuffer bb = new TemporaryBuffer.LocalFile(dir, 5 << 20);
try {
tree.write(tmp, bb);