nus-yam/ex-repair huggingface dataset:
Program: 32006
Project: 32006
Buggy source:
/** 
 * Invite some users to this room.
 * @param identifiers  the identifiers iterator
 * @param callback the callback for when done
 */
private void invite(final Iterator<String> identifiers,final ApiCallback<Void> callback){
  if (!identifiers.hasNext()) {
    callback.onSuccess(null);
    return;
  }
  final ApiCallback<Void> localCallback=new ApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      invite(identifiers,callback);
    }
    @Override public void onNetworkError(    Exception e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onNetworkError(e);
      }
    }
    @Override public void onMatrixError(    MatrixError e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onMatrixError(e);
      }
    }
    @Override public void onUnexpectedError(    Exception e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onUnexpectedError(e);
      }
    }
  }
;
  String identifier=identifiers.next();
  if (android.util.Patterns.EMAIL_ADDRESS.matcher(identifier).matches()) {
    mDataHandler.getDataRetriever().getRoomsRestClient().inviteByEmailToRoom(getRoomId(),identifier,localCallback);
  }
 else {
    mDataHandler.getDataRetriever().getRoomsRestClient().inviteUserToRoom(getRoomId(),identifier,localCallback);
  }
}

Fixed version (ground truth):
/** 
 * Invite some users to this room.
 * @param identifiers the identifiers iterator
 * @param callback    the callback for when done
 */
private void invite(final Iterator<String> identifiers,final ApiCallback<Void> callback){
  if (!identifiers.hasNext()) {
    callback.onSuccess(null);
    return;
  }
  final ApiCallback<Void> localCallback=new ApiCallback<Void>(){
    @Override public void onSuccess(    Void info){
      invite(identifiers,callback);
    }
    @Override public void onNetworkError(    Exception e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onNetworkError(e);
      }
    }
    @Override public void onMatrixError(    MatrixError e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onMatrixError(e);
      }
    }
    @Override public void onUnexpectedError(    Exception e){
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
      if (null != callback) {
        callback.onUnexpectedError(e);
      }
    }
  }
;
  String identifier=identifiers.next();
  if (android.util.Patterns.EMAIL_ADDRESS.matcher(identifier).matches()) {
    mDataHandler.getDataRetriever().getRoomsRestClient().inviteByEmailToRoom(getRoomId(),identifier,localCallback);
  }
 else {
    mDataHandler.getDataRetriever().getRoomsRestClient().inviteUserToRoom(getRoomId(),identifier,localCallback);
  }
}
Program: 32007
Project: 32007
Buggy source:
/** 
 * Handle the events of a joined room.
 * @param roomSync      the sync events list.
 * @param isInitialSync true if the room is initialized by a global initial sync.
 */
public void handleJoinedRoomSync(RoomSync roomSync,boolean isInitialSync){
  if (null != mOnInitialSyncCallback) {
    Log.d(LOG_TAG,"String_Node_Str" + getRoomId());
  }
 else {
    Log.d(LOG_TAG,"String_Node_Str" + getRoomId());
  }
  mIsSyncing=true;
synchronized (this) {
    mLiveTimeline.handleJoinedRoomSync(roomSync,isInitialSync);
    if ((null != roomSync.ephemeral) && (null != roomSync.ephemeral.events)) {
      handleEphemeralEvents(roomSync.ephemeral.events);
    }
    if (null != roomSync.accountData) {
      handleAccountDataEvents(roomSync.accountData.events);
    }
  }
  if (null != mOnInitialSyncCallback) {
    try {
      Log.d(LOG_TAG,"String_Node_Str" + getRoomId() + "String_Node_Str");
      mOnInitialSyncCallback.onSuccess(null);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getLocalizedMessage());
    }
    mOnInitialSyncCallback=null;
  }
  mIsSyncing=false;
  if (mRefreshUnreadAfterSync) {
    refreshUnreadCounter();
    mRefreshUnreadAfterSync=false;
  }
}

Fixed version (ground truth):
/** 
 * Handle the events of a joined room.
 * @param roomSync      the sync events list.
 * @param isInitialSync true if the room is initialized by a global initial sync.
 */
public void handleJoinedRoomSync(RoomSync roomSync,boolean isInitialSync){
  if (null != mOnInitialSyncCallback) {
    Log.d(LOG_TAG,"String_Node_Str" + getRoomId());
  }
 else {
    Log.d(LOG_TAG,"String_Node_Str" + getRoomId());
  }
  mIsSyncing=true;
synchronized (this) {
    mLiveTimeline.handleJoinedRoomSync(roomSync,isInitialSync);
    if ((null != roomSync.ephemeral) && (null != roomSync.ephemeral.events)) {
      handleEphemeralEvents(roomSync.ephemeral.events);
    }
    if (null != roomSync.accountData) {
      handleAccountDataEvents(roomSync.accountData.events);
    }
  }
  if (null != mOnInitialSyncCallback) {
    Log.d(LOG_TAG,"String_Node_Str" + getRoomId() + "String_Node_Str");
    final ApiCallback<Void> fOnInitialSyncCallback=mOnInitialSyncCallback;
    new Handler(Looper.getMainLooper()).post(new Runnable(){
      @Override public void run(){
        try {
          fOnInitialSyncCallback.onSuccess(null);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getLocalizedMessage());
        }
      }
    }
);
    mOnInitialSyncCallback=null;
  }
  mIsSyncing=false;
  if (mRefreshUnreadAfterSync) {
    refreshUnreadCounter();
    mRefreshUnreadAfterSync=false;
  }
}
Program: 32009
Project: 32009
Buggy source:
/** 
 * Defines that the current timeline is an historical one
 * @param isHistoricalRoom true when the current timeline is an historical one
 */
