Commit 41fe5aa1 by ibaker Committed by Andrew Lewis

Throw IllegalStateException from Util.gzip() instead of AssertionError

The documentation on ByteArrayOutputStream and GZIPOutputStream isn't
completely clear that an IOException will *never* happen, so
AssertionError seems a bit strong - but it seems very unlikely, so we
just use IllegalStateException instead.

#minor-release

PiperOrigin-RevId: 387169297
parent 1aa76b5f
......@@ -2116,7 +2116,9 @@ public final class Util {
try (GZIPOutputStream os = new GZIPOutputStream(output)) {
os.write(input);
} catch (IOException e) {
throw new AssertionError(e);
// A ByteArrayOutputStream wrapped in a GZipOutputStream should never throw IOException since
// no I/O is happening.
throw new IllegalStateException(e);
}
return output.toByteArray();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment