Błąd SQLiteDatabase, niepomocny dziennik

Wydałem aktualizację mojej aplikacji i otrzymuję mnóstwo błędów od użytkowników i nie mogę jej odtworzyć ani wskazać problemu.

Dwa błędy, które otrzymuję:java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase

java.lang.IllegalStateException: database not open

Błąd występuje gdzieś w następującym kodzie:

public DBUserC getUser(int _id){
        synchronized (DBAdapter.LOCK){
            M.openDB(context);
            Cursor cursor = M.database.query(DBUserHelper.TABLE_USERS,
                    VUser.allColumns, DBUserHelper.COLUMN_ID + " = '"+_id+"'", null, null, null, null);
            DBUserC user;
            if (cursor.moveToFirst()){
                user = cursorToInfo(cursor);
            } else{
                user = newUser();
            }
            cursor.close();
            M.closeDB();
            return user;
        }
        }

W tej wersji jest aktualizacja bazy danych, w której wykonuję trzy zapytania za pośrednictwemdb.execSql. Nie ma osobnego wątku.

Przy każdym wywołaniu do bazy danych (z wyjątkiemonUpgrade), Synchronizuję, następnie otwieram, uruchamiam kod, a następnie zamykam. Do tej aktualizacji nie miałem żadnych problemów i nie mogę znaleźć problemu.

Każda pomoc byłaby bardzo mile widziana.

EDYTOWAĆ: Aby otworzyć moje bazy danych:

if (helper==null)
    helper = new DBAdapter(context);
if (database==null){
     database = helper.getWritableDatabase();
} else if (!database.isOpen())
     database = helper.getWritableDatabase();

i zamknąć:

helper.close();
helper = null;
database = null;

Przykładowa metoda uzyskiwania informacji:

    public DBUserC getUser(int _id){
        synchronized (DBAdapter.LOCK){
            openDB(context);//this is the open code above
            Cursor cursor = M.database.query(DBUserHelper.TABLE_USERS,
                    VUser.allColumns, DBUserHelper.COLUMN_ID + " = '"+_id+"'", null, null, null, null);
            DBUserC user;
            if (cursor.moveToFirst()){
                user = cursorToInfo(cursor);//does not contain DB operations
            } else{
                user = newUser(); ////does not contain Database operations
            }
            cursor.close();
            closeDB();//This is the close code above
            return user;
        }
    }

AHost.onCreate

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        M.initializeDB(context); //synchronized call to the openDB code I posted above
        M.openDataDB(context); //opens a different database by a different file name. This DB is not an issue

        //irrelevant ui setup
        int _id = pref.getInt(P.eLastUser, VUser.ID_NEW);//row id of user

        M.requeryUser();//synchronized, access database
        M.switchUser(_id);//synchronized, access database

    }

questionAnswers(3)

yourAnswerToTheQuestion