public void setIsHistorical(boolean isHistorical){
}

Fixed version (ground truth):
/** 
 * Defines that the current timeline is an historical one
 * @param isHistorical true when the current timeline is an historical one
 */
public void setIsHistorical(boolean isHistorical){
  mIsHistorical=isHistorical;
}
Program: 32010
Project: 32010
Buggy source:
/** 
 * Encrypt an outgoing message using an existing session.
 * @param theirDeviceIdentityKey the Curve25519 identity key for the remote device.
 * @param sessionId the id of the active session
 * @param payloadString the payload to be encrypted and sent
 * @return the cipher text
 */
public Map<String,Object> encryptMessage(String theirDeviceIdentityKey,String sessionId,String payloadString){
  HashMap<String,Object> res=null;
  OlmMessage olmMessage;
  OlmSession olmSession=getSessionForDevice(theirDeviceIdentityKey,sessionId);
  if (null != olmSession) {
    try {
      Log.d(LOG_TAG,"String_Node_Str" + olmSession.sessionIdentifier());
      Log.d(LOG_TAG,"String_Node_Str" + payloadString);
      olmMessage=olmSession.encryptMessage(payloadString);
      mStore.storeSession(olmSession,theirDeviceIdentityKey);
      res=new HashMap<>();
      res.put("String_Node_Str",olmMessage.mCipherText);
      res.put("String_Node_Str",olmMessage.mType);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Encrypt an outgoing message using an existing session.
 * @param theirDeviceIdentityKey the Curve25519 identity key for the remote device.
 * @param sessionId the id of the active session
 * @param payloadString the payload to be encrypted and sent
 * @return the cipher text
 */
public Map<String,Object> encryptMessage(String theirDeviceIdentityKey,String sessionId,String payloadString){
  HashMap<String,Object> res=null;
  OlmMessage olmMessage;
  OlmSession olmSession=getSessionForDevice(theirDeviceIdentityKey,sessionId);
  if (null != olmSession) {
    try {
      Log.d(LOG_TAG,"String_Node_Str" + olmSession.sessionIdentifier());
      olmMessage=olmSession.encryptMessage(payloadString);
      mStore.storeSession(olmSession,theirDeviceIdentityKey);
      res=new HashMap<>();
      res.put("String_Node_Str",olmMessage.mCipherText);
      res.put("String_Node_Str",olmMessage.mType);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
  return res;
}
Program: 32012
Project: 32012
Buggy source:
@Override public void onSuccess(SyncResponse syncResponse){
  if (!mKilling) {
    if (0 == fServerTimeout) {
      if (hasDevicesChanged(syncResponse)) {
        mNextServerTimeoutms=0;
      }
    }
    if (mIsCatchingUp && (0 != mNextServerTimeoutms)) {
      Log.e(LOG_TAG,"String_Node_Str");
      mIsCatchingUp=false;
      mPaused=true;
    }
    Log.d(LOG_TAG,"String_Node_Str");
    mListener.onSyncResponse(syncResponse,mCurrentToken,(0 == mNextServerTimeoutms));
    mCurrentToken=syncResponse.nextBatch;
    Log.d(LOG_TAG,"String_Node_Str" + mCurrentToken);
  }
  latch.countDown();
}

Fixed version (ground truth):
@Override public void onSuccess(SyncResponse syncResponse){
  if (!mKilling) {
    if (0 == fServerTimeout) {
      if (hasDevicesChanged(syncResponse)) {
        mNextServerTimeoutms=0;
      }
    }
    if (mIsCatchingUp && (0 != mNextServerTimeoutms)) {
      int eventCounts=0;
      if (null != syncResponse.rooms) {
        RoomsSyncResponse roomsSyncResponse=syncResponse.rooms;
        if (null != roomsSyncResponse.join) {
          eventCounts+=roomsSyncResponse.join.size();
        }
        if (null != roomsSyncResponse.invite) {
          eventCounts+=roomsSyncResponse.invite.size();
        }
      }
      if (0 == eventCounts) {
        Log.e(LOG_TAG,"String_Node_Str");
      }
 else {
        Log.e(LOG_TAG,"String_Node_Str");
        mIsCatchingUp=false;
        mPaused=true;
      }
    }
    Log.d(LOG_TAG,"String_Node_Str");
    mListener.onSyncResponse(syncResponse,mCurrentToken,(0 == mNextServerTimeoutms));
    mCurrentToken=syncResponse.nextBatch;
    Log.d(LOG_TAG,"String_Node_Str" + mCurrentToken);
  }
  latch.countDown();
}
Program: 32014
Project: 32014
Buggy source:
/** 
 * @return true if some saved data is corrupted
 */
public boolean isCorrupted(){
  return mCryptoStore.isCorrupted();
}

Fixed version (ground truth):
/** 
 * @return true if some saved data is corrupted
 */
public boolean isCorrupted(){
  return (null != mCryptoStore) && mCryptoStore.isCorrupted();
}
Program: 32016
Project: 32016
Buggy source:
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
    params.x_show_msisdn=true;
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
    params.x_show_msisdn=true;
  }
 else   if (params.password == null && params.username == null && params.auth == null) {
    params.x_show_msisdn=true;
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}
Program: 32017
Project: 32017
Buggy source:
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
  }
  params.x_show_msisdn=true;
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
    params.x_show_msisdn=true;
  }
 else   if (params.password == null && params.username == null && params.auth == null) {
    params.x_show_msisdn=true;
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}
Program: 32019
Project: 32019
Buggy source:
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
  }
  params.x_show_msisdn=true;
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
    params.x_show_msisdn=true;
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}
Program: 32020
Project: 32020
Buggy source:
/** 
 * Determine if this session has been shared with devices which it shouldn't have been.
 * @param devicesInRoom the devices map
 * @return true if we have shared the session with devices which aren't in devicesInRoom.
 */
