Program: 32001
Project: 32001
Buggy source:
/** 
 * Open the store.
 */
@Override public void open(){
  super.open();
  final long fLoadTimeT0=System.currentTimeMillis();
synchronized (this) {
    if (!mIsReady && !mIsOpening && (null != mMetadata)&& (null != mHandlerThread)) {
      mIsOpening=true;
      Log.e(LOG_TAG,"String_Node_Str");
      if (null == mFileStoreHandler) {
        try {
          mHandlerThread.start();
        }
 catch (        IllegalThreadStateException e) {
          Log.e(LOG_TAG,"String_Node_Str");
          return;
        }
        mFileStoreHandler=new MXOsHandler(mHandlerThread.getLooper());
      }
      Runnable r=new Runnable(){
        @Override public void run(){
          mFileStoreHandler.post(new Runnable(){
            public void run(){
              Log.e(LOG_TAG,"String_Node_Str");
              String errorDescription=null;
              boolean succeed=true;
              if (!succeed) {
                errorDescription="String_Node_Str";
                Log.e(LOG_TAG,errorDescription);
              }
              if (succeed) {
                succeed&=loadRoomsMessages();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                }
              }
              if (succeed) {
                succeed&=loadRoomsState();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                  long t0=System.currentTimeMillis();
                  Log.e(LOG_TAG,"String_Node_Str");
                  Collection<Room> rooms=getRooms();
                  for (                  Room room : rooms) {
                    Collection<RoomMember> members=room.getLiveState().getMembers();
                    for (                    RoomMember member : members) {
                      updateUserWithRoomMemberEvent(member);
                    }
                  }
                  long delta=System.currentTimeMillis() - t0;
                  Log.e(LOG_TAG,"String_Node_Str" + mUsers.size() + "String_Node_Str"+ delta+ "String_Node_Str");
                  mStoreStats.put("String_Node_Str",delta);
                }
              }
              if (succeed) {
                succeed&=loadSummaries();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                  succeed=mRooms.keySet().containsAll(mRoomSummaries.keySet());
                  if (!succeed) {
                    Log.e(LOG_TAG,"String_Node_Str");
                  }
                }
              }
              if (succeed) {
                succeed&=loadRoomsAccountData();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                }
              }
              if (!succeed) {
                Log.e(LOG_TAG,"String_Node_Str");
                MXFileStoreMetaData tmpMetadata=mMetadata;
                deleteAllData(true);
                mRoomsToCommitForMessages=new ArrayList<>();
                mRoomsToCommitForStates=new ArrayList<>();
                mRoomsToCommitForSummaries=new ArrayList<>();
                mRoomsToCommitForReceipts=new ArrayList<>();
                mMetadata=tmpMetadata;
                if (null == mMetadata) {
                  mMetadata=new MXFileStoreMetaData();
                  mMetadata.mUserId=mCredentials.userId;
                  mMetadata.mAccessToken=mCredentials.accessToken;
                  mMetadata.mVersion=MXFILE_VERSION;
                  mMetaDataHasChanged=true;
                }
 else {
                  mMetadata.mEventStreamToken=null;
                }
                mEventStreamToken=null;
              }
 else {
                Log.d(LOG_TAG,"String_Node_Str");
                Set<String> roomIds=mRoomEvents.keySet();
                for (                String roomId : roomIds) {
                  Room room=getRoom(roomId);
                  if ((null != room) && (null != room.getLiveState())) {
                    int membersCount=room.getLiveState().getMembers().size();
                    int eventsCount=mRoomEvents.get(roomId).size();
                    Log.d(LOG_TAG,"String_Node_Str" + roomId + "String_Node_Str"+ membersCount+ "String_Node_Str"+ eventsCount);
                  }
                }
                Log.d(LOG_TAG,"String_Node_Str");
              }
synchronized (this) {
                mIsReady=true;
              }
              mIsOpening=false;
              Log.e(LOG_TAG,"String_Node_Str");
              dispatchPostProcess(mCredentials.userId);
              mIsPostProcessingDone=true;
              if (!succeed && !mIsNewStorage) {
                Log.e(LOG_TAG,"String_Node_Str");
                dispatchOnStoreCorrupted(mCredentials.userId,errorDescription);
              }
 else {
                mRoomReceiptsToLoad.addAll(listFiles(mStoreRoomsMessagesReceiptsFolderFile.list()));
                mPreloadTime=System.currentTimeMillis() - fLoadTimeT0;
                Log.e(LOG_TAG,"String_Node_Str");
                dispatchOnStoreReady(mCredentials.userId);
                loadReceipts();
                loadUsers();
              }
            }
          }
);
        }
      }
;
      Thread t=new Thread(r);
      t.start();
    }
 else     if (mIsReady) {
      Runnable r=new Runnable(){
        @Override public void run(){
          if (!mIsPostProcessingDone) {
            Log.e(LOG_TAG,"String_Node_Str");
            dispatchPostProcess(mCredentials.userId);
            mIsPostProcessingDone=true;
          }
 else {
            Log.e(LOG_TAG,"String_Node_Str");
          }
          Log.e(LOG_TAG,"String_Node_Str");
          dispatchOnStoreReady(mCredentials.userId);
          mPreloadTime=System.currentTimeMillis() - fLoadTimeT0;
        }
      }
;
      Thread t=new Thread(r);
      t.start();
    }
  }
}

Fixed version (ground truth):
/** 
 * Open the store.
 */
