HttpPluginServlet: Fix "short read of block" IO error on plugin docs
When accessing plugins static resources from the Jar, treat the JarEntry size as a "hint" to the expected uncompressed size, rather than the exact size. Treating as "exact value" can result in an IO error whilst reading the resource: java.io.EOFException: Short read of block Change-Id: I6b488e58bb34620483d9ed7524ac3c23ce44071a
This commit is contained in:
parent
bedd4eaf84
commit
4554d27f27
@ -648,11 +648,9 @@ class HttpPluginServlet extends HttpServlet
|
|||||||
|
|
||||||
private static byte[] readWholeEntry(PluginContentScanner scanner, PluginEntry entry)
|
private static byte[] readWholeEntry(PluginContentScanner scanner, PluginEntry entry)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
byte[] data = new byte[entry.getSize().get().intValue()];
|
|
||||||
try (InputStream in = scanner.getInputStream(entry)) {
|
try (InputStream in = scanner.getInputStream(entry)) {
|
||||||
IO.readFully(in, data, 0, data.length);
|
return IO.readWholeStream(in, entry.getSize().get().intValue()).array();
|
||||||
}
|
}
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PluginHolder {
|
private static class PluginHolder {
|
||||||
|
Loading…
Reference in New Issue
Block a user