public boolean sharedWithTooManyDevices(MXUsersDevicesMap<MXDeviceInfo> devicesInRoom){
  List<String> userIds=mSharedWithDevices.getUserIds();
  for (  String userId : userIds) {
    List<String> deviceIds=devicesInRoom.getUserDeviceIds(userId);
    if (null == deviceIds) {
      Log.d(LOG_TAG,"String_Node_Str" + userId);
      return true;
    }
    for (    String deviceId : deviceIds) {
      if (null == devicesInRoom.getObject(deviceId,userId)) {
        Log.d(LOG_TAG,"String_Node_Str" + userId + "String_Node_Str"+ deviceId);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determine if this session has been shared with devices which it shouldn't have been.
 * @param devicesInRoom the devices map
 * @return true if we have shared the session with devices which aren't in devicesInRoom.
 */
public boolean sharedWithTooManyDevices(MXUsersDevicesMap<MXDeviceInfo> devicesInRoom){
  List<String> userIds=mSharedWithDevices.getUserIds();
  for (  String userId : userIds) {
    if (null == devicesInRoom.getUserDeviceIds(userId)) {
      Log.d(LOG_TAG,"String_Node_Str" + userId);
      return true;
    }
    List<String> deviceIds=mSharedWithDevices.getUserDeviceIds(userId);
    for (    String deviceId : deviceIds) {
      if (null == devicesInRoom.getObject(deviceId,userId)) {
        Log.d(LOG_TAG,"String_Node_Str" + userId + "String_Node_Str"+ deviceId);
        return true;
      }
    }
  }
  return false;
}
Program: 32021
Project: 32021
Buggy source:
/** 
 * Create a canonicalized json string for an object
 * @param object the object to convert
 * @return the canonicalized string
 */
public static String getCanonicalizedJsonString(Object object){
  String canonicalizedJsonString=null;
  if (null != object) {
    if (object instanceof JsonElement) {
      canonicalizedJsonString=gson.toJson(canonicalize((JsonElement)object));
    }
 else {
      canonicalizedJsonString=gson.toJson(canonicalize(gson.toJsonTree(object)));
    }
    if (null != canonicalizedJsonString) {
      canonicalizedJsonString=canonicalizedJsonString.replace("String_Node_Str","String_Node_Str");
    }
  }
  return canonicalizedJsonString;
}

Fixed version (ground truth):
/** 
 * Create a canonicalized json string for an object
 * @param object the object to convert
 * @return the canonicalized string
 */
public static String getCanonicalizedJsonString(Object object){
  String canonicalizedJsonString=null;
  if (null != object) {
    if (object instanceof JsonElement) {
      canonicalizedJsonString=gsonWithoutHtmlEscaping.toJson(canonicalize((JsonElement)object));
    }
 else {
      canonicalizedJsonString=gsonWithoutHtmlEscaping.toJson(canonicalize(gsonWithoutHtmlEscaping.toJsonTree(object)));
    }
    if (null != canonicalizedJsonString) {
      canonicalizedJsonString=canonicalizedJsonString.replace("String_Node_Str","String_Node_Str");
    }
  }
  return canonicalizedJsonString;
}
Program: 32022
Project: 32022
Buggy source:
/** 
 * Define a listener to track the local frame update.
 */
private void listenPreviewUpdate(){
  try {
    if (null != mVideoCapturer) {
      Field field=mVideoCapturer.getClass().getDeclaredField("String_Node_Str");
      field.setAccessible(true);
      Camera camera=(Camera)field.get(mVideoCapturer);
      if (null != camera) {
        Camera.CameraInfo info=new android.hardware.Camera.CameraInfo();
        Camera.getCameraInfo(mCameraInUse == CAMERA_TYPE_FRONT ? android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT : android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK,info);
        final int cameraOrientation=info.orientation;
        camera.setPreviewCallbackWithBuffer(new Camera.PreviewCallback(){
          @Override public void onPreviewFrame(          byte[] data,          Camera camera){
            onPreviewFrameUpdate(camera,cameraOrientation);
            ((VideoCapturerAndroid)mVideoCapturer).onPreviewFrame(data,camera);
          }
        }
);
        onPreviewFrameUpdate(camera,cameraOrientation);
      }
 else {
        Log.e(LOG_TAG,"String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Define a listener to track the local frame update.
 */
private void listenPreviewUpdate(){
  try {
    if (null != mVideoCapturer) {
      Field field=mVideoCapturer.getClass().getDeclaredField("String_Node_Str");
      field.setAccessible(true);
      Camera camera=(Camera)field.get(mVideoCapturer);
      if (null != camera) {
        try {
          Camera.CameraInfo info=new android.hardware.Camera.CameraInfo();
          Camera.getCameraInfo(mCameraInUse == CAMERA_TYPE_FRONT ? android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT : android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK,info);
          final int cameraOrientation=info.orientation;
          camera.setPreviewCallbackWithBuffer(new Camera.PreviewCallback(){
            @Override public void onPreviewFrame(            byte[] data,            Camera camera){
              onPreviewFrameUpdate(camera,cameraOrientation);
              ((VideoCapturerAndroid)mVideoCapturer).onPreviewFrame(data,camera);
            }
          }
);
          onPreviewFrameUpdate(camera,cameraOrientation);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
 else {
        Log.e(LOG_TAG,"String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
  }
}
Program: 32023
Project: 32023
Buggy source:
/** 
 * Returns whether a string contains an occurrence of another, as a standalone word, regardless of case.
 * @param subString the string to search for
 * @param longString the string to search in
 * @return whether a match was found
 */
public static boolean caseInsensitiveFind(String subString,String longString){
  if (TextUtils.isEmpty(subString) || TextUtils.isEmpty(longString)) {
    return false;
  }
  Pattern pattern=Pattern.compile("String_Node_Str" + subString + "String_Node_Str",Pattern.CASE_INSENSITIVE);
  return pattern.matcher(longString).find();
}

Fixed version (ground truth):
/** 
 * Returns whether a string contains an occurrence of another, as a standalone word, regardless of case.
 * @param subString the string to search for
 * @param longString the string to search in
 * @return whether a match was found
 */
public static boolean caseInsensitiveFind(String subString,String longString){
  if (TextUtils.isEmpty(subString) || TextUtils.isEmpty(longString)) {
    return false;
  }
  boolean res=false;
  try {
    Pattern pattern=Pattern.compile("String_Node_Str" + subString + "String_Node_Str",Pattern.CASE_INSENSITIVE);
    res=pattern.matcher(longString).find();
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,"String_Node_Str");
  }
  return res;
}
Program: 32024
Project: 32024
Buggy source:
/** 
 * Clear the unread message counters
 * @param summary the room summary
 */
private void clearUnreadCounters(RoomSummary summary){
  getLiveState().setHighlightCount(0);
  getLiveState().setNotificationCount(0);
  mStore.storeLiveStateForRoom(getRoomId());
  summary.setUnreadEventsCount(0);
  mStore.flushSummary(summary);
  mStore.commit();
}

Fixed version (ground truth):
/** 
 * Clear the unread message counters
 * @param summary the room summary
 */
private void clearUnreadCounters(RoomSummary summary){
  getLiveState().setHighlightCount(0);
  getLiveState().setNotificationCount(0);
  mStore.storeLiveStateForRoom(getRoomId());
  if (null != summary) {
    summary.setUnreadEventsCount(0);
    mStore.flushSummary(summary);
  }
  mStore.commit();
}
Program: 32025
Project: 32025
Buggy source:
/** 
 * Remove the tmp files from a filename list
 * @param names the names list
 * @return the filtered list
 */
private static final List<String> listFiles(String[] names){
  ArrayList<String> filteredFilenames=new ArrayList<>();
  ArrayList<String> tmpFilenames=new ArrayList<>();
  for (int i=0; i < names.length; i++) {
    String name=names[i];
    if (!name.endsWith("String_Node_Str")) {
      filteredFilenames.add(name);
    }
 else {
      tmpFilenames.add(name.substring(0,name.length() - "String_Node_Str".length()));
    }
  }
  for (  String tmpFileName : tmpFilenames) {
    if (!filteredFilenames.contains(tmpFileName)) {
      Log.e(LOG_TAG,"String_Node_Str" + tmpFileName + "String_Node_Str");
      filteredFilenames.add(tmpFileName);
    }
  }
  return filteredFilenames;
}

Fixed version (ground truth):
/** 
 * Remove the tmp files from a filename list
 * @param names the names list
 * @return the filtered list
 */
private static final List<String> listFiles(String[] names){
  ArrayList<String> filteredFilenames=new ArrayList<>();
  ArrayList<String> tmpFilenames=new ArrayList<>();
  if (null != names) {
    for (int i=0; i < names.length; i++) {
      String name=names[i];
      if (!name.endsWith("String_Node_Str")) {
        filteredFilenames.add(name);
      }
 else {
        tmpFilenames.add(name.substring(0,name.length() - "String_Node_Str".length()));
      }
    }
    for (    String tmpFileName : tmpFilenames) {
      if (!filteredFilenames.contains(tmpFileName)) {
        Log.e(LOG_TAG,"String_Node_Str" + tmpFileName + "String_Node_Str");
        filteredFilenames.add(tmpFileName);
      }
    }
  }
  return filteredFilenames;
}
Program: 32028
Project: 32028
Buggy source:
/** 
 * Send the answer event
 * @param sessionDescription the session description
 */
private void sendAnswer(final SessionDescription sessionDescription){
  if (isCallEnded()) {
    Log.d(LOG_TAG,"String_Node_Str");
    return;
  }
  Log.d(LOG_TAG,"String_Node_Str");
  JsonObject answerContent=new JsonObject();
  answerContent.addProperty("String_Node_Str",0);
  answerContent.addProperty("String_Node_Str",mCallId);
  answerContent.addProperty("String_Node_Str",60000);
  JsonObject offerContent=new JsonObject();
  offerContent.addProperty("String_Node_Str",sessionDescription.description);
  offerContent.addProperty("String_Node_Str",sessionDescription.type.canonicalForm());
  answerContent.add("String_Node_Str",offerContent);
  Event event=new Event(Event.EVENT_TYPE_CALL_ANSWER,answerContent,mSession.getCredentials().userId,mCallSignalingRoom.getRoomId());
  mPendingEvents.add(event);
  sendNextEvent();
}

Fixed version (ground truth):
/** 
 * Send the answer event
 * @param sessionDescription the session description
 */
private void sendAnswer(final SessionDescription sessionDescription){
  if (isCallEnded()) {
    Log.d(LOG_TAG,"String_Node_Str");
    return;
  }
  Log.d(LOG_TAG,"String_Node_Str");
  JsonObject answerContent=new JsonObject();
  answerContent.addProperty("String_Node_Str",0);
  answerContent.addProperty("String_Node_Str",mCallId);
  answerContent.addProperty("String_Node_Str",60000);
  JsonObject offerContent=new JsonObject();
  offerContent.addProperty("String_Node_Str",sessionDescription.description);
  offerContent.addProperty("String_Node_Str",sessionDescription.type.canonicalForm());
  answerContent.add("String_Node_Str",offerContent);
  Event event=new Event(Event.EVENT_TYPE_CALL_ANSWER,answerContent,mSession.getCredentials().userId,mCallSignalingRoom.getRoomId());
  mPendingEvents.add(event);
  sendNextEvent();
  mIsAnswered=true;
}
Program: 32029
Project: 32029
Buggy source:
/** 
 * The call has been answered on another device. We distinguish the case where an account is active on multiple devices and a video call is launched on the account. In this case the callee who did not answer must display a "answered elsewhere" message.
 */
@Override public void onAnsweredElsewhere(){
  ;
  String state=getCallState();
  Log.d(LOG_TAG,"String_Node_Str" + state);
  if (!isCallEnded()) {
    dispatchAnsweredElsewhere();
    terminate(IMXCall.END_CALL_REASON_UNDEFINED);
  }
}

Fixed version (ground truth):
/** 
 * The call has been answered on another device. We distinguish the case where an account is active on multiple devices and a video call is launched on the account. In this case the callee who did not answer must display a "answered elsewhere" message.
 */
@Override public void onAnsweredElsewhere(){
  ;
  String state=getCallState();
  Log.d(LOG_TAG,"String_Node_Str" + state);
  if (!isCallEnded() && !mIsAnswered) {
    dispatchAnsweredElsewhere();
    terminate(IMXCall.END_CALL_REASON_UNDEFINED);
  }
}
Program: 32031
Project: 32031
Buggy source:
/** 
 * The call has been answered on another device. We distinguish the case where an account is active on multiple devices and a video call is launched on the account. In this case the callee who did not answer must display a "answered elsewhere" message.
 */
@Override public void onAnsweredElsewhere(){
  ;
  String state=getCallState();
  Log.d(LOG_TAG,"String_Node_Str" + state);
  if (TextUtils.equals(state,IMXCall.CALL_STATE_RINGING) || TextUtils.equals(state,IMXCall.CALL_STATE_FLEDGLING) || TextUtils.equals(state,IMXCall.CALL_STATE_CREATED)|| (TextUtils.equals(state,CALL_STATE_WAIT_LOCAL_MEDIA) && isVideo())) {
    dispatchAnsweredElsewhere();
    terminate(IMXCall.END_CALL_REASON_UNDEFINED);
  }
}

Fixed version (ground truth):
/** 
 * The call has been answered on another device. We distinguish the case where an account is active on multiple devices and a video call is launched on the account. In this case the callee who did not answer must display a "answered elsewhere" message.
 */
@Override public void onAnsweredElsewhere(){
  ;
  String state=getCallState();
  Log.d(LOG_TAG,"String_Node_Str" + state);
  if (!isCallEnded()) {
    dispatchAnsweredElsewhere();
    terminate(IMXCall.END_CALL_REASON_UNDEFINED);
  }
}
Program: 32033
Project: 32033
Buggy source:
/** 
 * Refresh the unread summary counters of the updated rooms.
 */
private void refreshUnreadCounters(){
  for (  String roomId : mUpdatedRoomIdList) {
    Room room=mStore.getRoom(roomId);
    if (null != room) {
      room.refreshUnreadCounter();
    }
  }
  mUpdatedRoomIdList.clear();
}

Fixed version (ground truth):
/** 
 * Refresh the unread summary counters of the updated rooms.
 */
private void refreshUnreadCounters(){
  ArrayList<String> roomIdsList;
synchronized (mUpdatedRoomIdList) {
    roomIdsList=new ArrayList<>(mUpdatedRoomIdList);
    mUpdatedRoomIdList.clear();
  }
  for (  String roomId : roomIdsList) {
    Room room=mStore.getRoom(roomId);
    if (null != room) {
      room.refreshUnreadCounter();
    }
  }
}
Program: 32034
Project: 32034
Buggy source:
@Override public void onLiveEvent(final Event event,final RoomState roomState){
  String type=event.getType();
  if (!TextUtils.equals(Event.EVENT_TYPE_TYPING,type) && !TextUtils.equals(Event.EVENT_TYPE_RECEIPT,type) && !TextUtils.equals(Event.EVENT_TYPE_TYPING,type)) {
    if (mUpdatedRoomIdList.indexOf(roomState.roomId) < 0) {
      mUpdatedRoomIdList.add(roomState.roomId);
    }
  }
  if (null != mCryptoEventsListener) {
    mCryptoEventsListener.onLiveEvent(event,roomState);
  }
  final List<IMXEventListener> eventListeners=getListenersSnapshot();
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      for (      IMXEventListener listener : eventListeners) {
        try {
          listener.onLiveEvent(event,roomState);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onLiveEvent(final Event event,final RoomState roomState){
  String type=event.getType();
  if (!TextUtils.equals(Event.EVENT_TYPE_TYPING,type) && !TextUtils.equals(Event.EVENT_TYPE_RECEIPT,type) && !TextUtils.equals(Event.EVENT_TYPE_TYPING,type)) {
synchronized (mUpdatedRoomIdList) {
      if (mUpdatedRoomIdList.indexOf(roomState.roomId) < 0) {
        mUpdatedRoomIdList.add(roomState.roomId);
      }
    }
  }
  if (null != mCryptoEventsListener) {
    mCryptoEventsListener.onLiveEvent(event,roomState);
  }
  final List<IMXEventListener> eventListeners=getListenersSnapshot();
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      for (      IMXEventListener listener : eventListeners) {
        try {
          listener.onLiveEvent(event,roomState);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
  }
);
}
Program: 32035
Project: 32035
Buggy source:
@Override public void onReceiptEvent(final String roomId,final List<String> senderIds){
  if (mUpdatedRoomIdList.indexOf(roomId) < 0) {
    mUpdatedRoomIdList.add(roomId);
  }
  if (null != mCryptoEventsListener) {
    mCryptoEventsListener.onReceiptEvent(roomId,senderIds);
  }
  final List<IMXEventListener> eventListeners=getListenersSnapshot();
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      for (      IMXEventListener listener : eventListeners) {
        try {
          listener.onReceiptEvent(roomId,senderIds);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onReceiptEvent(final String roomId,final List<String> senderIds){
synchronized (mUpdatedRoomIdList) {
    if (mUpdatedRoomIdList.indexOf(roomId) < 0) {
      mUpdatedRoomIdList.add(roomId);
    }
  }
  if (null != mCryptoEventsListener) {
    mCryptoEventsListener.onReceiptEvent(roomId,senderIds);
  }
  final List<IMXEventListener> eventListeners=getListenersSnapshot();
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      for (      IMXEventListener listener : eventListeners) {
        try {
          listener.onReceiptEvent(roomId,senderIds);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
        }
      }
    }
  }
);
}
Program: 32036
Project: 32036
Buggy source:
/** 
 * Return the direct chat room list for retro compatibility with 1:1 rooms.
 * @param aStore strore instance
 * @param aDirectChatRoomIdsListRetValue the other participants in the 1:1 room
 */
public void getDirectChatRoomIdsListRetroCompat(IMXStore aStore,ArrayList<RoomIdsListRetroCompat> aDirectChatRoomIdsListRetValue){
  RoomIdsListRetroCompat item;
  if ((null != aStore) && (null != aDirectChatRoomIdsListRetValue)) {
    ArrayList<Room> rooms=new ArrayList<>(aStore.getRooms());
    ArrayList<RoomMember> members;
    int otherParticipantIndex;
    for (    Room r : rooms) {
      if ((r.getMembers().size() == 2) && (null != r.getAccountData()) && (!r.getAccountData().hasTags())) {
        RoomMember roomMember=r.getMember(getMyUserId());
        members=new ArrayList<>(r.getActiveMembers());
        if (null != roomMember) {
          String membership=roomMember.membership;
          if (TextUtils.equals(membership,RoomMember.MEMBERSHIP_JOIN) || TextUtils.equals(membership,RoomMember.MEMBERSHIP_BAN) || TextUtils.equals(membership,RoomMember.MEMBERSHIP_LEAVE)) {
            if (TextUtils.equals(members.get(0).getUserId(),getMyUserId())) {
              otherParticipantIndex=1;
            }
 else {
              otherParticipantIndex=0;
            }
            item=new RoomIdsListRetroCompat(members.get(otherParticipantIndex).getUserId(),r.getRoomId());
            aDirectChatRoomIdsListRetValue.add(item);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Return the direct chat room list for retro compatibility with 1:1 rooms.
 * @param aStore strore instance
 * @param aDirectChatRoomIdsListRetValue the other participants in the 1:1 room
 */
private void getDirectChatRoomIdsListRetroCompat(IMXStore aStore,ArrayList<RoomIdsListRetroCompat> aDirectChatRoomIdsListRetValue){
  RoomIdsListRetroCompat item;
  if ((null != aStore) && (null != aDirectChatRoomIdsListRetValue)) {
    ArrayList<Room> rooms=new ArrayList<>(aStore.getRooms());
    ArrayList<RoomMember> members;
    int otherParticipantIndex;
    for (    Room r : rooms) {
      if ((r.getActiveMembers().size() == 2) && (null != r.getAccountData()) && (!r.getAccountData().hasTags())) {
        RoomMember roomMember=r.getMember(getMyUserId());
        members=new ArrayList<>(r.getActiveMembers());
        if (null != roomMember) {
          String membership=roomMember.membership;
          if (TextUtils.equals(membership,RoomMember.MEMBERSHIP_JOIN) || TextUtils.equals(membership,RoomMember.MEMBERSHIP_BAN) || TextUtils.equals(membership,RoomMember.MEMBERSHIP_LEAVE)) {
            if (TextUtils.equals(members.get(0).getUserId(),getMyUserId())) {
              otherParticipantIndex=1;
            }
 else {
              otherParticipantIndex=0;
            }
            item=new RoomIdsListRetroCompat(members.get(otherParticipantIndex).getUserId(),r.getRoomId());
            aDirectChatRoomIdsListRetValue.add(item);
          }
        }
      }
    }
  }
}
Program: 32038
Project: 32038
Buggy source:
@Override public void setAvatarURL(String avatarURL){
  if (!TextUtils.equals(mMetadata.mUserAvatarUrl,avatarURL)) {
    mMetadata.mUserAvatarUrl=avatarURL;
    User myUser=getUser(mMetadata.mUserId);
    if (null != myUser) {
      myUser.setAvatarUrl(avatarURL);
    }
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}

Fixed version (ground truth):
@Override public void setAvatarURL(String avatarURL){
  if ((null != mMetadata) && !TextUtils.equals(mMetadata.mUserAvatarUrl,avatarURL)) {
    mMetadata.mUserAvatarUrl=avatarURL;
    User myUser=getUser(mMetadata.mUserId);
    if (null != myUser) {
      myUser.setAvatarUrl(avatarURL);
    }
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}
Program: 32039
Project: 32039
Buggy source:
@Override public void setThirdPartyIdentifiers(List<ThirdPartyIdentifier> identifiers){
  mMetadata.mThirdPartyIdentifiers=identifiers;
  Log.d(LOG_TAG,"String_Node_Str");
  commit();
}

Fixed version (ground truth):
@Override public void setThirdPartyIdentifiers(List<ThirdPartyIdentifier> identifiers){
  if (null != mMetadata) {
    mMetadata.mThirdPartyIdentifiers=identifiers;
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}
Program: 32040
Project: 32040
Buggy source:
@Override public List<ThirdPartyIdentifier> thirdPartyIdentifiers(){
  return mMetadata.mThirdPartyIdentifiers;
}

Fixed version (ground truth):
@Override public List<ThirdPartyIdentifier> thirdPartyIdentifiers(){
  if (null != mMetadata) {
    return mMetadata.mThirdPartyIdentifiers;
  }
 else {
    return new ArrayList<>();
  }
}
Program: 32041
Project: 32041
Buggy source:
@Override public String avatarURL(){
  return mMetadata.mUserAvatarUrl;
}

Fixed version (ground truth):
@Override public String avatarURL(){
  if (null != mMetadata) {
    return mMetadata.mUserAvatarUrl;
  }
 else {
    return null;
  }
}
Program: 32042
Project: 32042
Buggy source:
@Override public void setIgnoredUserIdsList(List<String> users){
  mMetadata.mIgnoredUsers=users;
  Log.d(LOG_TAG,"String_Node_Str");
  commit();
}

Fixed version (ground truth):
@Override public void setIgnoredUserIdsList(List<String> users){
  if (null != mMetadata) {
    mMetadata.mIgnoredUsers=users;
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}
Program: 32043
Project: 32043
Buggy source:
@Override public void setDirectChatRoomsDict(Map<String,List<String>> directChatRoomsDict){
  mMetadata.mDirectChatRoomsMap=directChatRoomsDict;
  Log.d(LOG_TAG,"String_Node_Str");
  commit();
}

Fixed version (ground truth):
@Override public void setDirectChatRoomsDict(Map<String,List<String>> directChatRoomsDict){
  if (null != mMetadata) {
    mMetadata.mDirectChatRoomsMap=directChatRoomsDict;
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}
Program: 32044
Project: 32044
Buggy source:
@Override public List<String> getIgnoredUserIdsList(){
  return mMetadata.mIgnoredUsers;
}

Fixed version (ground truth):
@Override public List<String> getIgnoredUserIdsList(){
  if (null != mMetadata) {
    return mMetadata.mIgnoredUsers;
  }
 else {
    return new ArrayList<>();
  }
}
Program: 32045
Project: 32045
Buggy source:
/** 
 * profile information
 */
@Override public String displayName(){
  return mMetadata.mUserDisplayName;
}

Fixed version (ground truth):
/** 
 * profile information
 */
@Override public String displayName(){
  if (null != mMetadata) {
    return mMetadata.mUserDisplayName;
  }
 else {
    return null;
  }
}
Program: 32046
Project: 32046
Buggy source:
@Override public void setDisplayName(String displayName){
  if (!TextUtils.equals(mMetadata.mUserDisplayName,displayName)) {
    mMetadata.mUserDisplayName=displayName;
    if (null != displayName) {
      mMetadata.mUserDisplayName=mMetadata.mUserDisplayName.trim();
    }
    User myUser=getUser(mMetadata.mUserId);
    if (null != myUser) {
      myUser.displayname=mMetadata.mUserDisplayName;
    }
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}

Fixed version (ground truth):
@Override public void setDisplayName(String displayName){
  if ((null != mMetadata) && !TextUtils.equals(mMetadata.mUserDisplayName,displayName)) {
    mMetadata.mUserDisplayName=displayName;
    if (null != displayName) {
      mMetadata.mUserDisplayName=mMetadata.mUserDisplayName.trim();
    }
    User myUser=getUser(mMetadata.mUserId);
    if (null != myUser) {
      myUser.displayname=mMetadata.mUserDisplayName;
    }
    Log.d(LOG_TAG,"String_Node_Str");
    commit();
  }
}
Program: 32047
Project: 32047
Buggy source:
/** 
 * @return true if there are some active calls.
 */
public boolean hasActiveCalls(){
synchronized (this) {
    Set<String> callIds=mCallsByCallId.keySet();
    for (    String callId : callIds) {
      IMXCall call=mCallsByCallId.get(callId);
      if (TextUtils.equals(call.getCallState(),IMXCall.CALL_STATE_ENDED)) {
        Log.d(LOG_TAG,"String_Node_Str" + callId + "String_Node_Str");
        mCallsByCallId.remove(callId);
      }
 else {
        Log.d(LOG_TAG,"String_Node_Str" + callId + "String_Node_Str");
        return true;
      }
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * @return true if there are some active calls.
 */
public boolean hasActiveCalls(){
synchronized (this) {
    ArrayList<String> callIdsToRemove=new ArrayList<>();
    Set<String> callIds=mCallsByCallId.keySet();
    for (    String callId : callIds) {
      IMXCall call=mCallsByCallId.get(callId);
      if (TextUtils.equals(call.getCallState(),IMXCall.CALL_STATE_ENDED)) {
        Log.d(LOG_TAG,"String_Node_Str" + callId + "String_Node_Str");
        callIdsToRemove.add(callId);
      }
 else {
        Log.d(LOG_TAG,"String_Node_Str" + callId + "String_Node_Str");
        return true;
      }
    }
    for (    String callIdToRemove : callIdsToRemove) {
      mCallsByCallId.remove(callIdToRemove);
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
  return false;
}
Program: 32049
Project: 32049
Buggy source:
/** 
 * Reset replay attack data for the given timeline.
 * @param timelineId the timeline id
 */
public void resetReplayAttackCheckInTimeline(String timelineId){
  if (null != timelineId) {
    mCrypto.getOlmDevice().resetReplayAttackCheckInTimeline(timelineId);
  }
}

Fixed version (ground truth):
/** 
 * Reset replay attack data for the given timeline.
 * @param timelineId the timeline id
 */
public void resetReplayAttackCheckInTimeline(String timelineId){
  if ((null != timelineId) && (null != mCrypto) && (null != mCrypto.getOlmDevice())) {
    mCrypto.getOlmDevice().resetReplayAttackCheckInTimeline(timelineId);
  }
}
Program: 32050
Project: 32050
Buggy source:
/** 
 * @return the thread handle
 */
private MXOsHandler getThreadHandler(){
  if (null == mFileStoreHandler) {
    mHandlerThread=new HandlerThread("String_Node_Str" + mCredentials.userId + System.currentTimeMillis(),Thread.MIN_PRIORITY);
    mHandlerThread.start();
    mFileStoreHandler=new MXOsHandler(mHandlerThread.getLooper());
  }
  return mFileStoreHandler;
}

Fixed version (ground truth):
/** 
 * @return the thread handle
 */
private MXOsHandler getThreadHandler(){
  if (null == mFileStoreHandler) {
    mHandlerThread=new HandlerThread("String_Node_Str" + mCredentials.userId + System.currentTimeMillis(),Thread.MIN_PRIORITY);
    mHandlerThread.start();
    if (null != mHandlerThread.getLooper()) {
      mFileStoreHandler=new MXOsHandler(mHandlerThread.getLooper());
    }
 else {
      return new MXOsHandler(Looper.getMainLooper());
    }
  }
  return mFileStoreHandler;
}
Program: 32053
Project: 32053
Buggy source:
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request an account creation
 * @param params the registration parameters
 * @param callback the callbacks
 */
public void register(final RegistrationParams params,final ApiCallback<Credentials> callback){
  final String description="String_Node_Str";
  if (!TextUtils.isEmpty(params.password) && TextUtils.isEmpty(params.initial_device_display_name)) {
    params.initial_device_display_name=Build.MODEL.trim();
  }
  mApi.register(params,new RestAdapterCallback<JsonObject>(description,mUnsentEventsManager,callback,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      register(params,callback);
    }
  }
){
    @Override public void success(    JsonObject jsonObject,    Response response){
      onEventSent();
      mCredentials=gson.fromJson(jsonObject,Credentials.class);
      callback.onSuccess(mCredentials);
    }
  }
);
}
Program: 32055
Project: 32055
Buggy source:
@Override public int compare(Room r1,Room r2){
  int res=0;
  RoomTag tag1=r1.getAccountData().roomTag(tag);
  RoomTag tag2=r2.getAccountData().roomTag(tag);
  if ((null != tag1.mOrder) && (null != tag2.mOrder)) {
    double diff=(tag1.mOrder - tag2.mOrder);
    res=(diff == 0) ? 0 : (diff > 0) ? +1 : -1;
  }
 else   if (null != tag1.mOrder) {
    res=-1;
  }
 else   if (null != tag2.mOrder) {
    res=+1;
  }
  if (0 == res) {
    IMXStore store=mDataHandler.getStore();
    Event latestEvent1=store.getLatestEvent(r1.getRoomId());
    Event latestEvent2=store.getLatestEvent(r2.getRoomId());
    if ((null != latestEvent2) && (null != latestEvent1)) {
      long diff=(latestEvent2.getOriginServerTs() - latestEvent1.getOriginServerTs());
      res=(diff == 0) ? 0 : (diff > 0) ? +1 : -1;
    }
  }
  return res;
}

Fixed version (ground truth):
@Override public int compare(RoomMember r1,RoomMember r2){
  int res;
  long diff;
  if (RoomMember.MEMBERSHIP_JOIN.equals(r2.membership) && RoomMember.MEMBERSHIP_INVITE.equals(r1.membership)) {
    res=1;
  }
 else   if (r2.membership.equals(r1.membership)) {
    diff=r1.getOriginServerTs() - r2.getOriginServerTs();
    res=(0 == diff) ? 0 : ((diff > 0) ? 1 : -1);
  }
 else {
    res=-1;
  }
  return res;
}