I found that for some case (GZIPInputStream throw IOException), there is a leak - Inflater member of GZIPInputStream which is constructed in first statement is not released correctly via function "end()". In this case, GZIPInputStream is not constructed, so calling function cannot close it. Is GZIPInputStream really wrong?
public GZIPInputStream(InputStream is, int size) throws IOException {
super(is, new Inflater(true), size);
byte[] header = new byte[10];
readFully(header, 0, header.length);
int magic = getShort(header, 0);
if (magic != GZIP_MAGIC) {
throw new IOException(String.format("unknown format (magic number %x)", magic));
}
......
}