History log of /libcore/dalvik/src/main/java/dalvik/system/CloseGuard.java
Revision Date Author Comments
8155888a2c4e7cc28596deec28433e1984cfaf11 25-Jul-2012 Brian Carlstrom <bdc@google.com> Fix HttpURLConnection CloseGuard warning due to lack of close on GZIPInputStream

java.lang.Throwable: Explicit termination method 'end' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at java.util.zip.Inflater.<init>(Inflater.java:82)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:96)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
at libcore.net.http.HttpEngine.initContentStream(HttpEngine.java:523)
at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:831)
at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
at ...

Bug: 6602529
Change-Id: I9b49cbca561f8780d08844e566820087fdffc4d7
a7ef55258ac71153487357b861c7639d627df82f 22-Feb-2011 Elliott Hughes <enh@google.com> Simplify internal libcore logging.

Expose LOGE and friends for use from Java. This is handy because it lets me use
printf debugging even when I've broken String or CharsetEncoder or something
equally critical. It also lets us remove internal use of java.util.logging,
which is slow and ugly.

I've also changed Thread.suspend/resume/stop to actually throw
UnsupportedOperationException rather than just logging one and otherwise
doing nothing.

Bug: 3477960
Change-Id: I0c3f804b1a978bf9911cb4a9bfd90b2466f8798f
1292ca6a89af2492f9c1f52f7d4a555c75462482 19-Nov-2010 Brian Carlstrom <bdc@google.com> minor CloseGuard javadoc corrections

Change-Id: I6892d1f03821032d40b2ea678b9406f464878755
4bfc26e99c8044a1d690003d4bb3d75348124f57 14-Nov-2010 Brad Fitzpatrick <bradfitz@android.com> CloseGuard: make members volatile, update comment

Change-Id: Id348a2d523fb92631a07684050b03311a6ea2eef
f7ee236589ca1fe73615c4dc8a536ffe29a236ff 08-Nov-2010 Brian Carlstrom <bdc@google.com> Fix javadoc typo

Change-Id: I5e24358c62e00f199c71b9825b1b533b34510f74
b81e1d9da6a4b039ffa55618fcccb013d3116261 08-Nov-2010 Brian Carlstrom <bdc@google.com> Add CloseGuard.Reporter interface to allow customization of warnings

This will be paired with a new implementation in StrictMode to allow
more sophisticated reporting.

Change-Id: I17668b5db333c4c9b7280ac0de5dc8d9ba1aab59
b3f32d4d15177a0d2c064a8116d5cf5d07a217a9 04-Nov-2010 Brian Carlstrom <bdc@google.com> Adding CloseGuard.setEnabled for StrictMode integration

Bug: 3041575
Change-Id: Ifa8f548c217210014c2aaff044fb4871629f47a7
2353846b64570fa5932028143a0af507d41a85c5 25-Oct-2010 Jesse Wilson <jessewilson@google.com> Close process-spawned streams when the process is destroyed.

This is consistent with the RI's behavior. I can't come up with
a reasonable approach to closing these streams if they are never
requested; that's presumably a finalizer problem anyway because
only the finalizer knows that the streams won't be needed.

This change also adds test infrastructure around CloseGuard.
My approach hooks into the logger rather than reflection because
I can't be sure where the CloseGuard instance would be in the
object hierarchy. This approach also degrades reasonably when
run on the reference implementation (where it passes).

Change-Id: I08e882494d69d4245e40fb1035edbc6d3df23fbc
http://b/3111120
12f2d8e2760b78c673b7a187b9062b3938a03147 12-Oct-2010 Brian Carlstrom <bdc@google.com> Revised CloseGuard usage pattern

- CloseGuard.get() instants are now "unopened"
- In constructor cases, guard.open("...") is now at the end
- In metod cases, guard.open("...") is now after resource acquisition
- guard null pointer checks in finalizers in case constructor threw exception

Bug: 2645458
Change-Id: Ieb874a8c33b347768a9fa7437b3dd16f3d56d886
f7aab022dcbfcd8f27b409ab92b4bca4a84d0b8a 30-Sep-2010 Brian Carlstrom <bdc@google.com> CloseGuard: finalizers for closeable objects should log complaints

Introducing CloseGuard which warns when resources are implictly
cleaned up by finalizers when an explicit termination method, to use
the Effective Java "Issue 7: Avoid finalizers" terminology, should
have been used by the caller.

libcore classes that can use CloseGuard now do so.

Bug: 3041575
Change-Id: I4a4e3554addaf3075c823feb0a0ff0ad1c1f6196