nus-yam/ex-repair huggingface dataset:
Program: 32144
Project: 32144
Buggy source:
private void addContentRules(List<ContentRule> rules){
  for (  ContentRule rule : rules) {
    EventMatchCondition condition=new EventMatchCondition();
    condition.kind=Condition.KIND_EVENT_MATCH;
    condition.key="String_Node_Str";
    condition.pattern=rule.pattern;
    rule.addCondition(condition);
    mRules.add(rule);
  }
}

Fixed version (ground truth):
/** 
 * Create a content EventMatchConditions list from a ContentRules list
 * @param rules the ContentRules list
 */
private void addContentRules(List<ContentRule> rules){
  if (null != rules) {
    for (    ContentRule rule : rules) {
      EventMatchCondition condition=new EventMatchCondition();
      condition.kind=Condition.KIND_EVENT_MATCH;
      condition.key="String_Node_Str";
      condition.pattern=rule.pattern;
      rule.addCondition(condition);
      mRules.add(rule);
    }
  }
}
Program: 32145
Project: 32145
Buggy source:
private void removeNetworkListener(){
  if ((null != mNetworkConnectivityReceiver) && (null != mNetworkListener)) {
    mNetworkConnectivityReceiver.removeEventListener(mNetworkListener);
    mNetworkConnectivityReceiver=null;
    mNetworkListener=null;
  }
}

Fixed version (ground truth):
/** 
 * Remove the network events listener. This listener is only used to initialize the rules at application launch.
 */
private void removeNetworkListener(){
  if ((null != mNetworkConnectivityReceiver) && (null != mNetworkListener)) {
    mNetworkConnectivityReceiver.removeEventListener(mNetworkListener);
    mNetworkConnectivityReceiver=null;
    mNetworkListener=null;
  }
}
Program: 32146
Project: 32146
Buggy source:
/** 
 * Delete the rule.
 * @param rule the rule to delete.
 * @param listener the rule update listener.
 */
