This is to fix http://code.google.com/p/google-http-java-client/issues/detail?id=61 The deflator created by new GZIPOutputStream(out) needs to be end() ...
12 years, 3 months ago
(2012-01-25 15:26:18 UTC)
#1
This is to fix
http://code.google.com/p/google-http-java-client/issues/detail?id=61
The deflator created by new GZIPOutputStream(out) needs to be end() otherwise
there is a resource leak.
I added Javadoc explaining why this is done. Also, since this class is package
private I think this is a non-breaking change.
LGTM This is fine, but we also need to solve the more general problem. We ...
12 years, 3 months ago
(2012-01-26 20:44:48 UTC)
#3
LGTM
This is fine, but we also need to solve the more general problem. We need to
make a pass at all of the callers of the writeTo method to make sure they are
manually closing the output stream, e.g. AbstractHttpContent.computeLength().
We should also make a pass at the implementations of writeTo and try to change
them to not close the output stream, e.g. JacksonFactory.writeTo.
http://codereview.appspot.com/5572060/diff/3/google-http-client/src/main/java...
File
google-http-client/src/main/java/com/google/api/client/http/HttpContent.java
(right):
http://codereview.appspot.com/5572060/diff/3/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpContent.java:48:
* should assume that this method does not close the output stream unless
otherwise specified.
2nd sentence doesn't make sense in general because a lot of times you don't know
what implementation you have because you just get an interface. So a safer
assumption is that the callers should not assume whether or not the output
stream has been closed.
I did a pass of the callers and the implementers and fixed them. I left ...
12 years, 3 months ago
(2012-01-26 22:21:36 UTC)
#4
I did a pass of the callers and the implementers and fixed them. I left tests
alone. Some though were not obvious-
ContentEntity.writeTo and NetHttpRequest.execute().
Please take another look.
http://codereview.appspot.com/5572060/diff/3/google-http-client/src/main/java...
File
google-http-client/src/main/java/com/google/api/client/http/HttpContent.java
(right):
http://codereview.appspot.com/5572060/diff/3/google-http-client/src/main/java...
google-http-client/src/main/java/com/google/api/client/http/HttpContent.java:48:
* should assume that this method does not close the output stream unless
otherwise specified.
On 2012/01/26 20:44:48, yanivi wrote:
> 2nd sentence doesn't make sense in general because a lot of times you don't
know
> what implementation you have because you just get an interface. So a safer
> assumption is that the callers should not assume whether or not the output
> stream has been closed.
Done.
Issue 5572060: Fixing resource leak in GZipContent.writeTo
(Closed)
Created 12 years, 3 months ago by rmistry
Modified 12 years, 3 months ago
Reviewers: yanivi
Base URL: https://google-http-java-client.googlecode.com/hg/
Comments: 2