Program: 25669
Project: 25669
Buggy source:
private SQLiteDatabase getDatabase(){
synchronized (this) {
    if (mDatabase != null && !mDatabase.isOpen()) {
      mDatabase=null;
      Util.log(null,Log.ERROR,"String_Node_Str");
    }
    if (mDatabase == null)     try {
      File dbFile=getDbFile();
      SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(dbFile,null);
      if (db.isDatabaseIntegrityOk())       Util.log(null,Log.WARN,"String_Node_Str");
 else {
        Util.log(null,Log.ERROR,"String_Node_Str");
        Cursor cursor=db.rawQuery("String_Node_Str",null);
        try {
          while (cursor.moveToNext()) {
            String message=cursor.getString(0);
            Util.log(null,Log.ERROR,message);
          }
        }
  finally {
          cursor.close();
        }
        db.close();
        File dbBackup=new File(dbFile.getParentFile() + File.separator + "String_Node_Str");
        dbBackup.delete();
        dbFile.renameTo(dbBackup);
        File dbJournal=new File(dbFile.getAbsolutePath() + "String_Node_Str");
        File dbJournalBackup=new File(dbBackup.getAbsolutePath() + "String_Node_Str");
        dbJournalBackup.delete();
        dbJournal.renameTo(dbJournalBackup);
        Util.log(null,Log.ERROR,"String_Node_Str" + dbBackup.getAbsolutePath());
        db=SQLiteDatabase.openOrCreateDatabase(dbFile,null);
        Util.log(null,Log.ERROR,"String_Node_Str");
      }
      if (db.getVersion() > 1) {
        Util.log(null,Log.WARN,"String_Node_Str");
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          ContentValues values=new ContentValues();
          values.put("String_Node_Str",0);
          values.put("String_Node_Str",PrivacyManager.cSettingMigrated);
          values.put("String_Node_Str",Boolean.toString(true));
          db.insertWithOnConflict(cTableSetting,null,values,SQLiteDatabase.CONFLICT_REPLACE);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(1)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          Util.log(null,Log.WARN,"String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.setVersion(1);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(2))       db.setVersion(2);
      if (db.needUpgrade(3)) {
        mLock.writeLock().unlock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(3);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(4)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(4);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(5)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.setVersion(5);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(6)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(6);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      Util.log(null,Log.WARN,"String_Node_Str" + db.getVersion());
      mDatabase=db;
    }
 catch (    Throwable ex) {
      mDatabase=null;
      Util.bug(null,ex);
    }
    return mDatabase;
  }
}

Fixed version (ground truth):
private SQLiteDatabase getDatabase(){
synchronized (this) {
    if (mDatabase != null && !mDatabase.isOpen()) {
      mDatabase=null;
      Util.log(null,Log.ERROR,"String_Node_Str");
    }
    if (mDatabase == null)     try {
      File dbFile=getDbFile();
      SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(dbFile,null);
      if (db.isDatabaseIntegrityOk())       Util.log(null,Log.WARN,"String_Node_Str");
 else {
        Util.log(null,Log.ERROR,"String_Node_Str");
        Cursor cursor=db.rawQuery("String_Node_Str",null);
        try {
          while (cursor.moveToNext()) {
            String message=cursor.getString(0);
            Util.log(null,Log.ERROR,message);
          }
        }
  finally {
          cursor.close();
        }
        db.close();
        File dbBackup=new File(dbFile.getParentFile() + File.separator + "String_Node_Str");
        dbBackup.delete();
        dbFile.renameTo(dbBackup);
        File dbJournal=new File(dbFile.getAbsolutePath() + "String_Node_Str");
        File dbJournalBackup=new File(dbBackup.getAbsolutePath() + "String_Node_Str");
        dbJournalBackup.delete();
        dbJournal.renameTo(dbJournalBackup);
        Util.log(null,Log.ERROR,"String_Node_Str" + dbBackup.getAbsolutePath());
        db=SQLiteDatabase.openOrCreateDatabase(dbFile,null);
        Util.log(null,Log.ERROR,"String_Node_Str");
      }
      if (db.getVersion() > 1) {
        Util.log(null,Log.WARN,"String_Node_Str");
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          ContentValues values=new ContentValues();
          values.put("String_Node_Str",0);
          values.put("String_Node_Str",PrivacyManager.cSettingMigrated);
          values.put("String_Node_Str",Boolean.toString(true));
          db.insertWithOnConflict(cTableSetting,null,values,SQLiteDatabase.CONFLICT_REPLACE);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(1)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          Util.log(null,Log.WARN,"String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.setVersion(1);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(2))       db.setVersion(2);
      if (db.needUpgrade(3)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(3);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(4)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(4);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(5)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.execSQL("String_Node_Str");
          db.setVersion(5);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      if (db.needUpgrade(6)) {
        mLock.writeLock().lock();
        db.beginTransaction();
        try {
          db.execSQL("String_Node_Str");
          db.setVersion(6);
          db.setTransactionSuccessful();
        }
  finally {
          try {
            db.endTransaction();
          }
  finally {
            mLock.writeLock().unlock();
          }
        }
      }
      Util.log(null,Log.WARN,"String_Node_Str" + db.getVersion());
      mDatabase=db;
    }
 catch (    Throwable ex) {
      mDatabase=null;
      Util.bug(null,ex);
    }
    return mDatabase;
  }
}