mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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
This commit is contained in:
parent
1aa76b5fdc
commit
41fe5aa1e3
1 changed files with 3 additions and 1 deletions
|
|
@ -2116,7 +2116,9 @@ public final class Util {
|
||||||
try (GZIPOutputStream os = new GZIPOutputStream(output)) {
|
try (GZIPOutputStream os = new GZIPOutputStream(output)) {
|
||||||
os.write(input);
|
os.write(input);
|
||||||
} catch (IOException e) {
|
} 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();
|
return output.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue