nus-yam/ex-repair huggingface dataset:
Program: 32094
Project: 32094
Buggy source:
/** 
 * Get the user's avatar URL.
 * @param userId the user id
 * @param callback the callback to return the URL on success
 */
public void avatarUrl(final String userId,final ApiCallback<String> callback){
  final String description="String_Node_Str" + userId;
  mApi.avatarUrl(userId,new RestAdapterCallback<User>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      avatarUrl(userId,callback);
    }
  }
){
    @Override public void success(    User user,    Response response){
      callback.onSuccess(user.getAvatarUrl());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Get the user's avatar URL.
 * @param userId the user id
 * @param callback the callback to return the URL on success
 */
public void avatarUrl(final String userId,final ApiCallback<String> callback){
  final String description="String_Node_Str" + userId;
  mApi.avatarUrl(userId,new RestAdapterCallback<User>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      avatarUrl(userId,callback);
    }
  }
){
    @Override public void success(    User user,    Response response){
      onEventSent();
      callback.onSuccess(user.getAvatarUrl());
    }
  }
);
}
Program: 32095
Project: 32095
Buggy source:
@Override public void success(ThreePidsResponse threePidsResponse,Response response){
  if (null != callback) {
    callback.onSuccess(threePidsResponse.threepids);
  }
}

Fixed version (ground truth):
@Override public void success(ThreePidsResponse threePidsResponse,Response response){
  onEventSent();
  if (null != callback) {
    callback.onSuccess(threePidsResponse.threepids);
  }
}
Program: 32096
Project: 32096
Buggy source:
/** 
 * Get the user's display name.
 * @param userId the user id
 * @param callback the callback to return the name on success
 */
public void displayname(final String userId,final ApiCallback<String> callback){
  final String description="String_Node_Str" + userId;
  mApi.displayname(userId,new RestAdapterCallback<User>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      displayname(userId,callback);
    }
  }
){
    @Override public void success(    User user,    Response response){
      callback.onSuccess(user.displayname);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Get the user's display name.
 * @param userId the user id
 * @param callback the callback to return the name on success
 */
public void displayname(final String userId,final ApiCallback<String> callback){
  final String description="String_Node_Str" + userId;
  mApi.displayname(userId,new RestAdapterCallback<User>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      displayname(userId,callback);
    }
  }
){
    @Override public void success(    User user,    Response response){
      onEventSent();
      callback.onSuccess(user.displayname);
    }
  }
);
}
Program: 32097
Project: 32097
Buggy source:
/** 
 * List all 3PIDs linked to the Matrix user account.
 * @param callback the asynchronous callback called with the response
 */
