diff options
author | Vasu Nori <vnori@google.com> | 2010-02-18 16:43:14 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-02-18 16:43:14 -0800 |
commit | da99efcc5ec838bb9e03349b04a06e3259985428 (patch) | |
tree | 444c24ebeb7c9d47304d06eb03d04c352e0a6e54 /core | |
parent | 75288fa1a4ee4886959af7243995d8afd9c3c905 (diff) | |
parent | d3fe30134edbe17094a5b9ef21aa6662de451001 (diff) | |
download | frameworks_base-da99efcc5ec838bb9e03349b04a06e3259985428.zip frameworks_base-da99efcc5ec838bb9e03349b04a06e3259985428.tar.gz frameworks_base-da99efcc5ec838bb9e03349b04a06e3259985428.tar.bz2 |
Merge "add diagnostic info to help debug bug:2427686"
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/database/sqlite/SQLiteClosable.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/core/java/android/database/sqlite/SQLiteClosable.java b/core/java/android/database/sqlite/SQLiteClosable.java index 7776520..e589f34 100644 --- a/core/java/android/database/sqlite/SQLiteClosable.java +++ b/core/java/android/database/sqlite/SQLiteClosable.java @@ -16,6 +16,8 @@ package android.database.sqlite; +import android.database.CursorWindow; + /** * An object create from a SQLiteDatabase that can be closed. */ @@ -29,9 +31,9 @@ public abstract class SQLiteClosable { synchronized(mLock) { if (mReferenceCount <= 0) { throw new IllegalStateException( - "attempt to acquire a reference on an already-closed SQLiteClosable obj."); + "attempt to acquire a reference on an already-closed " + getObjInfo()); } - mReferenceCount++; + mReferenceCount++; } } @@ -52,4 +54,24 @@ public abstract class SQLiteClosable { } } } + + private String getObjInfo() { + StringBuilder buff = new StringBuilder(); + buff.append(this.getClass().getName()); + buff.append(" Obj"); + buff.append(" ("); + if (this instanceof SQLiteDatabase) { + buff.append("database = "); + buff.append(((SQLiteDatabase)this).getPath()); + } else if (this instanceof SQLiteProgram || this instanceof SQLiteStatement || + this instanceof SQLiteQuery) { + buff.append("mSql = "); + buff.append(((SQLiteProgram)this).mSql); + } else if (this instanceof CursorWindow) { + buff.append("mStartPos = "); + buff.append(((CursorWindow)this).getStartPosition()); + } + buff.append(") "); + return buff.toString(); + } } |