public void deleteRule(final BingRule rule,final onBingRuleUpdateListener listener){
  mApiClient.deleteRule(rule.kind,rule.ruleId,new SimpleApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      mRulesSet.remove(rule);
      updateRules(mRulesSet);
      if (listener != null) {
        try {
          listener.onBingRuleUpdateSuccess();
        }
 catch (        Exception e) {
        }
      }
    }
    private void onError(    String message){
      if (null != listener) {
        try {
          listener.onBingRuleUpdateFailure(message);
        }
 catch (        Exception e) {
        }
      }
    }
    /** 
 * Called if there is a network error.
 * @param e the exception
 */
    @Override public void onNetworkError(    Exception e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called in case of a Matrix error.
 * @param e the Matrix error
 */
    @Override public void onMatrixError(    MatrixError e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called for some other type of error.
 * @param e the exception
 */
    @Override public void onUnexpectedError(    Exception e){
      onError(e.getLocalizedMessage());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Delete the rule.
 * @param rule the rule to delete.
 * @param listener the rule update listener.
 */
public void deleteRule(final BingRule rule,final onBingRuleUpdateListener listener){
  if (null == rule) {
    if (listener != null) {
      try {
        listener.onBingRuleUpdateSuccess();
      }
 catch (      Exception e) {
      }
    }
    return;
  }
  mApiClient.deleteRule(rule.kind,rule.ruleId,new SimpleApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      if (null != mRulesSet) {
        mRulesSet.remove(rule);
        updateRules(mRulesSet);
      }
      if (listener != null) {
        try {
          listener.onBingRuleUpdateSuccess();
        }
 catch (        Exception e) {
        }
      }
    }
    private void onError(    String message){
      if (null != listener) {
        try {
          listener.onBingRuleUpdateFailure(message);
        }
 catch (        Exception e) {
        }
      }
    }
    /** 
 * Called if there is a network error.
 * @param e the exception
 */
    @Override public void onNetworkError(    Exception e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called in case of a Matrix error.
 * @param e the Matrix error
 */
    @Override public void onMatrixError(    MatrixError e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called for some other type of error.
 * @param e the exception
 */
    @Override public void onUnexpectedError(    Exception e){
      onError(e.getLocalizedMessage());
    }
  }
);
}
Program: 32147
Project: 32147
Buggy source:
/** 
 * Add a rule.
 * @param rule the rule to delete.
 * @param listener the rule update listener.
 */
public void addRule(final BingRule rule,final onBingRuleUpdateListener listener){
  mApiClient.addRule(rule,new SimpleApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      mRulesSet.addAtTop(rule);
      updateRules(mRulesSet);
      if (listener != null) {
        try {
          listener.onBingRuleUpdateSuccess();
        }
 catch (        Exception e) {
        }
      }
    }
    private void onError(    String message){
      if (null != listener) {
        try {
          listener.onBingRuleUpdateFailure(message);
        }
 catch (        Exception e) {
        }
      }
    }
    /** 
 * Called if there is a network error.
 * @param e the exception
 */
    @Override public void onNetworkError(    Exception e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called in case of a Matrix error.
 * @param e the Matrix error
 */
    @Override public void onMatrixError(    MatrixError e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called for some other type of error.
 * @param e the exception
 */
    @Override public void onUnexpectedError(    Exception e){
      onError(e.getLocalizedMessage());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Add a rule.
 * @param rule the rule to delete.
 * @param listener the rule update listener.
 */
public void addRule(final BingRule rule,final onBingRuleUpdateListener listener){
  if (null == rule) {
    if (listener != null) {
      try {
        listener.onBingRuleUpdateSuccess();
      }
 catch (      Exception e) {
      }
    }
    return;
  }
  mApiClient.addRule(rule,new SimpleApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      if (null != mRulesSet) {
        mRulesSet.addAtTop(rule);
        updateRules(mRulesSet);
      }
      if (listener != null) {
        try {
          listener.onBingRuleUpdateSuccess();
        }
 catch (        Exception e) {
        }
      }
    }
    private void onError(    String message){
      if (null != listener) {
        try {
          listener.onBingRuleUpdateFailure(message);
        }
 catch (        Exception e) {
        }
      }
    }
    /** 
 * Called if there is a network error.
 * @param e the exception
 */
    @Override public void onNetworkError(    Exception e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called in case of a Matrix error.
 * @param e the Matrix error
 */
    @Override public void onMatrixError(    MatrixError e){
      onError(e.getLocalizedMessage());
    }
    /** 
 * Called for some other type of error.
 * @param e the exception
 */
    @Override public void onUnexpectedError(    Exception e){
      onError(e.getLocalizedMessage());
    }
  }
);
}
Program: 32149
Project: 32149
Buggy source:
@Override public void onSuccess(Void info){
  mRulesSet.addAtTop(rule);
  updateRules(mRulesSet);
  if (listener != null) {
    try {
      listener.onBingRuleUpdateSuccess();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
@Override public void onSuccess(Void info){
  if (null != mRulesSet) {
    mRulesSet.addAtTop(rule);
    updateRules(mRulesSet);
  }
  if (listener != null) {
    try {
      listener.onBingRuleUpdateSuccess();
    }
 catch (    Exception e) {
    }
  }
}
Program: 32150
Project: 32150
Buggy source:
/** 
 * Make a deep copy of this room state object.
 * @return the copy
 */
public RoomState deepCopy(){
  RoomState copy=new RoomState();
  copy.roomId=roomId;
  copy.setPowerLevels((powerLevels == null) ? null : powerLevels.deepCopy());
  copy.aliases=(aliases == null) ? null : new ArrayList<String>(aliases);
  copy.alias=this.alias;
  copy.name=name;
  copy.topic=topic;
  copy.url=url;
  copy.creator=creator;
  copy.join_rule=join_rule;
  copy.visibility=visibility;
  copy.roomAliasName=roomAliasName;
  copy.token=token;
  copy.mDataHandler=mDataHandler;
  copy.mMembership=mMembership;
  copy.mIsLive=mIsLive;
synchronized (this) {
    Iterator it=mMembers.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,RoomMember> pair=(Map.Entry<String,RoomMember>)it.next();
      copy.setMember(pair.getKey(),pair.getValue().deepCopy());
    }
    Collection<String> keys=mThirdPartyInvites.keySet();
    for (    String key : keys) {
      copy.mThirdPartyInvites.put(key,mThirdPartyInvites.get(key).deepCopy());
    }
    keys=mMembersWithThirdPartyInviteTokenCache.keySet();
    for (    String key : keys) {
      copy.mMembersWithThirdPartyInviteTokenCache.put(key,mMembersWithThirdPartyInviteTokenCache.get(key).deepCopy());
    }
  }
  return copy;
}

Fixed version (ground truth):
/** 
 * Make a deep copy of this room state object.
 * @return the copy
 */
public RoomState deepCopy(){
  RoomState copy=new RoomState();
  copy.roomId=roomId;
  copy.setPowerLevels((powerLevels == null) ? null : powerLevels.deepCopy());
  copy.aliases=(aliases == null) ? null : new ArrayList<String>(aliases);
  copy.alias=this.alias;
  copy.name=name;
  copy.topic=topic;
  copy.url=url;
  copy.creator=creator;
  copy.join_rule=join_rule;
  copy.guest_access=guest_access;
  copy.history_visibility=history_visibility;
  copy.visibility=visibility;
  copy.roomAliasName=roomAliasName;
  copy.token=token;
  copy.mDataHandler=mDataHandler;
  copy.mMembership=mMembership;
  copy.mIsLive=mIsLive;
synchronized (this) {
    Iterator it=mMembers.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<String,RoomMember> pair=(Map.Entry<String,RoomMember>)it.next();
      copy.setMember(pair.getKey(),pair.getValue().deepCopy());
    }
    Collection<String> keys=mThirdPartyInvites.keySet();
    for (    String key : keys) {
      copy.mThirdPartyInvites.put(key,mThirdPartyInvites.get(key).deepCopy());
    }
    keys=mMembersWithThirdPartyInviteTokenCache.keySet();
    for (    String key : keys) {
      copy.mMembersWithThirdPartyInviteTokenCache.put(key,mMembersWithThirdPartyInviteTokenCache.get(key).deepCopy());
    }
  }
  return copy;
}
Program: 32157
Project: 32157
Buggy source:
public void run(){
  callback.onSuccess(storageResponse);
}

Fixed version (ground truth):
public void run(){
  String expectedToken;
synchronized (mPendingRequestTokenByRoomId) {
    expectedToken=mPendingRequestTokenByRoomId.get(roomId);
  }
  if (TextUtils.equals(expectedToken,token)) {
    callback.onSuccess(storageResponse);
  }
}
Program: 32158
Project: 32158
Buggy source:
@Override public void onSuccess(TokensChunkResponse<Event> info){
  Event oldestEvent=mStore.getOldestEvent(roomId);
  if (info.chunk.size() != 0) {
    info.chunk.get(0).mToken=info.start;
    info.chunk.get(info.chunk.size() - 1).mToken=info.end;
    Event firstReturnedEvent=info.chunk.get(0);
    if ((oldestEvent != null) && (firstReturnedEvent != null) && TextUtils.equals(oldestEvent.eventId,firstReturnedEvent.eventId)) {
      info.chunk.remove(0);
    }
    mStore.storeRoomEvents(roomId,info,Room.EventDirection.BACKWARDS);
  }
  callback.onSuccess(info);
}

Fixed version (ground truth):
@Override public void onSuccess(TokensChunkResponse<Event> info){
  String expectedToken;
synchronized (mPendingRequestTokenByRoomId) {
    expectedToken=mPendingRequestTokenByRoomId.get(roomId);
  }
  if (TextUtils.equals(expectedToken,token)) {
    Event oldestEvent=mStore.getOldestEvent(roomId);
    if (info.chunk.size() != 0) {
      info.chunk.get(0).mToken=info.start;
      info.chunk.get(info.chunk.size() - 1).mToken=info.end;
      Event firstReturnedEvent=info.chunk.get(0);
      if ((oldestEvent != null) && (firstReturnedEvent != null) && TextUtils.equals(oldestEvent.eventId,firstReturnedEvent.eventId)) {
        info.chunk.remove(0);
      }
      mStore.storeRoomEvents(roomId,info,Room.EventDirection.BACKWARDS);
    }
    callback.onSuccess(info);
  }
}
Program: 32159
Project: 32159
Buggy source:
/** 
 * Reset the back state so that future history requests start over from live. Must be called when opening a room if interested in history.
 */
public void initHistory(){
  mBackState=mLiveState.deepCopy();
  canStillPaginate=true;
}

Fixed version (ground truth):
/** 
 * Reset the back state so that future history requests start over from live. Must be called when opening a room if interested in history.
 */
public void initHistory(){
  mBackState=mLiveState.deepCopy();
  canStillPaginate=true;
  isPaginating=false;
  mDataRetriever.cancelHistoryRequest(mRoomId);
}
Program: 32160
Project: 32160
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (null != mRoom) {
    mSession.getDataHandler().getRoom(mRoom.getRoomId()).addEventListener(mEventsListenener);
  }
  mMessageListView.setOnScrollListener(new AbsListView.OnScrollListener(){
    @Override public void onScrollStateChanged(    AbsListView view,    int scrollState){
      mCheckSlideToHide=(scrollState == SCROLL_STATE_TOUCH_SCROLL);
      if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
        int firstVisibleRow=mMessageListView.getFirstVisiblePosition();
        int lastVisibleRow=mMessageListView.getLastVisiblePosition();
        int count=mMessageListView.getCount();
        if ((count > 0) && (firstVisibleRow == 0) && (lastVisibleRow == (count - 1))&& (!mIsInitialSyncing)) {
          requestHistory();
        }
      }
    }
    @Override public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if ((firstVisibleItem < 2) && (!mIsInitialSyncing) && (visibleItemCount != totalItemCount)&& (0 != visibleItemCount)) {
        requestHistory();
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (null != mRoom) {
    mSession.getDataHandler().getRoom(mRoom.getRoomId()).addEventListener(mEventsListenener);
  }
  mMessageListView.setOnScrollListener(new AbsListView.OnScrollListener(){
    @Override public void onScrollStateChanged(    AbsListView view,    int scrollState){
      mCheckSlideToHide=(scrollState == SCROLL_STATE_TOUCH_SCROLL);
      if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
        int firstVisibleRow=mMessageListView.getFirstVisiblePosition();
        int count=mMessageListView.getCount();
        if ((count > 0) && (firstVisibleRow < 2) && !mIsInitialSyncing&& !mIsCatchingUp) {
          requestHistory();
        }
      }
    }
    @Override public void onScroll(    AbsListView view,    int firstVisibleItem,    int visibleItemCount,    int totalItemCount){
      if ((firstVisibleItem < 2) && !mIsInitialSyncing && !mIsCatchingUp&& (visibleItemCount != totalItemCount)&& (0 != visibleItemCount)) {
        requestHistory();
      }
    }
  }
);
}
Program: 32161
Project: 32161
Buggy source:
@Override public void onScroll(AbsListView view,int firstVisibleItem,int visibleItemCount,int totalItemCount){
  if ((firstVisibleItem < 2) && (!mIsInitialSyncing) && (visibleItemCount != totalItemCount)&& (0 != visibleItemCount)) {
    requestHistory();
  }
}

Fixed version (ground truth):
@Override public void onScroll(AbsListView view,int firstVisibleItem,int visibleItemCount,int totalItemCount){
  if ((firstVisibleItem < 2) && !mIsInitialSyncing && !mIsCatchingUp&& (visibleItemCount != totalItemCount)&& (0 != visibleItemCount)) {
    requestHistory();
  }
}
Program: 32162
Project: 32162
Buggy source:
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  mCheckSlideToHide=(scrollState == SCROLL_STATE_TOUCH_SCROLL);
  if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
    int firstVisibleRow=mMessageListView.getFirstVisiblePosition();
    int lastVisibleRow=mMessageListView.getLastVisiblePosition();
    int count=mMessageListView.getCount();
    if ((count > 0) && (firstVisibleRow == 0) && (lastVisibleRow == (count - 1))&& (!mIsInitialSyncing)) {
      requestHistory();
    }
  }
}

Fixed version (ground truth):
@Override public void onScrollStateChanged(AbsListView view,int scrollState){
  mCheckSlideToHide=(scrollState == SCROLL_STATE_TOUCH_SCROLL);
  if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
    int firstVisibleRow=mMessageListView.getFirstVisiblePosition();
    int count=mMessageListView.getCount();
    if ((count > 0) && (firstVisibleRow < 2) && !mIsInitialSyncing&& !mIsCatchingUp) {
      requestHistory();
    }
  }
}
Program: 32164
Project: 32164
Buggy source:
@Override public void storeRoom(Room room){
  if ((null != room) && (null != room.getRoomId())) {
    mRooms.put(room.getRoomId(),room);
  }
}

Fixed version (ground truth):
@Override public void storeRoom(Room room){
  if ((null != room) && (null != room.getRoomId())) {
    mRooms.put(room.getRoomId(),room);
    storeBackToken(room.getRoomId(),"String_Node_Str");
  }
}
Program: 32166
Project: 32166
Buggy source:
public void handleInvitedRoomSync(InvitedRoomSync invitedRoomSync){
  if ((null != invitedRoomSync) && (null != invitedRoomSync.inviteState) && (null != invitedRoomSync.inviteState.events)) {
    for (    Event event : invitedRoomSync.inviteState.events) {
      if (null == event.eventId) {
        event.eventId=mRoomId + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"+ event.hashCode();
      }
      event.roomId=mRoomId;
      mDataHandler.handleLiveEvent(event);
    }
    mDataHandler.getStore().storeBackToken(mRoomId,invitedRoomSync.inviteState.events.get(0).eventId);
  }
}

Fixed version (ground truth):
public void handleInvitedRoomSync(InvitedRoomSync invitedRoomSync){
  if ((null != invitedRoomSync) && (null != invitedRoomSync.inviteState) && (null != invitedRoomSync.inviteState.events)) {
    for (    Event event : invitedRoomSync.inviteState.events) {
      if (null == event.eventId) {
        event.eventId=mRoomId + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"+ event.hashCode();
      }
      event.roomId=mRoomId;
      mDataHandler.handleLiveEvent(event);
    }
  }
}
Program: 32167
Project: 32167
Buggy source:
/** 
 * Send MAX_EVENT_COUNT_PER_PAGINATION events to the caller.
 * @param callback the callback.
 */
private void manageEvents(final ApiCallback<Integer> callback){
  if (!mDataHandler.isActive()) {
    return;
  }
  int count=Math.min(mSnapshotedEvents.size(),MAX_EVENT_COUNT_PER_PAGINATION);
  for (int i=0; i < count; i++) {
    SnapshotedEvent snapshotedEvent=mSnapshotedEvents.get(0);
    mSnapshotedEvents.remove(0);
    mDataHandler.onBackEvent(snapshotedEvent.mEvent,snapshotedEvent.mState);
  }
  if ((mSnapshotedEvents.size() == 0) && (0 == mLatestChunkSize)) {
    canStillPaginate=false;
  }
  if (callback != null) {
    try {
      callback.onSuccess(count);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  isPaginating=false;
  Log.d(LOG_TAG,"String_Node_Str");
  mDataHandler.getStore().commit();
}

Fixed version (ground truth):
/** 
 * Send MAX_EVENT_COUNT_PER_PAGINATION events to the caller.
 * @param callback the callback.
 */
private void manageEvents(final ApiCallback<Integer> callback){
  if (!mDataHandler.isActive()) {
    return;
  }
  int count=Math.min(mSnapshotedEvents.size(),MAX_EVENT_COUNT_PER_PAGINATION);
  for (int i=0; i < count; i++) {
    SnapshotedEvent snapshotedEvent=mSnapshotedEvents.get(0);
    mSnapshotedEvents.remove(0);
    mDataHandler.onBackEvent(snapshotedEvent.mEvent,snapshotedEvent.mState);
  }
  if ((mSnapshotedEvents.size() < MAX_EVENT_COUNT_PER_PAGINATION) && mIsLastChunk) {
    canStillPaginate=false;
  }
  if (callback != null) {
    try {
      callback.onSuccess(count);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  isPaginating=false;
  Log.d(LOG_TAG,"String_Node_Str");
  mDataHandler.getStore().commit();
}
Program: 32172
Project: 32172
Buggy source:
@Override public void deleteRoomData(String roomId){
  if (null != roomId) {
synchronized (mRoomEvents) {
      mRoomEvents.remove(roomId);
      mRoomTokens.remove(roomId);
      mRoomSummaries.remove(roomId);
      mRoomAccountData.remove(roomId);
      mReceiptsByRoomId.remove(roomId);
    }
  }
}

Fixed version (ground truth):
@Override public void deleteRoomData(String roomId){
  if (null != roomId) {
synchronized (mRoomEvents) {
      mRoomEvents.remove(roomId);
      mRoomEventIds.remove(roomId);
      mRoomTokens.remove(roomId);
      mRoomSummaries.remove(roomId);
      mRoomAccountData.remove(roomId);
      mReceiptsByRoomId.remove(roomId);
    }
  }
}
Program: 32173
Project: 32173
Buggy source:
/** 
 * Load a room state from the file system.
 * @param roomId the room id.
 * @return true if the operation succeeds.
 */
private boolean loadRoomState(final String roomId){
  Boolean succeed=true;
  Room room=getRoom(roomId);
  if (null != room) {
    RoomState liveState=null;
    boolean shouldSave=false;
    try {
      File messagesListFile=new File(mGzStoreRoomsStateFolderFile,roomId);
      if (messagesListFile.exists()) {
        FileInputStream fis=new FileInputStream(messagesListFile);
        GZIPInputStream gz=new GZIPInputStream(fis);
        ObjectInputStream ois=new ObjectInputStream(gz);
        liveState=(RoomState)ois.readObject();
        ois.close();
      }
    }
 catch (    Exception e) {
      succeed=false;
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
    if (null != liveState) {
      room.setLiveState(liveState);
      if (shouldSave) {
        saveRoomState(roomId);
      }
    }
 else {
      deleteRoom(roomId);
    }
  }
 else {
    try {
      File messagesListFile=new File(mGzStoreRoomsStateFolderFile,roomId);
      messagesListFile.delete();
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  return succeed;
}

Fixed version (ground truth):
/** 
 * Load a room state from the file system.
 * @param roomId the room id.
 * @return true if the operation succeeds.
 */
private boolean loadRoomState(final String roomId){
  Boolean succeed=true;
  Room room=getRoom(roomId);
  if (null != room) {
    RoomState liveState=null;
    boolean shouldSave=false;
    try {
      File messagesListFile=new File(mGzStoreRoomsStateFolderFile,roomId);
      if (messagesListFile.exists()) {
        FileInputStream fis=new FileInputStream(messagesListFile);
        GZIPInputStream gz=new GZIPInputStream(fis);
        ObjectInputStream ois=new ObjectInputStream(gz);
        liveState=(RoomState)ois.readObject();
        ois.close();
      }
    }
 catch (    Exception e) {
      succeed=false;
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
    if (null != liveState) {
      room.setLiveState(liveState);
      Collection<RoomMember> members=liveState.getMembers();
      for (      RoomMember member : members) {
        updateUserWithRoomMemberEvent(member);
      }
      if (shouldSave) {
        saveRoomState(roomId);
      }
    }
 else {
      deleteRoom(roomId);
    }
  }
 else {
    try {
      File messagesListFile=new File(mGzStoreRoomsStateFolderFile,roomId);
      messagesListFile.delete();
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  return succeed;
}
Program: 32174
Project: 32174
Buggy source:
/** 
 * Refresh the avatar url
 * @param callback callback when the job is done.
 */
private void refreshUserAvatarUrl(final ApiCallback<Void> callback){
  mProfileRestClient.avatarUrl(userId,new SimpleApiCallback<String>(){
    @Override public void onSuccess(    String anAvatarUrl){
      if (MyUser.this.mDataHandler.isActive()) {
        avatarUrl=anAvatarUrl;
        MyUser.this.mDataHandler.getStore().setAvatarURL(anAvatarUrl);
        mIsAvatarRefreshed=true;
        if (null != callback) {
          callback.onSuccess(null);
        }
      }
    }
    private void onError(){
      if (MyUser.this.mDataHandler.isActive()) {
        if (null != callback) {
          callback.onSuccess(null);
        }
      }
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    final MatrixError e){
      onError();
    }
    @Override public void onUnexpectedError(    final Exception e){
      onError();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Refresh the avatar url
 * @param callback callback when the job is done.
 */
private void refreshUserAvatarUrl(final ApiCallback<Void> callback){
  mProfileRestClient.avatarUrl(userId,new SimpleApiCallback<String>(){
    @Override public void onSuccess(    String anAvatarUrl){
      if (MyUser.this.mDataHandler.isActive()) {
        avatarUrl=anAvatarUrl;
        MyUser.this.mDataHandler.getStore().setAvatarURL(anAvatarUrl);
        mIsAvatarRefreshed=true;
        MyUser.this.mDataHandler.getStore().storeUser(MyUser.this);
        if (null != callback) {
          callback.onSuccess(null);
        }
      }
    }
    private void onError(){
      if (MyUser.this.mDataHandler.isActive()) {
        if (null != callback) {
          callback.onSuccess(null);
        }
      }
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    final MatrixError e){
      onError();
    }
    @Override public void onUnexpectedError(    final Exception e){
      onError();
    }
  }
);
}
Program: 32175
Project: 32175
Buggy source:
public void handleInvitedRoomSync(InvitedRoomSync invitedRoomSync){
  if ((null != invitedRoomSync) && (null != invitedRoomSync.inviteState) && (null != invitedRoomSync.inviteState.events)) {
    for (    Event event : invitedRoomSync.inviteState.events) {
      if (null == event.eventId) {
        event.eventId=mRoomId + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"+ event.hashCode();
      }
      event.roomId=mRoomId;
      mDataHandler.handleLiveEvent(event);
    }
  }
}

Fixed version (ground truth):
public void handleInvitedRoomSync(InvitedRoomSync invitedRoomSync){
  if ((null != invitedRoomSync) && (null != invitedRoomSync.inviteState) && (null != invitedRoomSync.inviteState.events)) {
    for (    Event event : invitedRoomSync.inviteState.events) {
      if (null == event.eventId) {
        event.eventId=mRoomId + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"+ event.hashCode();
      }
      event.roomId=mRoomId;
      mDataHandler.handleLiveEvent(event);
    }
    mDataHandler.getStore().storeBackToken(mRoomId,invitedRoomSync.inviteState.events.get(0).eventId);
  }
}
Program: 32177
Project: 32177
Buggy source:
/** 
 * Check if some users can be created from room members
 */
public void refreshUsersList(){
  Collection<RoomMember> members=getMembers();
  for (  RoomMember member : members) {
    updateUser(member);
  }
}

Fixed version (ground truth):
/** 
 * Check if some users can be created from room members
 */
public void refreshUsersList(){
  MXDataHandler dataHandler=(MXDataHandler)mDataHandler;
  Collection<User> users=dataHandler.getStore().getUsers();
  for (  User user : users) {
    user.setDataHandler(dataHandler);
  }
}
Program: 32180
Project: 32180
Buggy source:
/** 
 * Delete the room data
 * @param roomId the roomId.
 */
public void deleteRoom(String roomId);

Fixed version (ground truth):
/** 
 * Delete the room from the storage. The room data and its reference will be deleted.
 * @param roomId the roomId.
 */
public void deleteRoom(String roomId);
Program: 32181
Project: 32181
Buggy source:
@Override public void deleteRoom(String roomId){
  if (null != roomId) {
synchronized (mRoomEvents) {
      mRooms.remove(roomId);
      mRoomEvents.remove(roomId);
      mRoomTokens.remove(roomId);
      mRoomSummaries.remove(roomId);
      mRoomAccountData.remove(roomId);
      mReceiptsByRoomId.remove(roomId);
    }
  }
}

Fixed version (ground truth):
@Override public void deleteRoom(String roomId){
  if (null != roomId) {
    deleteRoomData(roomId);
synchronized (mRoomEvents) {
      mRooms.remove(roomId);
    }
  }
}
Program: 32183
Project: 32183
Buggy source:
private void onError(String description){
  boolean isConnected;
  Log.d(LOG_TAG,"String_Node_Str" + description);
synchronized (this) {
    isConnected=mbIsConnected;
  }
  if (!isConnected) {
    mIsNetworkSuspended=true;
  }
  latch.countDown();
}

Fixed version (ground truth):
private void onError(String description){
  boolean isConnected;
  Log.d(LOG_TAG,"String_Node_Str" + description);
synchronized (this) {
    isConnected=mbIsConnected;
  }
  if (isConnected) {
    new Handler(Looper.getMainLooper()).postDelayed(new Runnable(){
      public void run(){
        latch.countDown();
      }
    }
,RETRY_WAIT_TIME_MS);
  }
 else {
    mIsNetworkSuspended=true;
    latch.countDown();
  }
}
Program: 32184
Project: 32184
Buggy source:
private void sleepAndUnblock(){
  new Handler().postDelayed(new Runnable(){
    public void run(){
      latch.countDown();
    }
  }
,RETRY_WAIT_TIME_MS);
}

Fixed version (ground truth):
private void sleepAndUnblock(){
  new Handler(Looper.getMainLooper()).postDelayed(new Runnable(){
    public void run(){
      latch.countDown();
    }
  }
,RETRY_WAIT_TIME_MS);
}
Program: 32188
Project: 32188
Buggy source:
public void requestHistory(){
  if (!mIsCatchingUp) {
    if (null != mPattern) {
      requestSearchHistory();
      return;
    }
    mIsCatchingUp=true;
    final int firstPos=mMessageListView.getFirstVisiblePosition();
    boolean isStarted=mMatrixMessagesFragment.requestHistory(new SimpleApiCallback<Integer>(getActivity()){
      @Override public void onSuccess(      final Integer count){
        dismissLoadingProgress();
        mUiHandler.post(new Runnable(){
          @Override public void run(){
            mAdapter.notifyDataSetChanged();
            mMessageListView.setSelection(firstPos + count);
            mIsCatchingUp=false;
          }
        }
);
      }
      @Override public void onNetworkError(      Exception e){
        onRequestError(e);
      }
      @Override public void onMatrixError(      MatrixError e){
        onRequestError(e);
      }
      @Override public void onUnexpectedError(      Exception e){
        onRequestError(e);
      }
    }
);
    if (isStarted && (null != getActivity())) {
      displayLoadingProgress();
    }
  }
}

Fixed version (ground truth):
public void requestHistory(){
  if (!mIsCatchingUp) {
    if (null != mPattern) {
      requestSearchHistory();
      return;
    }
    mIsCatchingUp=true;
    final int firstPos=mMessageListView.getFirstVisiblePosition();
    final int countBeforeUpdate=mAdapter.getCount();
    boolean isStarted=mMatrixMessagesFragment.requestHistory(new SimpleApiCallback<Integer>(getActivity()){
      @Override public void onSuccess(      final Integer count){
        dismissLoadingProgress();
        mUiHandler.post(new Runnable(){
          @Override public void run(){
            mAdapter.notifyDataSetChanged();
            mMessageListView.setSelection(firstPos + (mAdapter.getCount() - countBeforeUpdate));
            mIsCatchingUp=false;
          }
        }
);
      }
      @Override public void onNetworkError(      Exception e){
        onRequestError(e);
      }
      @Override public void onMatrixError(      MatrixError e){
        onRequestError(e);
      }
      @Override public void onUnexpectedError(      Exception e){
        onRequestError(e);
      }
    }
);
    if (isStarted && (null != getActivity())) {
      displayLoadingProgress();
    }
  }
}
Program: 32189
Project: 32189
Buggy source:
/** 
 * Update the typing users list
 * @param typingUsers
 */
public void setTypingUsers(ArrayList<String> typingUsers){
  boolean refresh=mTypingUsers.size() != typingUsers.size();
  if (mTypingUsers.size() == 1) {
    String userId=mTypingUsers.get(0);
    MyUser myUser=mSession.getMyUser();
    if (userId.equals(myUser.userId)) {
      mTypingUsers=typingUsers;
      return;
    }
  }
  if (!refresh) {
    if (mTypingUsers.size() != 0) {
      for (      String userId : mTypingUsers) {
        if (typingUsers.indexOf(userId) < 0) {
          refresh=true;
          break;
        }
      }
    }
  }
  mTypingUsers=typingUsers;
  if (refresh) {
    notifyDataSetChanged();
  }
}

Fixed version (ground truth):
/** 
 * Update the typing users list
 * @param typingUsers
 */
public void setTypingUsers(ArrayList<String> typingUsers){
  if (null != mTypingUsers) {
    if (null == typingUsers) {
      typingUsers=new ArrayList<String>();
    }
    boolean refresh=mTypingUsers.size() != typingUsers.size();
    if (mTypingUsers.size() == 1) {
      String userId=mTypingUsers.get(0);
      MyUser myUser=mSession.getMyUser();
      if (userId.equals(myUser.userId)) {
        mTypingUsers=typingUsers;
        return;
      }
    }
    if (!refresh) {
      if (mTypingUsers.size() != 0) {
        for (        String userId : mTypingUsers) {
          if (typingUsers.indexOf(userId) < 0) {
            refresh=true;
            break;
          }
        }
      }
    }
    mTypingUsers=typingUsers;
    if (refresh) {
      notifyDataSetChanged();
    }
  }
}
Program: 32190
Project: 32190
Buggy source:
/** 
 * Handle events coming down from the event stream.
 * @param event the live event
 */
private void handleLiveEvent(Event event){
  if (Event.EVENT_TYPE_PRESENCE.equals(event.type)) {
    User userPresence=JsonUtils.toUser(event.content);
    User user=mStore.getUser(userPresence.userId);
    if (user == null) {
      user=userPresence;
      user.lastActiveReceived();
      user.setDataHandler(this);
      mStore.storeUser(user);
    }
 else {
      user.presence=userPresence.presence;
      user.lastActiveAgo=userPresence.lastActiveAgo;
      user.lastActiveReceived();
    }
    this.onPresenceUpdate(event,user);
  }
 else   if (event.roomId != null) {
    final Room room=getRoom(event.roomId);
    if (event.stateKey != null) {
      if (!room.processStateEvent(event,Room.EventDirection.FORWARDS)) {
        return;
      }
    }
    RoomState liveStateCopy=room.getLiveState().deepCopy();
    storeLiveRoomEvent(event);
    onLiveEvent(event,liveStateCopy);
    BingRule bingRule;
    if (Event.EVENT_TYPE_STATE_ROOM_MEMBER.equals(event.type) && event.userId.equals(mCredentials.userId)) {
      onSelfJoinEvent(event,liveStateCopy);
    }
    if (!Event.EVENT_TYPE_TYPING.equals(event.type) && (mBingRulesManager != null) && (null != (bingRule=mBingRulesManager.fulfilledBingRule(event)))) {
      onBingEvent(event,liveStateCopy,bingRule);
    }
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + event.type);
  }
}

Fixed version (ground truth):
/** 
 * Handle events coming down from the event stream.
 * @param event the live event
 */
private void handleLiveEvent(Event event){
  if (Event.EVENT_TYPE_PRESENCE.equals(event.type)) {
    User userPresence=JsonUtils.toUser(event.content);
    User user=mStore.getUser(userPresence.userId);
    if (user == null) {
      user=userPresence;
      user.lastActiveReceived();
      user.setDataHandler(this);
      mStore.storeUser(user);
    }
 else {
      user.presence=userPresence.presence;
      user.lastActiveAgo=userPresence.lastActiveAgo;
      user.lastActiveReceived();
    }
    this.onPresenceUpdate(event,user);
  }
 else   if (event.roomId != null) {
    final Room room=getRoom(event.roomId);
    if (event.stateKey != null) {
      if (!room.processStateEvent(event,Room.EventDirection.FORWARDS)) {
        return;
      }
    }
    RoomState liveStateCopy=room.getLiveState().deepCopy();
    storeLiveRoomEvent(event);
    onLiveEvent(event,liveStateCopy);
    BingRule bingRule;
    if (Event.EVENT_TYPE_STATE_ROOM_MEMBER.equals(event.type) && event.userId.equals(mCredentials.userId)) {
      onSelfJoinEvent(event,liveStateCopy);
    }
    if (!Event.EVENT_TYPE_TYPING.equals(event.type) && (mBingRulesManager != null) && (null != (bingRule=mBingRulesManager.fulfilledBingRule(event)))&& bingRule.shouldNotify()) {
      onBingEvent(event,liveStateCopy,bingRule);
    }
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str" + event.type);
  }
}
Program: 32191
Project: 32191
Buggy source:
/** 
 * Create a user session with a data handler.
 * @param dataHandler the data handler
 * @param credentials the user credentials
 * @param appContext the application context
 */
public MXSession(MXDataHandler dataHandler,Credentials credentials,Context appContext){
  this(credentials);
  mDataHandler=dataHandler;
  mDataRetriever=new DataRetriever();
  mDataRetriever.setRoomsRestClient(mRoomsRestClient);
  mDataHandler.setDataRetriever(mDataRetriever);
  mDataHandler.setPushRulesManager(new BingRulesManager(this));
  mAppContent=appContext;
  mNetworkConnectivityReceiver=new NetworkConnectivityReceiver();
  mAppContent.registerReceiver(mNetworkConnectivityReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  mUnsentEventsManager=new UnsentEventsManager(mNetworkConnectivityReceiver);
  mContentManager=new ContentManager(credentials.homeServer,credentials.accessToken,mUnsentEventsManager);
  mDataHandler.setContentManager(mContentManager);
  mEventsRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mProfileRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mPresenceRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mRoomsRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mBingRulesRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mThirdPidRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mLatestChatMessageCache=new MXLatestChatMessageCache(credentials.userId);
  mMediasCache=new MXMediasCache(mContentManager,credentials.userId,appContext);
}

Fixed version (ground truth):
/** 
 * Create a user session with a data handler.
 * @param dataHandler the data handler
 * @param credentials the user credentials
 * @param appContext the application context
 */
public MXSession(MXDataHandler dataHandler,Credentials credentials,Context appContext){
  this(credentials);
  mDataHandler=dataHandler;
  mDataRetriever=new DataRetriever();
  mDataRetriever.setRoomsRestClient(mRoomsRestClient);
  mDataHandler.setDataRetriever(mDataRetriever);
  mBingRulesManager=new BingRulesManager(this);
  mDataHandler.setPushRulesManager(mBingRulesManager);
  mAppContent=appContext;
  mNetworkConnectivityReceiver=new NetworkConnectivityReceiver();
  mAppContent.registerReceiver(mNetworkConnectivityReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  mUnsentEventsManager=new UnsentEventsManager(mNetworkConnectivityReceiver);
  mContentManager=new ContentManager(credentials.homeServer,credentials.accessToken,mUnsentEventsManager);
  mDataHandler.setContentManager(mContentManager);
  mEventsRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mProfileRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mPresenceRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mRoomsRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mBingRulesRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mThirdPidRestClient.setUnsentEventsManager(mUnsentEventsManager);
  mLatestChatMessageCache=new MXLatestChatMessageCache(credentials.userId);
  mMediasCache=new MXMediasCache(mContentManager,credentials.userId,appContext);
}
Program: 32192
Project: 32192
Buggy source:
private View getTextView(final int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    convertView=mLayoutInflater.inflate(mRowTypeToLayoutId.get(ROW_TYPE_TEXT),parent,false);
  }
  MessageRow row=getItem(position);
  Event msg=row.getEvent();
  RoomState roomState=row.getRoomState();
  EventDisplay display=new EventDisplay(mContext,msg,roomState);
  final CharSequence body=display.getTextualDisplay();
  final TextView bodyTextView=(TextView)convertView.findViewById(R.id.messagesAdapter_body);
  bodyTextView.setText(body);
  int textColor;
  if (row.getEvent().isSending()) {
    textColor=sendingColor;
  }
 else   if (row.getEvent().isUndeliverable()) {
    textColor=notSentColor;
  }
 else {
    textColor=(EventUtils.shouldHighlight(mSession,mContext,msg) ? highlightColor : normalColor);
  }
  bodyTextView.setTextColor(textColor);
  this.manageSubView(position,convertView,bodyTextView,ROW_TYPE_TEXT);
  convertView.setClickable(true);
  convertView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (!bodyTextView.hasSelection() && (null != mMessagesAdapterClickListener)) {
        bodyTextView.requestFocus();
        mMessagesAdapterClickListener.onItemClick(position);
      }
    }
  }
);
  setBackgroundColour(convertView,position);
  return convertView;
}

Fixed version (ground truth):
private View getTextView(final int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    convertView=mLayoutInflater.inflate(mRowTypeToLayoutId.get(ROW_TYPE_TEXT),parent,false);
  }
  MessageRow row=getItem(position);
  Event msg=row.getEvent();
  RoomState roomState=row.getRoomState();
  EventDisplay display=new EventDisplay(mContext,msg,roomState);
  final CharSequence body=display.getTextualDisplay();
  final TextView bodyTextView=(TextView)convertView.findViewById(R.id.messagesAdapter_body);
  bodyTextView.setText(body);
  int textColor;
  if (row.getEvent().isSending()) {
    textColor=sendingColor;
  }
 else   if (row.getEvent().isUndeliverable()) {
    textColor=notSentColor;
  }
 else {
    textColor=normalColor;
    if (null != msg.eventId) {
synchronized (this) {
        if (!mTextColorByEventId.containsKey(msg.eventId)) {
          textColor=(EventUtils.shouldHighlight(mSession,msg) ? highlightColor : normalColor);
          mTextColorByEventId.put(msg.eventId,textColor);
        }
 else {
          textColor=mTextColorByEventId.get(msg.eventId);
        }
      }
    }
  }
  bodyTextView.setTextColor(textColor);
  this.manageSubView(position,convertView,bodyTextView,ROW_TYPE_TEXT);
  convertView.setClickable(true);
  convertView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (!bodyTextView.hasSelection() && (null != mMessagesAdapterClickListener)) {
        bodyTextView.requestFocus();
        mMessagesAdapterClickListener.onItemClick(position);
      }
    }
  }
);
  setBackgroundColour(convertView,position);
  return convertView;
}
Program: 32193
Project: 32193
Buggy source:
/** 
 * Return true if the rule should highlight the event.
 * @return true if the rule should play sound
 */
public boolean shouldHighlight(){
  boolean highlight=false;
  JsonObject jsonObject=jsonObjectWithTweak(ACTION_SET_TWEAK_HIGHTLIGHT_VALUE);
  if ((null != jsonObject) && jsonObject.has(ACTION_PARAMETER_VALUE)) {
    highlight=jsonObject.get(ACTION_PARAMETER_VALUE).getAsString().equals(ACTION_VALUE_TRUE);
  }
  return highlight;
}

Fixed version (ground truth):
/** 
 * Return true if the rule should highlight the event.
 * @return true if the rule should play sound
 */
public boolean shouldHighlight(){
  boolean highlight=false;
  JsonObject jsonObject=jsonObjectWithTweak(ACTION_SET_TWEAK_HIGHTLIGHT_VALUE);
  if (null != jsonObject) {
    highlight=true;
    if (jsonObject.has(ACTION_PARAMETER_VALUE)) {
      highlight=jsonObject.get(ACTION_PARAMETER_VALUE).getAsString().equals(ACTION_VALUE_TRUE);
    }
  }
  return highlight;
}
Program: 32194
Project: 32194
Buggy source:
/** 
 * Returns the first notifiable bing rule which fulfills its condition with this event.
 * @param event the event
 * @return the first matched bing rule, null if none
 */
public BingRule fulfilledBingRule(Event event){
  if (null == event) {
    return null;
  }
  if (!isReady) {
    return null;
  }
  if ((null != event.userId) && (event.userId.equals(mMyUserId))) {
    return null;
  }
  if (mRules != null) {
    for (    BingRule bingRule : mRules) {
      if (bingRule.isEnabled && eventMatchesConditions(event,bingRule.conditions)) {
        for (        JsonElement action : bingRule.actions) {
          if (action.isJsonPrimitive()) {
            String actionString=action.getAsString();
            if (BingRule.ACTION_NOTIFY.equals(actionString) || BingRule.ACTION_COALESCE.equals(actionString)) {
              return bingRule;
            }
 else             if (BingRule.ACTION_DONT_NOTIFY.equals(actionString)) {
              return null;
            }
          }
        }
        return mDefaultBingRule;
      }
    }
    return null;
  }
 else {
    return mDefaultBingRule;
  }
}

Fixed version (ground truth):
/** 
 * Returns the first notifiable bing rule which fulfills its condition with this event.
 * @param event the event
 * @return the first matched bing rule, null if none
 */
public BingRule fulfilledBingRule(Event event){
  if (null == event) {
    return null;
  }
  if (!isReady) {
    return null;
  }
  if ((null != event.userId) && (event.userId.equals(mMyUserId))) {
    return null;
  }
  if (mRules != null) {
    for (    BingRule bingRule : mRules) {
      if (bingRule.isEnabled) {
        Boolean isFullfilled=false;
        if (BingRule.RULE_ID_CONTAIN_USER_NAME.equals(bingRule.ruleId) || BingRule.RULE_ID_CONTAIN_DISPLAY_NAME.equals(bingRule.ruleId)) {
          if (event.EVENT_TYPE_MESSAGE.equals(event.type)) {
            Message message=JsonUtils.toMessage(event.content);
            MyUser myUser=mSession.getMyUser();
            String pattern=myUser.displayname;
            if (BingRule.RULE_ID_CONTAIN_USER_NAME.equals(bingRule.ruleId)) {
              pattern=mMyUserId.substring(1,mMyUserId.indexOf("String_Node_Str"));
            }
            if (!TextUtils.isEmpty(pattern)) {
              isFullfilled=caseInsensitiveFind(pattern,message.body);
            }
          }
        }
 else         if (BingRule.RULE_ID_FALLBACK.equals(bingRule.ruleId)) {
          isFullfilled=true;
        }
 else {
          isFullfilled=eventMatchesConditions(event,bingRule.conditions);
        }
        if (isFullfilled) {
          return bingRule;
        }
      }
    }
    return null;
  }
 else {
    return mDefaultBingRule;
  }
}
Program: 32196
Project: 32196
Buggy source:
private void buildRules(BingRulesResponse bingRulesResponse){
  mRules.clear();
  updateRules(bingRulesResponse.global);
}

Fixed version (ground truth):
private void buildRules(BingRulesResponse bingRulesResponse){
  updateRules(bingRulesResponse.global);
}
Program: 32197
Project: 32197
Buggy source:
public BingRulesManager(MXSession session){
  mApiClient=session.getBingRulesApiClient();
  mMyUserId=session.getCredentials().userId;
  mDataHandler=session.getDataHandler();
}

Fixed version (ground truth):
public BingRulesManager(MXSession session){
  mSession=session;
  mApiClient=session.getBingRulesApiClient();
  mMyUserId=session.getCredentials().userId;
  mDataHandler=session.getDataHandler();
}
Program: 32198
Project: 32198
Buggy source:
/** 
 * Default constructor.
 * @param apiClient API client to make the events API calls
 * @param listener a listener to inform
 */
public EventsThread(EventsRestClient apiClient,EventsThreadListener listener,NetworkConnectivityReceiver networkConnectivityReceiver){
  super("String_Node_Str");
  mApiClient=apiClient;
  mListener=listener;
  mNetworkConnectivityReceiver=networkConnectivityReceiver;
}

Fixed version (ground truth):
/** 
 * Default constructor.
 * @param apiClient API client to make the events API calls
 * @param listener a listener to inform
 */
public EventsThread(EventsRestClient apiClient,EventsThreadListener listener){
  super("String_Node_Str");
  mApiClient=apiClient;
  mListener=listener;
}