public void threePIDs(final ApiCallback<List<ThirdPartyIdentifier>> callback){
  final String description="String_Node_Str";
  mApi.threePIDs(new RestAdapterCallback<ThreePidsResponse>(description,mUnsentEventsManager,callback,null){
    @Override public void success(    ThreePidsResponse threePidsResponse,    Response response){
      if (null != callback) {
        callback.onSuccess(threePidsResponse.threepids);
      }
    }
    /** 
 * Called if there is a network error.
 * @param e the exception
 */
    public void onNetworkError(    Exception e){
      if (null != callback) {
        callback.onNetworkError(e);
      }
    }
    /** 
 * Called in case of a Matrix error.
 * @param e the Matrix error
 */
    public void onMatrixError(    MatrixError e){
      if (null != callback) {
        callback.onMatrixError(e);
      }
    }
    /** 
 * Called for some other type of error.
 * @param e the exception
 */
    public void onUnexpectedError(    Exception e){
      if (null != callback) {
        callback.onUnexpectedError(e);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * List all 3PIDs linked to the Matrix user account.
 * @param callback the asynchronous callback called with the response
 */
public void threePIDs(final ApiCallback<List<ThirdPartyIdentifier>> callback){
  final String description="String_Node_Str";
  mApi.threePIDs(new RestAdapterCallback<ThreePidsResponse>(description,mUnsentEventsManager,callback,null){
    @Override public void success(    ThreePidsResponse threePidsResponse,    Response response){
      onEventSent();
      if (null != callback) {
        callback.onSuccess(threePidsResponse.threepids);
      }
    }
  }
);
}
Program: 32098
Project: 32098
Buggy source:
/** 
 * Request an email validation token.
 * @param address the email address
 * @param clientSecret the client secret number
 * @param attempt the attemp count
 * @param nextLink the next link.
 * @param callback the callback.
 */
public void requestValidationToken(final String address,final String clientSecret,final int attempt,final String nextLink,final ApiCallback<RequestEmailValidationResponse> callback){
  final String description="String_Node_Str";
  mApi.requestEmailValidation(clientSecret,address,new Integer(attempt),nextLink,new RestAdapterCallback<RequestEmailValidationResponse>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      requestValidationToken(address,clientSecret,attempt,nextLink,callback);
    }
  }
){
    @Override public void success(    RequestEmailValidationResponse requestEmailValidationResponse,    Response response){
      requestEmailValidationResponse.email=address;
      requestEmailValidationResponse.clientSecret=clientSecret;
      requestEmailValidationResponse.sendAttempt=attempt;
      callback.onSuccess(requestEmailValidationResponse);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request an email validation token.
 * @param address the email address
 * @param clientSecret the client secret number
 * @param attempt the attemp count
 * @param nextLink the next link.
 * @param callback the callback.
 */
public void requestValidationToken(final String address,final String clientSecret,final int attempt,final String nextLink,final ApiCallback<RequestEmailValidationResponse> callback){
  final String description="String_Node_Str";
  mApi.requestEmailValidation(clientSecret,address,new Integer(attempt),nextLink,new RestAdapterCallback<RequestEmailValidationResponse>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      requestValidationToken(address,clientSecret,attempt,nextLink,callback);
    }
  }
){
    @Override public void success(    RequestEmailValidationResponse requestEmailValidationResponse,    Response response){
      onEventSent();
      requestEmailValidationResponse.email=address;
      requestEmailValidationResponse.clientSecret=clientSecret;
      requestEmailValidationResponse.sendAttempt=attempt;
      callback.onSuccess(requestEmailValidationResponse);
    }
  }
);
}
Program: 32100
Project: 32100
Buggy source:
/** 
 * A network connection has been retrieved.
 */
public void onNetworkAvailable(){
  Log.d(LOG_TAG,"String_Node_Str");
  if (mIsNetworkSuspended) {
    mIsNetworkSuspended=false;
    if (mPaused) {
      Log.d(LOG_TAG,"String_Node_Str");
    }
 else {
      Log.d(LOG_TAG,"String_Node_Str");
      mIsCatchingUp=false;
synchronized (mSyncObject) {
        mSyncObject.notify();
      }
    }
  }
 else {
    Log.d(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * A network connection has been retrieved.
 */
private void onNetworkAvailable(){
  Log.d(LOG_TAG,"String_Node_Str");
  if (mIsNetworkSuspended) {
    mIsNetworkSuspended=false;
    if (mPaused) {
      Log.d(LOG_TAG,"String_Node_Str");
    }
 else {
      Log.d(LOG_TAG,"String_Node_Str");
      mIsCatchingUp=false;
synchronized (mSyncObject) {
        mSyncObject.notify();
      }
    }
  }
 else {
    Log.d(LOG_TAG,"String_Node_Str");
  }
}
Program: 32101
Project: 32101
Buggy source:
/** 
 * Add a tag to a room. Use this method to update the order of an existing tag.
 * @param tag the new tag to add to the room.
 * @param order the order.
 * @param callback the operation callback
 */
private void addTag(String tag,Double order,final ApiCallback<Void> callback){
  if ((null != tag) && (null != order)) {
    mDataHandler.getDataRetriever().getRoomsRestClient().addTag(getRoomId(),tag,order,callback);
  }
 else {
    if (null != callback) {
      callback.onUnexpectedError(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Add a tag to a room. Use this method to update the order of an existing tag.
 * @param tag the new tag to add to the room.
 * @param order the order.
 * @param callback the operation callback
 */
private void addTag(String tag,Double order,final ApiCallback<Void> callback){
  if ((null != tag) && (null != order)) {
    mDataHandler.getDataRetriever().getRoomsRestClient().addTag(getRoomId(),tag,order,callback);
  }
 else {
    if (null != callback) {
      callback.onSuccess(null);
    }
  }
}
Program: 32102
Project: 32102
Buggy source:
/** 
 * Remove a tag to a room.
 * @param tag the new tag to add to the room.
 * @param callback the operation callback.
 */
private void removeTag(String tag,final ApiCallback<Void> callback){
  if (null != tag) {
    mDataHandler.getDataRetriever().getRoomsRestClient().removeTag(getRoomId(),tag,callback);
  }
 else {
    if (null != callback) {
      callback.onUnexpectedError(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove a tag to a room.
 * @param tag the new tag to add to the room.
 * @param callback the operation callback.
 */
private void removeTag(String tag,final ApiCallback<Void> callback){
  if (null != tag) {
    mDataHandler.getDataRetriever().getRoomsRestClient().removeTag(getRoomId(),tag,callback);
  }
 else {
    if (null != callback) {
      callback.onSuccess(null);
    }
  }
}
Program: 32103
Project: 32103
Buggy source:
/** 
 * Check if an event matches a conditions set
 * @param event the evnt to test
 * @param conditions the conditions set
 * @return true if the event matches all the conditions set.
 */
private boolean eventMatchesConditions(Event event,List<Condition> conditions){
  if ((conditions != null) && (event != null)) {
    for (    Condition condition : conditions) {
      if (condition instanceof EventMatchCondition) {
        if (!((EventMatchCondition)condition).isSatisfied(event)) {
          return false;
        }
      }
 else       if (condition instanceof ContainsDisplayNameCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if ((null != room) && (null != room.getMember(mMyUserId))) {
            String myDisplayName=room.getMember(mMyUserId).displayname;
            if (!((ContainsDisplayNameCondition)condition).isSatisfied(event,myDisplayName)) {
              return false;
            }
          }
        }
      }
 else       if (condition instanceof RoomMemberCountCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if (!((RoomMemberCountCondition)condition).isSatisfied(room)) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Check if an event matches a conditions set
 * @param event the evnt to test
 * @param conditions the conditions set
 * @return true if the event matches all the conditions set.
 */
private boolean eventMatchesConditions(Event event,List<Condition> conditions){
  try {
    if ((conditions != null) && (event != null)) {
      for (      Condition condition : conditions) {
        if (condition instanceof EventMatchCondition) {
          if (!((EventMatchCondition)condition).isSatisfied(event)) {
            return false;
          }
        }
 else         if (condition instanceof ContainsDisplayNameCondition) {
          if (event.roomId != null) {
            Room room=mDataHandler.getRoom(event.roomId,false);
            if ((null != room) && (null != room.getMember(mMyUserId))) {
              String myDisplayName=room.getMember(mMyUserId).displayname;
              if (!((ContainsDisplayNameCondition)condition).isSatisfied(event,myDisplayName)) {
                return false;
              }
            }
          }
        }
 else         if (condition instanceof RoomMemberCountCondition) {
          if (event.roomId != null) {
            Room room=mDataHandler.getRoom(event.roomId,false);
            if (!((RoomMemberCountCondition)condition).isSatisfied(room)) {
              return false;
            }
          }
        }
      }
    }
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    return false;
  }
  return true;
}
Program: 32105
Project: 32105
Buggy source:
/** 
 * Retrieve a room Id by its alias.
 * @param roomAlias the room alias
 * @param callback the asynchronous callback
 */
public void roomIdByAlias(final String roomAlias,final ApiCallback<String> callback){
  String roomId=null;
  Collection<Room> rooms=getStore().getRooms();
  for (  Room room : rooms) {
    if (TextUtils.equals(room.getState().alias,roomAlias)) {
      roomId=room.getRoomId();
      break;
    }
 else {
      List<String> aliases=room.getState().getAliases();
      if (null != aliases) {
        for (        String alias : aliases) {
          if (TextUtils.equals(alias,roomAlias)) {
            roomId=room.getRoomId();
            break;
          }
        }
      }
      if (null != roomId) {
        break;
      }
    }
  }
  if (null != roomId) {
    final String fRoomId=roomId;
    Handler handler=new Handler(Looper.getMainLooper());
    handler.post(new Runnable(){
      @Override public void run(){
        callback.onSuccess(fRoomId);
      }
    }
);
  }
 else {
    mRoomsRestClient.getRoomIdByAlias(roomAlias,new ApiCallback<RoomAliasDescription>(){
      @Override public void onSuccess(      RoomAliasDescription info){
        callback.onSuccess(info.room_id);
      }
      @Override public void onNetworkError(      Exception e){
        callback.onNetworkError(e);
      }
      @Override public void onMatrixError(      MatrixError e){
        callback.onMatrixError(e);
      }
      @Override public void onUnexpectedError(      Exception e){
        callback.onUnexpectedError(e);
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Retrieve a room Id by its alias.
 * @param roomAlias the room alias
 * @param callback the asynchronous callback
 */
public void roomIdByAlias(final String roomAlias,final ApiCallback<String> callback){
  String roomId=null;
  Collection<Room> rooms=getStore().getRooms();
  for (  Room room : rooms) {
    if (TextUtils.equals(room.getState().alias,roomAlias)) {
      roomId=room.getRoomId();
      break;
    }
 else {
      List<String> aliases=room.getState().getAliases();
      for (      String alias : aliases) {
        if (TextUtils.equals(alias,roomAlias)) {
          roomId=room.getRoomId();
          break;
        }
      }
      if (null != roomId) {
        break;
      }
    }
  }
  if (null != roomId) {
    final String fRoomId=roomId;
    Handler handler=new Handler(Looper.getMainLooper());
    handler.post(new Runnable(){
      @Override public void run(){
        callback.onSuccess(fRoomId);
      }
    }
);
  }
 else {
    mRoomsRestClient.getRoomIdByAlias(roomAlias,new ApiCallback<RoomAliasDescription>(){
      @Override public void onSuccess(      RoomAliasDescription info){
        callback.onSuccess(info.room_id);
      }
      @Override public void onNetworkError(      Exception e){
        callback.onNetworkError(e);
      }
      @Override public void onMatrixError(      MatrixError e){
        callback.onMatrixError(e);
      }
      @Override public void onUnexpectedError(      Exception e){
        callback.onUnexpectedError(e);
      }
    }
);
  }
}
Program: 32106
Project: 32106
Buggy source:
/** 
 * Try to add an alias to the aliases list.
 * @param alias the alias to add.
 * @param callback the the async callback
 */
public void addAlias(final String alias,final ApiCallback<Void> callback){
  final ArrayList<String> updatedAliasesList=new ArrayList<>(getAliases());
  if (TextUtils.isEmpty(alias) || (updatedAliasesList.indexOf(alias) >= 0)) {
    if (null != callback) {
      callback.onSuccess(null);
    }
    return;
  }
  mDataHandler.getDataRetriever().getRoomsRestClient().setRoomIdByAlias(getRoomId(),alias,new RoomInfoUpdateCallback<Void>(callback){
    @Override public void onSuccess(    Void info){
      ArrayList<String> aliases=new ArrayList<>(getAliases());
      aliases.add(alias);
      getState().aliases=aliases;
      super.onSuccess(info);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Try to add an alias to the aliases list.
 * @param alias the alias to add.
 * @param callback the the async callback
 */
public void addAlias(final String alias,final ApiCallback<Void> callback){
  final ArrayList<String> updatedAliasesList=new ArrayList<>(getAliases());
  if (TextUtils.isEmpty(alias) || (updatedAliasesList.indexOf(alias) >= 0)) {
    if (null != callback) {
      callback.onSuccess(null);
    }
    return;
  }
  mDataHandler.getDataRetriever().getRoomsRestClient().setRoomIdByAlias(getRoomId(),alias,new RoomInfoUpdateCallback<Void>(callback){
    @Override public void onSuccess(    Void info){
      getState().addAlias(alias);
      super.onSuccess(info);
    }
  }
);
}
Program: 32107
Project: 32107
Buggy source:
/** 
 * Remove a room alias.
 * @param alias the alias to remove
 * @param callback the async callback
 */
public void removeAlias(final String alias,final ApiCallback<Void> callback){
  final ArrayList<String> updatedAliasesList=new ArrayList<>(getAliases());
  if (TextUtils.isEmpty(alias) || (updatedAliasesList.indexOf(alias) < 0)) {
    if (null != callback) {
      callback.onSuccess(null);
    }
    return;
  }
  mDataHandler.getDataRetriever().getRoomsRestClient().removeRoomAlias(alias,new RoomInfoUpdateCallback<Void>(callback){
    @Override public void onSuccess(    Void info){
      ArrayList<String> aliases=new ArrayList<>(getAliases());
      aliases.remove(alias);
      getState().aliases=aliases;
      super.onSuccess(info);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Remove a room alias.
 * @param alias the alias to remove
 * @param callback the async callback
 */
public void removeAlias(final String alias,final ApiCallback<Void> callback){
  final ArrayList<String> updatedAliasesList=new ArrayList<>(getAliases());
  if (TextUtils.isEmpty(alias) || (updatedAliasesList.indexOf(alias) < 0)) {
    if (null != callback) {
      callback.onSuccess(null);
    }
    return;
  }
  mDataHandler.getDataRetriever().getRoomsRestClient().removeRoomAlias(alias,new RoomInfoUpdateCallback<Void>(callback){
    @Override public void onSuccess(    Void info){
      getState().removeAlias(alias);
      super.onSuccess(info);
    }
  }
);
}
Program: 32108
Project: 32108
Buggy source:
/** 
 * Provides the aliases for any known domains
 * @return the aliases list
 */
public List<String> getAliases(){
  if (null == mMergedAliasesList) {
    mMergedAliasesList=new ArrayList<>();
    for (    String url : mAliasesByDomain.keySet()) {
      mMergedAliasesList.addAll(mAliasesByDomain.get(url));
    }
  }
  return mMergedAliasesList;
}

Fixed version (ground truth):
/** 
 * Provides the aliases for any known domains
 * @return the aliases list
 */
public List<String> getAliases(){
  if (null == mMergedAliasesList) {
    mMergedAliasesList=new ArrayList<>();
    for (    String url : mAliasesByDomain.keySet()) {
      mMergedAliasesList.addAll(mAliasesByDomain.get(url));
    }
    if (null != aliases) {
      for (      String anAlias : aliases) {
        if (mMergedAliasesList.indexOf(anAlias) < 0) {
          mMergedAliasesList.add(anAlias);
        }
      }
    }
  }
  return mMergedAliasesList;
}
Program: 32110
Project: 32110
Buggy source:
/** 
 * Redact an event from its event id.
 * @param eventId the event id.
 */
protected void redactEvent(String eventId){
  mMatrixMessagesFragment.redact(eventId,new ApiCallback<Event>(){
    @Override public void onSuccess(    Event redactedEvent){
      Event redacterEvent=new Event();
      redacterEvent.roomId=redactedEvent.roomId;
      redacterEvent.redacts=redactedEvent.eventId;
      redacterEvent.type=Event.EVENT_TYPE_REDACTION;
      onEvent(redacterEvent,EventTimeline.Direction.FORWARDS,mRoom.getLiveState());
      if (null != mEventSendingListener) {
        try {
          mEventSendingListener.onMessageRedacted(redactedEvent);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
    private void onError(){
      Toast.makeText(getActivity(),getActivity().getString(R.string.could_not_redact),Toast.LENGTH_SHORT).show();
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    MatrixError e){
      onError();
    }
    @Override public void onUnexpectedError(    Exception e){
      onError();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Redact an event from its event id.
 * @param eventId the event id.
 */
protected void redactEvent(String eventId){
  mMatrixMessagesFragment.redact(eventId,new ApiCallback<Event>(){
    @Override public void onSuccess(    Event redactedEvent){
      Event redacterEvent=new Event();
      redacterEvent.roomId=redactedEvent.roomId;
      redacterEvent.redacts=redactedEvent.eventId;
      redacterEvent.type=Event.EVENT_TYPE_REDACTION;
      onEvent(redacterEvent,EventTimeline.Direction.FORWARDS,mRoom.getLiveState());
      if (null != mEventSendingListener) {
        try {
          mEventSendingListener.onMessageRedacted(redactedEvent);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
    private void onError(){
      if (null != getActivity()) {
        Toast.makeText(getActivity(),getActivity().getString(R.string.could_not_redact),Toast.LENGTH_SHORT).show();
      }
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    MatrixError e){
      onError();
    }
    @Override public void onUnexpectedError(    Exception e){
      onError();
    }
  }
);
}
Program: 32113
Project: 32113
Buggy source:
/** 
 * @return the list of third party identifiers
 */
public List<ThirdPartyIdentifier> getThirdPartyIdentifiers(){
  List<ThirdPartyIdentifier> list;
  if (mAre3PIdsLoaded) {
    list=mThirdPartyIdentifiers;
  }
 else {
    list=mDataHandler.getStore().thirdPartyIdentifiers();
  }
  if (null == list) {
    list=new ArrayList<ThirdPartyIdentifier>();
  }
  return list;
}

Fixed version (ground truth):
/** 
 * @return the list of third party identifiers
 */
public List<ThirdPartyIdentifier> getThirdPartyIdentifiers(){
  List<ThirdPartyIdentifier> list;
  if (mAre3PIdsLoaded) {
    list=mThirdPartyIdentifiers;
  }
 else {
    list=mDataHandler.getStore().thirdPartyIdentifiers();
  }
  if (null == list) {
    list=new ArrayList<>();
  }
  return list;
}
Program: 32114
Project: 32114
Buggy source:
/** 
 * Refresh the user data if it is required
 * @param skipPendingTest true to do not check if the refreshes started (private use)
 * @param callback callback when the job is done.
 */
public void refreshUserInfos(boolean skipPendingTest,final ApiCallback<Void> callback){
  if (!skipPendingTest) {
    boolean isPending;
synchronized (this) {
      isPending=(null != mRefreshListeners);
      if (null == mRefreshListeners) {
        mRefreshListeners=new ArrayList<ApiCallback<Void>>();
      }
      if (null != callback) {
        mRefreshListeners.add(callback);
      }
    }
    if (isPending) {
      return;
    }
  }
  if (!mIsDislayNameRefreshed) {
    refreshUserDisplayname();
    return;
  }
  if (!mIsAvatarRefreshed) {
    refreshUserAvatarUrl();
    return;
  }
  if (!mAre3PIdsLoaded) {
    refreshThirdPartyIdentifiers();
    return;
  }
synchronized (this) {
    if (null != mRefreshListeners) {
      for (      ApiCallback<Void> listener : mRefreshListeners) {
        try {
          listener.onSuccess(null);
        }
 catch (        Exception e) {
        }
      }
    }
    mRefreshListeners=null;
  }
}

Fixed version (ground truth):
/** 
 * Refresh the user data if it is required
 * @param skipPendingTest true to do not check if the refreshes started (private use)
 * @param callback callback when the job is done.
 */
public void refreshUserInfos(boolean skipPendingTest,final ApiCallback<Void> callback){
  if (!skipPendingTest) {
    boolean isPending;
synchronized (this) {
      isPending=(null != mRefreshListeners);
      if (null == mRefreshListeners) {
        mRefreshListeners=new ArrayList<>();
      }
      if (null != callback) {
        mRefreshListeners.add(callback);
      }
    }
    if (isPending) {
      return;
    }
  }
  if (!mIsDisplayNameRefreshed) {
    refreshUserDisplayname();
    return;
  }
  if (!mIsAvatarRefreshed) {
    refreshUserAvatarUrl();
    return;
  }
  if (!mAre3PIdsLoaded) {
    refreshThirdPartyIdentifiers();
    return;
  }
synchronized (this) {
    if (null != mRefreshListeners) {
      for (      ApiCallback<Void> listener : mRefreshListeners) {
        try {
          listener.onSuccess(null);
        }
 catch (        Exception e) {
        }
      }
    }
    mRefreshListeners=null;
  }
}
Program: 32115
Project: 32115
Buggy source:
/** 
 * @return the list of linked emails
 */
public List<String> getlinkedEmails(){
  List<ThirdPartyIdentifier> list=getThirdPartyIdentifiers();
  ArrayList<String> emails=new ArrayList<String>();
  for (  ThirdPartyIdentifier identier : list) {
    emails.add(identier.address);
  }
  return emails;
}

Fixed version (ground truth):
/** 
 * @return the list of linked emails
 */
public List<String> getlinkedEmails(){
  List<ThirdPartyIdentifier> list=getThirdPartyIdentifiers();
  ArrayList<String> emails=new ArrayList<>();
  for (  ThirdPartyIdentifier identifier : list) {
    emails.add(identifier.address);
  }
  return emails;
}
Program: 32116
Project: 32116
Buggy source:
/** 
 * Refresh the displayname.
 */
private void refreshUserDisplayname(){
  mDataHandler.getProfileRestClient().displayname(user_id,new SimpleApiCallback<String>(){
    @Override public void onSuccess(    String aDisplayname){
      if (mDataHandler.isAlive()) {
        displayname=aDisplayname;
        mDataHandler.getStore().setDisplayName(aDisplayname);
        mIsDislayNameRefreshed=true;
        refreshUserInfos(true,null);
      }
    }
    private void onError(){
      if (mDataHandler.isAlive()) {
        mUiHandler.postDelayed(new Runnable(){
          @Override public void run(){
            refreshUserDisplayname();
          }
        }
,1 * 1000);
      }
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    final MatrixError e){
      mIsDislayNameRefreshed=true;
      refreshUserInfos(true,null);
    }
    @Override public void onUnexpectedError(    final Exception e){
      mIsDislayNameRefreshed=true;
      refreshUserInfos(true,null);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Refresh the displayname.
 */
private void refreshUserDisplayname(){
  mDataHandler.getProfileRestClient().displayname(user_id,new SimpleApiCallback<String>(){
    @Override public void onSuccess(    String aDisplayname){
      if (mDataHandler.isAlive()) {
        displayname=aDisplayname;
        mDataHandler.getStore().setDisplayName(aDisplayname);
        mIsDisplayNameRefreshed=true;
        refreshUserInfos(true,null);
      }
    }
    private void onError(){
      if (mDataHandler.isAlive()) {
        mUiHandler.postDelayed(new Runnable(){
          @Override public void run(){
            refreshUserDisplayname();
          }
        }
,1 * 1000);
      }
    }
    @Override public void onNetworkError(    Exception e){
      onError();
    }
    @Override public void onMatrixError(    final MatrixError e){
      mIsDisplayNameRefreshed=true;
      refreshUserInfos(true,null);
    }
    @Override public void onUnexpectedError(    final Exception e){
      mIsDisplayNameRefreshed=true;
      refreshUserInfos(true,null);
    }
  }
);
}
Program: 32117
Project: 32117
Buggy source:
/** 
 * Set the event listener to send back events to. This is typically the DataHandler for dispatching the events to listeners.
 * @param dataHandler should be the main data handler for dispatching back events to registered listeners.
 */
public void setDataHandler(MXDataHandler dataHandler){
  mDataHandler=dataHandler;
  for (  IMXEventListener listener : mPendingListeners) {
    mDataHandler.addListener(listener);
  }
}

Fixed version (ground truth):
/** 
 * Set the event listener to send back events to. This is typically the DataHandler for dispatching the events to listeners.
 * @param dataHandler should be the main data handler for dispatching back events to registered listeners.
 */
public void setDataHandler(MXDataHandler dataHandler){
  mDataHandler=dataHandler;
  for (  IMXEventListener listener : getPendingListeners()) {
    mDataHandler.addListener(listener);
  }
}
Program: 32118
Project: 32118
Buggy source:
/** 
 * Remove an event listener.
 * @param eventListener the event listener to remove
 */
public void removeEventListener(IMXEventListener eventListener){
  if (null != mDataHandler) {
    mDataHandler.removeListener(mEventListeners.get(eventListener));
  }
 else {
    mPendingListeners.remove(mEventListeners.get(eventListener));
  }
  mEventListeners.remove(eventListener);
}

Fixed version (ground truth):
/** 
 * Remove an event listener.
 * @param eventListener the event listener to remove
 */
public void removeEventListener(IMXEventListener eventListener){
  if (null != mDataHandler) {
    mDataHandler.removeListener(getEventListeners().get(eventListener));
  }
 else {
    getPendingListeners().remove(getEventListeners().get(eventListener));
  }
  getEventListeners().remove(eventListener);
}
Program: 32119
Project: 32119
Buggy source:
/** 
 * Clone an user into this instance
 * @param user the user to clone.
 */
protected void clone(User user){
  if (user != null) {
    user_id=user.user_id;
    displayname=user.displayname;
    avatar_url=user.avatar_url;
    presence=user.presence;
    currently_active=user.currently_active;
    lastActiveAgo=user.lastActiveAgo;
    statusMsg=user.statusMsg;
    mIsPresenceRefreshed=user.mIsPresenceRefreshed;
    mLastPresenceTs=user.mLastPresenceTs;
    mEventListeners=new HashMap<>(user.mEventListeners);
    mDataHandler=user.mDataHandler;
    mPendingListeners=user.mPendingListeners;
  }
}

Fixed version (ground truth):
/** 
 * Clone an user into this instance
 * @param user the user to clone.
 */
protected void clone(User user){
  if (user != null) {
    user_id=user.user_id;
    displayname=user.displayname;
    avatar_url=user.avatar_url;
    presence=user.presence;
    currently_active=user.currently_active;
    lastActiveAgo=user.lastActiveAgo;
    statusMsg=user.statusMsg;
    mIsPresenceRefreshed=user.mIsPresenceRefreshed;
    mLastPresenceTs=user.mLastPresenceTs;
    mEventListeners=new HashMap<>(user.getEventListeners());
    mDataHandler=user.mDataHandler;
    mPendingListeners=user.getPendingListeners();
  }
}
Program: 32120
Project: 32120
Buggy source:
/** 
 * Add an event listener to this room. Only events relative to the room will come down.
 * @param eventListener the event listener to add
 */
public void addEventListener(final IMXEventListener eventListener){
  IMXEventListener globalListener=new MXEventListener(){
    @Override public void onPresenceUpdate(    Event event,    User user){
      if (user.user_id.equals(user_id)) {
        eventListener.onPresenceUpdate(event,user);
      }
    }
  }
;
  mEventListeners.put(eventListener,globalListener);
  if (null != mDataHandler) {
    mDataHandler.addListener(globalListener);
  }
 else {
    mPendingListeners.add(globalListener);
  }
}

Fixed version (ground truth):
/** 
 * Add an event listener to this room. Only events relative to the room will come down.
 * @param eventListener the event listener to add
 */
public void addEventListener(final IMXEventListener eventListener){
  IMXEventListener globalListener=new MXEventListener(){
    @Override public void onPresenceUpdate(    Event event,    User user){
      if (user.user_id.equals(user_id)) {
        eventListener.onPresenceUpdate(event,user);
      }
    }
  }
;
  getEventListeners().put(eventListener,globalListener);
  if (null != mDataHandler) {
    mDataHandler.addListener(globalListener);
  }
 else {
    getPendingListeners().add(globalListener);
  }
}
Program: 32121
Project: 32121
Buggy source:
void addListener(MXCallListener callListener);

Fixed version (ground truth):
/** 
 * Add a listener to the call manager.
 */
void addListener(MXCallListener callListener);
Program: 32122
Project: 32122
Buggy source:
/** 
 * Warn that the call isEnded
 */
void onCallEnd();

Fixed version (ground truth):
/** 
 * Warn that the call is ended
 * @param aReasonId the reason of the call ending
 */
void onCallEnd(final int aReasonId);
Program: 32123
Project: 32123
Buggy source:
/** 
 * Toogle the speaker
 */
void toggleSpeaker();

Fixed version (ground truth):
/** 
 * Toggle the speaker
 */
void toggleSpeaker();
Program: 32124
Project: 32124
Buggy source:
void removeListener(MXCallListener callListener);

Fixed version (ground truth):
/** 
 * Remove a listener from the call manager.
 */
void removeListener(MXCallListener callListener);
Program: 32125
Project: 32125
Buggy source:
/** 
 * The callview must be added to a layout
 * @param callview the callview
 */
void onViewLoading(View callview);

Fixed version (ground truth):
/** 
 * The callview must be added to a layout
 * @param callView the callview
 */
void onViewLoading(View callView);
Program: 32126
Project: 32126
Buggy source:
/** 
 * Prepare a call reception.
 * @param callInviteParams the invitation Event content
 * @param callId the call ID
 * @param aLocalVideoPosition position of the local video attendee
 */
void prepareIncomingCall(JsonObject callInviteParams,String callId,VideoLayoutConfiguration aLocalVideoPosition);

Fixed version (ground truth):
/** 
 * Prepare a call reception.
 * @param aCallInviteParams the invitation Event content
 * @param aCallId the call ID
 * @param aLocalVideoPosition position of the local video attendee
 */
void prepareIncomingCall(JsonObject aCallInviteParams,String aCallId,VideoLayoutConfiguration aLocalVideoPosition);
Program: 32127
Project: 32127
Buggy source:
/** 
 * Defines the call type
 */
void setIsVideo(boolean isVideo);

Fixed version (ground truth):
/** 
 * Set the call type: video or voice
 * @param isVideo true for video call, false for VoIP
 */
void setIsVideo(boolean isVideo);
Program: 32128
Project: 32128
Buggy source:
@Override public void run(){
  onCallEnd();
}

Fixed version (ground truth):
@Override public void run(){
  dispatchOnCallEnd(END_CALL_REASON_USER_HIMSELF);
}
Program: 32129
Project: 32129
Buggy source:
/** 
 * send an hang up event
 * @param reason the reason
 */
protected void sendHangup(String reason){
  JsonObject hangupContent=new JsonObject();
  hangupContent.add("String_Node_Str",new JsonPrimitive(0));
  hangupContent.add("String_Node_Str",new JsonPrimitive(this.mCallId));
  if (!TextUtils.isEmpty(reason)) {
    hangupContent.add("String_Node_Str",new JsonPrimitive(reason));
  }
  Event event=new Event(Event.EVENT_TYPE_CALL_HANGUP,hangupContent,mSession.getCredentials().userId,mRoom.getRoomId());
  if (null != event) {
    mUIThreadHandler.post(new Runnable(){
      @Override public void run(){
        onCallEnd();
      }
    }
);
    mRoom.sendEvent(event,new ApiCallback<Void>(){
      @Override public void onSuccess(      Void info){
      }
      @Override public void onNetworkError(      Exception e){
      }
      @Override public void onMatrixError(      MatrixError e){
      }
      @Override public void onUnexpectedError(      Exception e){
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * send an hang up event
 * @param reason the reason
 */
protected void sendHangup(String reason){
  JsonObject hangupContent=new JsonObject();
  hangupContent.add("String_Node_Str",new JsonPrimitive(0));
  hangupContent.add("String_Node_Str",new JsonPrimitive(this.mCallId));
  if (!TextUtils.isEmpty(reason)) {
    hangupContent.add("String_Node_Str",new JsonPrimitive(reason));
  }
  Event event=new Event(Event.EVENT_TYPE_CALL_HANGUP,hangupContent,mSession.getCredentials().userId,mRoom.getRoomId());
  if (null != event) {
    mUIThreadHandler.post(new Runnable(){
      @Override public void run(){
        dispatchOnCallEnd(END_CALL_REASON_USER_HIMSELF);
      }
    }
);
    mRoom.sendEvent(event,new ApiCallback<Void>(){
      @Override public void onSuccess(      Void info){
      }
      @Override public void onNetworkError(      Exception e){
      }
      @Override public void onMatrixError(      MatrixError e){
      }
      @Override public void onUnexpectedError(      Exception e){
      }
    }
);
  }
}
Program: 32130
Project: 32130
Buggy source:
/** 
 * Toogle the speaker
 */
public void toggleSpeaker(){
  AudioManager audioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  if (null != audioManager) {
    MXCallsManager.setSpeakerphoneOn(mContext,!audioManager.isSpeakerphoneOn());
  }
}

Fixed version (ground truth):
/** 
 * Toggle the speaker
 */
public void toggleSpeaker(){
  AudioManager audioManager=(AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
  if (null != audioManager) {
    MXCallsManager.setSpeakerphoneOn(mContext,!audioManager.isSpeakerphoneOn());
  }
}
Program: 32131
Project: 32131
Buggy source:
/** 
 * Prepare a call reception.
 * @param callInviteParams the invitation Event content
 * @param callId the call ID
 * @param aLocalVideoPosition position of the local video attendee
 */
public void prepareIncomingCall(JsonObject callInviteParams,String callId,VideoLayoutConfiguration aLocalVideoPosition){
}

Fixed version (ground truth):
/** 
 * Prepare a call reception.
 * @param aCallInviteParams the invitation Event content
 * @param aCallId the call ID
 * @param aLocalVideoPosition position of the local video attendee
 */
public void prepareIncomingCall(JsonObject aCallInviteParams,String aCallId,VideoLayoutConfiguration aLocalVideoPosition){
}
Program: 32132
Project: 32132
Buggy source:
/** 
 * dispatch the onViewReady event
 */
protected void dispatchAnsweredElsewhere(){
synchronized (LOG_TAG) {
    for (    MXCallListener listener : mxCallListeners) {
      try {
        listener.onCallAnsweredElsewhere();
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch the onCallAnsweredElsewhere event to the listeners.
 */
protected void dispatchAnsweredElsewhere(){
synchronized (LOG_TAG) {
    for (    MXCallListener listener : mxCallListeners) {
      try {
        listener.onCallAnsweredElsewhere();
      }
 catch (      Exception e) {
        Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      }
    }
  }
}
Program: 32133
Project: 32133
Buggy source:
public PieFractionView(Context context,AttributeSet attrs){
  super(context,attrs);
  int[] attrArray=new int[]{android.R.attr.layout_width,android.R.attr.layout_height};
  TypedArray typedArray=context.obtainStyledAttributes(attrs,attrArray);
  int width=typedArray.getDimensionPixelSize(0,0);
  int height=typedArray.getDimensionPixelSize(1,0);
  rectF=new RectF(0,0,width,height);
  paint=new Paint();
  powerColor=fillColor();
  restColor=getRestColor();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public PieFractionView(Context context,AttributeSet attrs){
  super(context,attrs);
  int[] attrArray=new int[]{android.R.attr.layout_width,android.R.attr.layout_height};
  TypedArray typedArray=context.obtainStyledAttributes(attrs,attrArray);
  int width=typedArray.getDimensionPixelSize(0,0);
  int height=typedArray.getDimensionPixelSize(1,0);
  rectF=new RectF(0,0,width,height);
  paint=new Paint();
  powerColor=fillColor();
  restColor=getRestColor();
}
Program: 32134
Project: 32134
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=mState.deepCopy();
  mCanBackPaginate=true;
  mIsBackPaginating=false;
  mIsForewardPaginating=false;
  if (null != mDataHandler.getDataRetriever()) {
    mDataHandler.getDataRetriever().cancelHistoryRequest(mRoomId);
  }
}

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=mState.deepCopy();
  mCanBackPaginate=true;
  mIsBackPaginating=false;
  mIsForewardPaginating=false;
  if ((null != mDataHandler) && (null != mDataHandler.getDataRetriever())) {
    mDataHandler.getDataRetriever().cancelHistoryRequest(mRoomId);
  }
}
Program: 32137
Project: 32137
Buggy source:
public BingRuleSet pushRules(){
  return mRulesSet;
}

Fixed version (ground truth):
/** 
 * @return the rules set
 */
public BingRuleSet pushRules(){
  return mRulesSet;
}
Program: 32138
Project: 32138
Buggy source:
public boolean isReady(){
  return mIsInitialized;
}

Fixed version (ground truth):
/** 
 * @return true if it is ready to be used (i.e initializedà
 */
public boolean isReady(){
  return mIsInitialized;
}
Program: 32139
Project: 32139
Buggy source:
private void addRoomRules(List<BingRule> rules){
  for (  BingRule rule : rules) {
    EventMatchCondition condition=new EventMatchCondition();
    condition.kind=Condition.KIND_EVENT_MATCH;
    condition.key="String_Node_Str";
    condition.pattern=rule.ruleId;
    rule.addCondition(condition);
    mRules.add(rule);
  }
}

Fixed version (ground truth):
/** 
 * Create a room EventMatchConditions list from a BingRule list
 * @param rules the BingRule list
 */
private void addRoomRules(List<BingRule> rules){
  if (null != rules) {
    for (    BingRule rule : rules) {
      EventMatchCondition condition=new EventMatchCondition();
      condition.kind=Condition.KIND_EVENT_MATCH;
      condition.key="String_Node_Str";
      condition.pattern=rule.ruleId;
      rule.addCondition(condition);
      mRules.add(rule);
    }
  }
}
Program: 32140
Project: 32140
Buggy source:
private boolean eventMatchesConditions(Event event,List<Condition> conditions){
  if ((conditions != null) && (event != null)) {
    for (    Condition condition : conditions) {
      if (condition instanceof EventMatchCondition) {
        if (!((EventMatchCondition)condition).isSatisfied(event)) {
          return false;
        }
      }
 else       if (condition instanceof ContainsDisplayNameCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if ((null != room) && (null != room.getMember(mMyUserId))) {
            String myDisplayName=room.getMember(mMyUserId).displayname;
            if (!((ContainsDisplayNameCondition)condition).isSatisfied(event,myDisplayName)) {
              return false;
            }
          }
        }
      }
 else       if (condition instanceof RoomMemberCountCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if (!((RoomMemberCountCondition)condition).isSatisfied(room)) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Check if an event matches a conditions set
 * @param event the evnt to test
 * @param conditions the conditions set
 * @return true if the event matches all the conditions set.
 */
private boolean eventMatchesConditions(Event event,List<Condition> conditions){
  if ((conditions != null) && (event != null)) {
    for (    Condition condition : conditions) {
      if (condition instanceof EventMatchCondition) {
        if (!((EventMatchCondition)condition).isSatisfied(event)) {
          return false;
        }
      }
 else       if (condition instanceof ContainsDisplayNameCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if ((null != room) && (null != room.getMember(mMyUserId))) {
            String myDisplayName=room.getMember(mMyUserId).displayname;
            if (!((ContainsDisplayNameCondition)condition).isSatisfied(event,myDisplayName)) {
              return false;
            }
          }
        }
      }
 else       if (condition instanceof RoomMemberCountCondition) {
        if (event.roomId != null) {
          Room room=mDataHandler.getRoom(event.roomId,false);
          if (!((RoomMemberCountCondition)condition).isSatisfied(room)) {
            return false;
          }
        }
      }
    }
  }
  return true;
}
Program: 32141
Project: 32141
Buggy source:
private void addSenderRules(List<BingRule> rules){
  for (  BingRule rule : rules) {
    EventMatchCondition condition=new EventMatchCondition();
    condition.kind=Condition.KIND_EVENT_MATCH;
    condition.key="String_Node_Str";
    condition.pattern=rule.ruleId;
    rule.addCondition(condition);
    mRules.add(rule);
  }
}

Fixed version (ground truth):
/** 
 * Create a sender EventMatchConditions list from a BingRule list
 * @param rules the BingRule list
 */
private void addSenderRules(List<BingRule> rules){
  if (null != rules) {
    for (    BingRule rule : rules) {
      EventMatchCondition condition=new EventMatchCondition();
      condition.kind=Condition.KIND_EVENT_MATCH;
      condition.key="String_Node_Str";
      condition.pattern=rule.ruleId;
      rule.addCondition(condition);
      mRules.add(rule);
    }
  }
}
Program: 32142
Project: 32142
Buggy source:
/** 
 * Build the internal build rules
 * @param bingRulesResponse
 */
public void buildRules(BingRulesResponse bingRulesResponse){
  updateRules(bingRulesResponse.global);
}

Fixed version (ground truth):
/** 
 * Build the internal build rules
 * @param bingRulesResponse
 */
public void buildRules(BingRulesResponse bingRulesResponse){
  if (null != bingRulesResponse) {
    updateRules(bingRulesResponse.global);
  }
}
Program: 32143
Project: 32143
Buggy source:
public BingRulesManager(MXSession session,NetworkConnectivityReceiver networkConnectivityReceiver){
  mSession=session;
  mApiClient=session.getBingRulesApiClient();
  mMyUserId=session.getCredentials().userId;
  mDataHandler=session.getDataHandler();
  mNetworkListener=new IMXNetworkEventListener(){
    @Override public void onNetworkConnectionUpdate(    boolean isConnected){
      if (isConnected && (null != mLoadRulesCallback)) {
        loadRules(mLoadRulesCallback);
      }
    }
  }
;
  mNetworkConnectivityReceiver=networkConnectivityReceiver;
  networkConnectivityReceiver.addEventListener(mNetworkListener);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param session the session
 * @param networkConnectivityReceiver the network events listener
 */
public BingRulesManager(MXSession session,NetworkConnectivityReceiver networkConnectivityReceiver){
  mSession=session;
  mApiClient=session.getBingRulesApiClient();
  mMyUserId=session.getCredentials().userId;
  mDataHandler=session.getDataHandler();
  mNetworkListener=new IMXNetworkEventListener(){
    @Override public void onNetworkConnectionUpdate(    boolean isConnected){
      if (isConnected && (null != mLoadRulesCallback)) {
        loadRules(mLoadRulesCallback);
      }
    }
  }
;
  mNetworkConnectivityReceiver=networkConnectivityReceiver;
  networkConnectivityReceiver.addEventListener(mNetworkListener);
}