Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StrictMode complains about InputStream not closed when using Gzip encoding #38

Open
mr-thierry opened this issue Aug 22, 2012 · 0 comments

Comments

@mr-thierry
Copy link

If I enable gzip encoding as follow with StrictMode enabled:

ignitedHttp.setGzipEncodingEnabled(true);

I see errors in LogCat:

08-21 16:09:14.158: E/StrictMode(2083): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
08-21 16:09:14.158: E/StrictMode(2083): java.lang.Throwable: Explicit termination method 'end' not called
08-21 16:09:14.158: E/StrictMode(2083): at dalvik.system.CloseGuard.open(CloseGuard.java:184)
08-21 16:09:14.158: E/StrictMode(2083): at java.util.zip.Inflater.(Inflater.java:82)
08-21 16:09:14.158: E/StrictMode(2083): at java.util.zip.GZIPInputStream.(GZIPInputStream.java:96)
08-21 16:09:14.158: E/StrictMode(2083): at java.util.zip.GZIPInputStream.(GZIPInputStream.java:81)
08-21 16:09:14.158: E/StrictMode(2083): at com.github.ignition.support.http.gzip.GzipInflatingEntity.getContent(GzipInflatingEntity.java:21)
08-21 16:09:14.158: E/StrictMode(2083): at org.apache.http.conn.BasicManagedEntity.getContent(BasicManagedEntity.java:100)
08-21 16:09:14.158: E/StrictMode(2083): at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:64)
08-21 16:09:14.158: E/StrictMode(2083): at org.apache.http.entity.BufferedHttpEntity.(BufferedHttpEntity.java:62)
08-21 16:09:14.158: E/StrictMode(2083): at com.github.ignition.support.http.IgnitedHttpResponseImpl.(IgnitedHttpResponseImpl.java:35)
08-21 16:09:14.158: E/StrictMode(2083): at com.github.ignition.support.http.IgnitedHttpRequestBase.handleResponse(IgnitedHttpRequestBase.java:81)
08-21 16:09:14.158: E/StrictMode(2083): at com.github.ignition.support.http.IgnitedHttpRequestBase.handleResponse(IgnitedHttpRequestBase.java:1)
08-21 16:09:14.158: E/StrictMode(2083): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
08-21 16:09:14.158: E/StrictMode(2083): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:627)
08-21 16:09:14.158: E/StrictMode(2083): at com.github.ignition.support.http.IgnitedHttpRequestBase.send(IgnitedHttpRequestBase.java:118)

Somehow the input stream wrapped into a GZIPInputStream is never closed. I tried looking into the IgnitedHttp code and everything looks fine to me. So it's probably an issue with the Apache implementation and StrictMode.

Any thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant