HttpPluginServlet: Use try-with-resource in readWholeEntry
This was already done on master/stable-2.12 in change I94f481a33 which updated several places to use try-with-resource. Backporting this specific one so it's easier to apply Luca's fix for "short read of block" without conflict. Change-Id: I1ec84f15b09b860c3f416a5000ad4e950a2a3977
This commit is contained in:
parent
82a48b54d8
commit
bedd4eaf84
@ -649,11 +649,8 @@ class HttpPluginServlet extends HttpServlet
|
||||
private static byte[] readWholeEntry(PluginContentScanner scanner, PluginEntry entry)
|
||||
throws IOException {
|
||||
byte[] data = new byte[entry.getSize().get().intValue()];
|
||||
InputStream in = scanner.getInputStream(entry);
|
||||
try {
|
||||
try (InputStream in = scanner.getInputStream(entry)) {
|
||||
IO.readFully(in, data, 0, data.length);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user