summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2015-11-20 13:53:53 +0000
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2015-11-26 15:08:17 +0900
commit4554d27f275a42583714be90abf14da398d088df (patch)
tree857744df081fa3c7f1e82e5e25a2493ad1b8a4f4
parentbedd4eaf845ce6a6f23eb6598771672978fd568c (diff)
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
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
index 73fbb3c24e..4c9c59d95d 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/plugins/HttpPluginServlet.java
@@ -648,11 +648,9 @@ class HttpPluginServlet extends HttpServlet
private static byte[] readWholeEntry(PluginContentScanner scanner, PluginEntry entry)
throws IOException {
- byte[] data = new byte[entry.getSize().get().intValue()];
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 {