Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bb028da authored by Vasu Nori's avatar Vasu Nori Committed by Android (Google) Code Review
Browse files

Merge "in finalizer warnings, use a better exception - NOT Exception()"

parents f6bd0ba6 08b448ea
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.database.sqlite;

/**
 * An exception that indicates that garbage-collector is finalizing a database object
 * that is not explicitly closed
 */
public class DatabaseObjectNotClosedException extends RuntimeException
{
    private static final String s = "Application did not close the cursor or database object " +
            "that was opened here";

    public DatabaseObjectNotClosedException()
    {
        super(s);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ import android.util.Log;
    /* package */ SQLiteCompiledSql(SQLiteDatabase db, String sql) {
        mDatabase = db;
        mSqlStmt = sql;
        mStackTrace = new Exception().fillInStackTrace();
        mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
        this.nHandle = db.mNativeHandle;
        compile(sql, true);
    }
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public class SQLiteCursor extends AbstractWindowedCursor {
            String editTable, SQLiteQuery query) {
        // The AbstractCursor constructor needs to do some setup.
        super();
        mStackTrace = new Exception().fillInStackTrace();
        mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
        mDatabase = db;
        mDriver = driver;
        mEditTable = editTable;
+1 −1
Original line number Diff line number Diff line
@@ -1749,7 +1749,7 @@ public class SQLiteDatabase extends SQLiteClosable {
        mFlags = flags;
        mPath = path;
        mSlowQueryThreshold = SystemProperties.getInt(LOG_SLOW_QUERIES_PROPERTY, -1);
        mStackTrace = new Exception().fillInStackTrace();
        mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
        mFactory = factory;
        dbopen(mPath, mFlags);
        if (SQLiteDebug.DEBUG_SQL_CACHE) {