GZipEncoding should throw IOException from close
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start at the GZipEncoding.encode method shown in the issue, focusing on the anonymous BufferedOutputStream.close override and its IOException handling. Confirm that an IOException from close is propagated rather than swallowed, then run the project's relevant tests and verify the failure is observable to callers.
Written by the indexing model from the issue text.
Description
The close method below swallows IOExceptions. That seems unnecessary and dangerous.
public class GZipEncoding implements HttpEncoding {
public String getName() {
return "gzip";
}
public void encode(StreamingContent content, OutputStream out) throws IOException {
// must not close the underlying output stream
OutputStream out2 =
new BufferedOutputStream(out) {
@Override
public void close() throws IOException {
// copy implementation of super.close(), except do not close the underlying output
// stream
try {
flush();
} catch (IOException ignored) {
// Nothing else we can do here
}
}
};
GZIPOutputStream zipper = new GZIPOutputStream(out2);
content.writeTo(zipper);
// cannot call just zipper.finish() because that would cause a severe memory leak
zipper.close();
}
}
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 473
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-http-java-client
-
GenericData.containsKey() returns true for unset (null) declared fields, violating Map contract Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
googleapis/google-http-java-client#2187 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Core: LowLevelHttpResponse not disconnected when HttpResponse construction throws RuntimeException Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
priority: p2 type: cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in googleapis/google-http-java-client
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100