summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2010-02-18 15:27:03 -0800
committerVasu Nori <vnori@google.com>2010-02-18 16:40:42 -0800
commitd3fe30134edbe17094a5b9ef21aa6662de451001 (patch)
treee8637f1bcc96c0d8706fbafd8517301efc47d038 /core
parentbe8af08cf4cf9384b3fa13c853c40d761211ceed (diff)
downloadframeworks_base-d3fe30134edbe17094a5b9ef21aa6662de451001.zip
frameworks_base-d3fe30134edbe17094a5b9ef21aa6662de451001.tar.gz
frameworks_base-d3fe30134edbe17094a5b9ef21aa6662de451001.tar.bz2
add diagnostic info to help debug bug:2427686
Diffstat (limited to 'core')
-rw-r--r--core/java/android/database/sqlite/SQLiteClosable.java26
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();
+ }
}