@Override public void open(){
  super.open();
  final long fLoadTimeT0=System.currentTimeMillis();
synchronized (this) {
    if (!mIsReady && !mIsOpening && (null != mMetadata)&& (null != mHandlerThread)) {
      mIsOpening=true;
      Log.e(LOG_TAG,"String_Node_Str");
      if (null == mFileStoreHandler) {
        try {
          mHandlerThread.start();
        }
 catch (        IllegalThreadStateException e) {
          Log.e(LOG_TAG,"String_Node_Str");
          return;
        }
        mFileStoreHandler=new MXOsHandler(mHandlerThread.getLooper());
      }
      Runnable r=new Runnable(){
        @Override public void run(){
          mFileStoreHandler.post(new Runnable(){
            public void run(){
              Log.e(LOG_TAG,"String_Node_Str");
              String errorDescription=null;
              boolean succeed=true;
              if (!succeed) {
                errorDescription="String_Node_Str";
                Log.e(LOG_TAG,errorDescription);
              }
              if (succeed) {
                succeed&=loadRoomsMessages();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                }
              }
              if (succeed) {
                succeed&=loadRoomsState();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                  long t0=System.currentTimeMillis();
                  Log.e(LOG_TAG,"String_Node_Str");
                  Collection<Room> rooms=getRooms();
                  for (                  Room room : rooms) {
                    Collection<RoomMember> members=room.getLiveState().getMembers();
                    for (                    RoomMember member : members) {
                      updateUserWithRoomMemberEvent(member);
                    }
                  }
                  long delta=System.currentTimeMillis() - t0;
                  Log.e(LOG_TAG,"String_Node_Str" + mUsers.size() + "String_Node_Str"+ delta+ "String_Node_Str");
                  mStoreStats.put("String_Node_Str",delta);
                }
              }
              if (succeed) {
                succeed&=loadSummaries();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                  succeed=mRooms.keySet().containsAll(mRoomSummaries.keySet());
                  if (!succeed) {
                    Log.e(LOG_TAG,"String_Node_Str");
                  }
                }
              }
              if (succeed) {
                succeed&=loadRoomsAccountData();
                if (!succeed) {
                  errorDescription="String_Node_Str";
                  Log.e(LOG_TAG,errorDescription);
                }
 else {
                  Log.e(LOG_TAG,"String_Node_Str");
                }
              }
              if (!succeed) {
                Log.e(LOG_TAG,"String_Node_Str");
                MXFileStoreMetaData tmpMetadata=mMetadata;
                deleteAllData(true);
                mRoomsToCommitForMessages=new ArrayList<>();
                mRoomsToCommitForStates=new ArrayList<>();
                mRoomsToCommitForSummaries=new ArrayList<>();
                mRoomsToCommitForReceipts=new ArrayList<>();
                mMetadata=tmpMetadata;
                if (null == mMetadata) {
                  mMetadata=new MXFileStoreMetaData();
                  mMetadata.mUserId=mCredentials.userId;
                  mMetadata.mAccessToken=mCredentials.accessToken;
                  mMetadata.mVersion=MXFILE_VERSION;
                  mMetaDataHasChanged=true;
                }
 else {
                  mMetadata.mEventStreamToken=null;
                }
                mEventStreamToken=null;
                mAreReceiptsReady=true;
              }
 else {
                Log.d(LOG_TAG,"String_Node_Str");
                Set<String> roomIds=mRoomEvents.keySet();
                for (                String roomId : roomIds) {
                  Room room=getRoom(roomId);
                  if ((null != room) && (null != room.getLiveState())) {
                    int membersCount=room.getLiveState().getMembers().size();
                    int eventsCount=mRoomEvents.get(roomId).size();
                    Log.d(LOG_TAG,"String_Node_Str" + roomId + "String_Node_Str"+ membersCount+ "String_Node_Str"+ eventsCount);
                  }
                }
                Log.d(LOG_TAG,"String_Node_Str");
              }
synchronized (this) {
                mIsReady=true;
              }
              mIsOpening=false;
              Log.e(LOG_TAG,"String_Node_Str");
              dispatchPostProcess(mCredentials.userId);
              mIsPostProcessingDone=true;
              if (!succeed && !mIsNewStorage) {
                Log.e(LOG_TAG,"String_Node_Str");
                dispatchOnStoreCorrupted(mCredentials.userId,errorDescription);
              }
 else {
                mRoomReceiptsToLoad.addAll(listFiles(mStoreRoomsMessagesReceiptsFolderFile.list()));
                mPreloadTime=System.currentTimeMillis() - fLoadTimeT0;
                Log.e(LOG_TAG,"String_Node_Str");
                dispatchOnStoreReady(mCredentials.userId);
                loadReceipts();
                loadUsers();
              }
            }
          }
);
        }
      }
;
      Thread t=new Thread(r);
      t.start();
    }
 else     if (mIsReady) {
      Runnable r=new Runnable(){
        @Override public void run(){
          if (!mIsPostProcessingDone) {
            Log.e(LOG_TAG,"String_Node_Str");
            dispatchPostProcess(mCredentials.userId);
            mIsPostProcessingDone=true;
          }
 else {
            Log.e(LOG_TAG,"String_Node_Str");
          }
          Log.e(LOG_TAG,"String_Node_Str");
          dispatchOnStoreReady(mCredentials.userId);
          mPreloadTime=System.currentTimeMillis() - fLoadTimeT0;
        }
      }
;
      Thread t=new Thread(r);
      t.start();
    }
  }
}