nus-yam/ex-repair huggingface dataset:
Program: 87007
Project: 87007
Buggy source:
public static Environment detectCurrentEnvironment(Context context){
  try {
    return (new EnvironmentDetectorAsyncTask()).execute(context).get();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
    return null;
  }
catch (  ExecutionException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Detects the current environment based on the current values of the environment variables.
 * @param context Activity/service context
 */
public void detectCurrentEnvironment(Context context,EnvironmentDetectedCallback callback){
  Utility.checkForNullAndThrowException(context);
  Utility.checkForNullAndThrowException(callback);
  this.callback=callback;
  new EnvironmentDetectorAsyncTask().execute(context);
}
Program: 87009
Project: 87009
Buggy source:
private List<Environment> checkWifiAndBluetoothOfPotentialEnvironments(Context context,List<Environment> potentialEnvironments){
  ArrayList<Environment> currentEnvironments=new ArrayList<Environment>();
  for (  Environment e : potentialEnvironments) {
    Environment environment=Environment.getFullEnvironment(context,e.getName());
    if (environment.hasBluetoothDevices && environment.getBluetoothEnvironmentVariables() != null) {
      if (environment.isBluetoothAllOrAny()) {
        if (!checkForAllBluetoothDevices(environment.getBluetoothEnvironmentVariables())) {
          continue;
        }
      }
 else {
        if (!checkForAnyBluetoothDevices(environment.getBluetoothEnvironmentVariables())) {
          continue;
        }
      }
    }
    if (environment.hasWiFiNetwork) {
      if (WifiReceiver.getCurrentWifiNetwork() == null || !WifiReceiver.getCurrentWifiNetwork().equals(environment.getWiFiEnvironmentVariable())) {
        continue;
      }
    }
    Log.d(LOG_TAG,"String_Node_Str" + e.getName());
    currentEnvironments.add(e);
  }
  return currentEnvironments;
}

Fixed version (ground truth):
/** 
 * Checks whether the passed environments match the current bluetooth and wifi variables
 * @param context Activity/service context
 * @param potentialEnvironments The environments for which matching is to be done
 * @return the list of environments whose Bluetooth/Wifi variables match the current variables
 */
private List<Environment> checkWifiAndBluetoothOfPotentialEnvironments(Context context,List<Environment> potentialEnvironments){
  ArrayList<Environment> currentEnvironments=new ArrayList<Environment>();
  for (  Environment e : potentialEnvironments) {
    Environment environment=Environment.getFullEnvironment(context,e.getName());
    if (Utility.checkForNullAndWarn(environment,LOG_TAG)) {
      continue;
    }
    if (environment.hasBluetoothDevices && environment.getBluetoothEnvironmentVariables() != null) {
      if (environment.isBluetoothAllOrAny()) {
        if (!checkForAllBluetoothDevices(environment.getBluetoothEnvironmentVariables())) {
          continue;
        }
      }
 else {
        if (!checkForAnyBluetoothDevices(environment.getBluetoothEnvironmentVariables())) {
          continue;
        }
      }
    }
    if (environment.hasWiFiNetwork && environment.getWiFiEnvironmentVariable() != null) {
      if (WifiReceiver.getCurrentWifiNetwork() == null || !WifiReceiver.getCurrentWifiNetwork().equals(environment.getWiFiEnvironmentVariable())) {
        continue;
      }
    }
    Log.d(LOG_TAG,"String_Node_Str" + e.getName());
    currentEnvironments.add(e);
  }
  return currentEnvironments;
}
Program: 87010
Project: 87010
Buggy source:
private boolean checkForAnyBluetoothDevices(List<BluetoothEnvironmentVariable> variables){
  for (  BluetoothEnvironmentVariable variable : variables) {
    if (BluetoothReceiver.getCurrentlyConnectedBluetoothDevices().contains(variable)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean checkForAnyBluetoothDevices(List<BluetoothEnvironmentVariable> variables){
  if (Utility.checkForNullAndWarn(BluetoothReceiver.getCurrentlyConnectedBluetoothDevices(),LOG_TAG)) {
    return false;
  }
  for (  BluetoothEnvironmentVariable variable : variables) {
    if (Utility.checkForNullAndWarn(variable,LOG_TAG)) {
      continue;
    }
    if (BluetoothReceiver.getCurrentlyConnectedBluetoothDevices().contains(variable)) {
      return true;
    }
  }
  return false;
}
Program: 87012
Project: 87012
Buggy source:
/** 
 * Function to delete an environment from the database
 * @param context Activity/ service context
 * @param environmentName Name of the environment to be deleted
 */
public static void deleteEnvironmentFromDatabase(Context context,String environmentName){
  Environment e=getFullEnvironment(context,environmentName);
  if (e != null) {
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndBluetooth(e.id),null,null);
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndWifi(e.id),null,null);
    int deletedEntries=context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndLocation(e.id),null,null);
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithId(e.id),null,null);
    if (deletedEntries > 0) {
      Intent intentToRemoveOldGeofenceMonitor=BaseService.getServiceIntent(context,null,BaseService.ACTION_REMOVE_GEOFENCES);
      ArrayList<String> geofencesToRemove=new ArrayList<String>();
      geofencesToRemove.add(String.valueOf(e.getLocationEnvironmentVariable().getId()));
      intentToRemoveOldGeofenceMonitor.putExtra(BaseService.EXTRA_GEOFENCE_IDS_TO_REMOVE,geofencesToRemove);
      context.startService(intentToRemoveOldGeofenceMonitor);
    }
  }
}

Fixed version (ground truth):
/** 
 * Function to delete an environment from the database
 * @param context Activity/ service context
 * @param environmentName Name of the environment to be deleted
 */
public static void deleteEnvironmentFromDatabase(Context context,String environmentName){
  Environment e=getFullEnvironment(context,environmentName);
  if (e != null) {
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndBluetooth(e.id),null,null);
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndWifi(e.id),null,null);
    int deletedEntries=context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithIdAndLocation(e.id),null,null);
    context.getContentResolver().delete(EnvironmentEntry.buildEnvironmentUriWithId(e.id),null,null);
    if (deletedEntries > 0) {
      removeFromCurrentGeofences(e.getLocationEnvironmentVariable(),context);
    }
  }
}
Program: 87013
Project: 87013
Buggy source:
public static LocationEnvironmentVariable getLocationEnvironmentVariableFromAndroidGeofence(Context context,Geofence geofence){
  Cursor locationCursor=context.getContentResolver().query(GeoFenceEntry.buildGeofenceUriWithId(Long.parseLong(geofence.getRequestId())),null,null,null,null);
  List<EnvironmentVariable> locationVariables=getLocationEnvironmentVariablesFromCursor(locationCursor);
  locationCursor.close();
  if (locationVariables == null || locationVariables.isEmpty()) {
    Log.e(LOG_TAG,"String_Node_Str");
  }
  return (LocationEnvironmentVariable)locationVariables.get(0);
}

Fixed version (ground truth):
public static LocationEnvironmentVariable getLocationEnvironmentVariableFromAndroidGeofence(Context context,Geofence geofence){
  Cursor locationCursor=context.getContentResolver().query(GeoFenceEntry.buildGeofenceUriWithId(Long.parseLong(geofence.getRequestId())),null,null,null,null);
  List<EnvironmentVariable> locationVariables=getLocationEnvironmentVariablesFromCursor(locationCursor);
  locationCursor.close();
  if (locationVariables == null || locationVariables.isEmpty()) {
    Log.e(LOG_TAG,"String_Node_Str" + geofence.getRequestId());
    return null;
  }
  return (LocationEnvironmentVariable)locationVariables.get(0);
}
Program: 87014
Project: 87014
Buggy source:
@Override public boolean equals(Object o){
  EnvironmentVariable e=(EnvironmentVariable)o;
  if (!getVariableType().equals(e.getVariableType()))   return false;
  if (isStringValuesSupported()) {
    if (!e.isStringValuesSupported() || stringValues.length != e.stringValues.length)     return false;
    for (int i=0; i < stringValues.length; i++) {
      if (!stringValues[i].equals(e.stringValues[i])) {
        return false;
      }
    }
  }
  if (isFloatValuesSupported()) {
    if (!e.isFloatValuesSupported() || floatValues.length != e.floatValues.length)     return false;
    for (int i=0; i < floatValues.length; i++) {
      if (!(floatValues[i] == e.floatValues[i])) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (o == null) {
    return false;
  }
  Class<?> oClass=o.getClass();
  if (!oClass.getSuperclass().getSimpleName().equals(EnvironmentVariable.class.getSimpleName()) && !oClass.getSimpleName().equals(EnvironmentVariable.class.getSimpleName())) {
    return false;
  }
  EnvironmentVariable e=(EnvironmentVariable)o;
  if (!getVariableType().equals(e.getVariableType()))   return false;
  if (isStringValuesSupported()) {
    if (!e.isStringValuesSupported() || stringValues == null || e.stringValues == null || stringValues.length != e.stringValues.length)     return false;
    for (int i=0; i < stringValues.length; i++) {
      if (!stringValues[i].equals(e.stringValues[i])) {
        return false;
      }
    }
  }
  if (isFloatValuesSupported()) {
    if (!e.isFloatValuesSupported() || floatValues == null || e.floatValues == null || floatValues.length != e.floatValues.length)     return false;
    for (int i=0; i < floatValues.length; i++) {
      if (!(floatValues[i] == e.floatValues[i])) {
        return false;
      }
    }
  }
  return true;
}
Program: 87015
Project: 87015
Buggy source:
public EnvironmentVariable(String variableType,double[] floatValues,String[] stringValues){
  boolean isValid=checkTypeValidity(variableType) && !isInitialized;
  if (!isValid) {
    Log.e(LOG_TAG,"String_Node_Str" + variableType);
    throw new IllegalArgumentException("String_Node_Str" + variableType);
  }
  if (isValid) {
    isInitialized=true;
    this.variableType=variableType;
    setFloatValues(floatValues);
    setStringValues(stringValues);
  }
}

Fixed version (ground truth):
public EnvironmentVariable(String variableType,double[] floatValues,String[] stringValues){
  Utility.checkForNullAndThrowException(variableType);
  boolean isValid=checkTypeValidity(variableType) && !isInitialized;
  if (!isValid) {
    Log.e(LOG_TAG,"String_Node_Str" + variableType);
    throw new IllegalArgumentException("String_Node_Str" + variableType);
  }
  if (isValid) {
    isInitialized=true;
    this.variableType=variableType;
    setFloatValues(floatValues);
    setStringValues(stringValues);
  }
}
Program: 87016
Project: 87016
Buggy source:
@Override public boolean equals(Object o){
  EnvironmentVariable e=(EnvironmentVariable)o;
  if (stringValues.length != e.stringValues.length)   return false;
  if (floatValues.length != e.floatValues.length)   return false;
  if (isStringValuesSupported()) {
    for (int i=0; i < stringValues.length; i++) {
      if (!stringValues[i].equals(e.stringValues[i])) {
        return false;
      }
    }
  }
  if (isFloatValuesSupported()) {
    for (int i=0; i < floatValues.length; i++) {
      if (!(floatValues[i] == e.floatValues[i])) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  EnvironmentVariable e=(EnvironmentVariable)o;
  if (!getVariableType().equals(e.getVariableType()))   return false;
  if (isStringValuesSupported()) {
    if (!e.isStringValuesSupported() || stringValues.length != e.stringValues.length)     return false;
    for (int i=0; i < stringValues.length; i++) {
      if (!stringValues[i].equals(e.stringValues[i])) {
        return false;
      }
    }
  }
  if (isFloatValuesSupported()) {
    if (!e.isFloatValuesSupported() || floatValues.length != e.floatValues.length)     return false;
    for (int i=0; i < floatValues.length; i++) {
      if (!(floatValues[i] == e.floatValues[i])) {
        return false;
      }
    }
  }
  return true;
}
Program: 87018
Project: 87018
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_select_location);
  intent=getIntent();
  setUpActionBar();
  setUpGoogleMap();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_select_location);
  intent=getIntent();
  setUpActionBar();
  setUpGoogleMap();
  locationSuggestTask=new LocationSuggestTask();
  setUpGeocoder();
}
Program: 87019
Project: 87019
Buggy source:
public void setLocationItemsEnabled(boolean flag){
  nameLocationEditText.setEnabled(flag);
  latLocationEditText.setEnabled(flag);
  lonLocationEditText.setEnabled(flag);
  radLocationEditText.setEnabled(flag);
  selectLocationTextView.setEnabled(flag);
}

Fixed version (ground truth):
public void setLocationItemsEnabled(boolean flag){
  nameLocationEditText.setEnabled(flag);
  latLocationEditText.setEnabled(flag);
  lonLocationEditText.setEnabled(flag);
  radLocationEditText.setEnabled(flag);
  selectLocationTextView.setEnabled(flag);
  selectStoredLocationTextView.setEnabled(flag);
}
Program: 87020
Project: 87020
Buggy source:
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  if (isChecked) {
    setLocationItemsEnabled(true);
  }
 else {
    setLocationItemsEnabled(false);
  }
}

Fixed version (ground truth):
@Override public void onCheckedChanged(CompoundButton buttonView,boolean isChecked){
  if (isChecked) {
    setLocationItemsEnabled(true);
    storedLocations=LocationEnvironmentVariable.getLocationEnvironmentVariables(getActivity());
    mSelectedLocationItem=-1;
  }
 else {
    setLocationItemsEnabled(false);
  }
}
Program: 87022
Project: 87022
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_environment,container,false);
  environmentNameEditText=(EditText)rootView.findViewById(R.id.edit_text_environment_name);
  environmentHintEditText=(EditText)rootView.findViewById(R.id.edit_text_environment_hint);
  enableBluetoothCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_bluetooth);
  selectBluetoothDevicesTextView=(TextView)rootView.findViewById(R.id.text_view_bluetooth_devices_select);
  bluetoothAllCheckbox=(CheckBox)rootView.findViewById(R.id.checkbox_bluetooth_all);
  enableWiFiCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_wifi);
  selectWiFiConnectionTextView=(TextView)rootView.findViewById(R.id.text_view_wifi_connection_select);
  enableLocationCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_location);
  nameLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_name);
  latLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_lat);
  lonLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_lon);
  radLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_rad);
  selectLocationTextView=(TextView)rootView.findViewById(R.id.text_view_select_location);
  setUpBluetoothElements();
  setUpWiFiElements();
  setUpLocationElements();
  setUpActionBar();
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_environment,container,false);
  environmentNameEditText=(EditText)rootView.findViewById(R.id.edit_text_environment_name);
  environmentHintEditText=(EditText)rootView.findViewById(R.id.edit_text_environment_hint);
  enableBluetoothCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_bluetooth);
  selectBluetoothDevicesTextView=(TextView)rootView.findViewById(R.id.text_view_bluetooth_devices_select);
  bluetoothAllCheckbox=(CheckBox)rootView.findViewById(R.id.checkbox_bluetooth_all);
  enableWiFiCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_wifi);
  selectWiFiConnectionTextView=(TextView)rootView.findViewById(R.id.text_view_wifi_connection_select);
  enableLocationCheckBox=(CheckBox)rootView.findViewById(R.id.checkbox_enable_location);
  nameLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_name);
  latLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_lat);
  lonLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_lon);
  radLocationEditText=(EditText)rootView.findViewById(R.id.edit_text_location_rad);
  selectLocationTextView=(TextView)rootView.findViewById(R.id.text_view_select_location);
  selectStoredLocationTextView=(TextView)rootView.findViewById(R.id.text_view_select_stored_location);
  setUpBluetoothElements();
  setUpWiFiElements();
  setUpLocationElements();
  setUpActionBar();
  return rootView;
}
Program: 87023
Project: 87023
Buggy source:
private long insertEnvironmentLocation(Uri uri,SQLiteDatabase db,ContentValues values){
  long environmentId=Long.parseLong(uri.getPathSegments().get(1));
  String geofenceSelection=GeoFenceEntry.COLUMN_COORD_LAT + "String_Node_Str" + GeoFenceEntry.COLUMN_COORD_LONG+ "String_Node_Str"+ GeoFenceEntry.COLUMN_RADIUS+ "String_Node_Str";
  String[] geofenceSelectionArgs=new String[]{values.getAsString(GeoFenceEntry.COLUMN_COORD_LAT),values.getAsString(GeoFenceEntry.COLUMN_COORD_LONG),values.getAsString(GeoFenceEntry.COLUMN_RADIUS)};
  Cursor geofenceCursor=db.query(GeoFenceEntry.TABLE_NAME,new String[]{GeoFenceEntry._ID},geofenceSelection,geofenceSelectionArgs,null,null,null);
  long geofenceId;
  if (geofenceCursor.getCount() == 0) {
    geofenceId=db.insert(GeoFenceEntry.TABLE_NAME,null,values);
  }
 else {
    geofenceCursor.moveToFirst();
    geofenceId=geofenceCursor.getLong(geofenceCursor.getColumnIndex(GeoFenceEntry._ID));
  }
  if (geofenceId == -1) {
    return -1;
  }
  ContentValues environmentContentValues=new ContentValues();
  environmentContentValues.put(EnvironmentEntry.COLUMN_IS_LOCATION_ENABLED,1);
  environmentContentValues.put(EnvironmentEntry.COLUMN_GEOFENCE_ID,geofenceId);
  return db.update(EnvironmentEntry.TABLE_NAME,environmentContentValues,EnvironmentEntry._ID + "String_Node_Str",new String[]{String.valueOf(environmentId)});
}

Fixed version (ground truth):
private long insertEnvironmentLocation(Uri uri,SQLiteDatabase db,ContentValues values){
  long environmentId=Long.parseLong(uri.getPathSegments().get(1));
  String geofenceSelection=GeoFenceEntry.COLUMN_LOCATION_NAME + "String_Node_Str";
  String[] geofenceSelectionArgs=new String[]{values.getAsString(GeoFenceEntry.COLUMN_LOCATION_NAME)};
  Cursor geofenceCursor=db.query(GeoFenceEntry.TABLE_NAME,null,geofenceSelection,geofenceSelectionArgs,null,null,null);
  long geofenceId;
  if (!geofenceCursor.moveToFirst()) {
    String receivedValues=values.getAsString(GeoFenceEntry.COLUMN_COORD_LAT) + "String_Node_Str" + values.getAsString(GeoFenceEntry.COLUMN_COORD_LONG)+ "String_Node_Str"+ values.getAsString(GeoFenceEntry.COLUMN_RADIUS);
    Log.d(LOG_TAG,"String_Node_Str" + receivedValues);
    geofenceId=db.insert(GeoFenceEntry.TABLE_NAME,null,values);
  }
 else {
    geofenceId=geofenceCursor.getLong(geofenceCursor.getColumnIndex(GeoFenceEntry._ID));
  }
  if (geofenceId == -1) {
    return -1;
  }
  ContentValues environmentContentValues=new ContentValues();
  environmentContentValues.put(EnvironmentEntry.COLUMN_IS_LOCATION_ENABLED,1);
  environmentContentValues.put(EnvironmentEntry.COLUMN_GEOFENCE_ID,geofenceId);
  return db.update(EnvironmentEntry.TABLE_NAME,environmentContentValues,EnvironmentEntry._ID + "String_Node_Str",new String[]{String.valueOf(environmentId)});
}
Program: 87025
Project: 87025
Buggy source:
public static List<EnvironmentVariable> getNoiseLevelEnvironmentVariablesFromCursor(Cursor environmentCursor){
  ArrayList<EnvironmentVariable> environmentVariables=new ArrayList<EnvironmentVariable>();
  try {
    if (environmentCursor.moveToFirst()) {
      for (; !environmentCursor.isAfterLast(); environmentCursor.moveToNext()) {
        boolean minNoiseEnabled=environmentCursor.getInt(environmentCursor.getColumnIndex(EnvironmentEntry.COLUMN_IS_MIN_NOISE_ENABLED)) == 1, maxNoiseEnabled=environmentCursor.getInt(environmentCursor.getColumnIndex(EnvironmentEntry.COLUMN_IS_MAX_NOISE_ENABLED)) == 1;
        if (minNoiseEnabled || maxNoiseEnabled) {
          environmentVariables.add(new NoiseLevelEnvironmentVariable(minNoiseEnabled,maxNoiseEnabled));
        }
      }
    }
  }
 catch (  Exception e) {
    Log.w(LOG_TAG,e + "String_Node_Str" + e.getMessage());
  }
  return environmentVariables;
}

Fixed version (ground truth):
public static List<EnvironmentVariable> getNoiseLevelEnvironmentVariablesFromCursor(Cursor environmentCursor){
  int initialCursorPosition=environmentCursor.getPosition();
  ArrayList<EnvironmentVariable> environmentVariables=new ArrayList<EnvironmentVariable>();
  try {
    if (environmentCursor.moveToFirst()) {
      for (; !environmentCursor.isAfterLast(); environmentCursor.moveToNext()) {
        boolean minNoiseEnabled=environmentCursor.getInt(environmentCursor.getColumnIndex(EnvironmentEntry.COLUMN_IS_MIN_NOISE_ENABLED)) == 1, maxNoiseEnabled=environmentCursor.getInt(environmentCursor.getColumnIndex(EnvironmentEntry.COLUMN_IS_MAX_NOISE_ENABLED)) == 1;
        if (minNoiseEnabled || maxNoiseEnabled) {
          environmentVariables.add(new NoiseLevelEnvironmentVariable(minNoiseEnabled,maxNoiseEnabled));
        }
      }
    }
  }
 catch (  Exception e) {
    Log.w(LOG_TAG,e + "String_Node_Str" + e.getMessage());
  }
  environmentCursor.moveToFirst();
  environmentCursor.move(initialCursorPosition);
  return environmentVariables;
}
Program: 87026
Project: 87026
Buggy source:
@Override public boolean handleMessage(Message msg){
switch (msg.what) {
case MSG_SERVICE_CONNECTED:
    mView.setVisibility(View.VISIBLE);
  mWindowManager.addView(mView,(LayoutParams)msg.obj);
return true;
case MSG_SERVICE_DISCONNECTED:
mView.setVisibility(View.GONE);
mWindowManager.removeView(mView);
return true;
case MSG_CANCEL:
if (mCallback != null) {
try {
mCallback.cancel();
}
 catch (RemoteException e) {
e.printStackTrace();
}
}
return true;
case MSG_ENABLE:
mPicturePassword.reset();
mPicturePassword.setShowNumbers(true,true);
mPicturePassword.setEnabled(true);
return true;
}
return false;
}

Fixed version (ground truth):
@Override public boolean handleMessage(Message msg){
switch (msg.what) {
case MSG_SERVICE_CONNECTED:
    mView.setVisibility(View.VISIBLE);
  mWindowManager.addView(mView,(LayoutParams)msg.obj);
return true;
case MSG_SERVICE_DISCONNECTED:
if (mView != null) {
mView.setVisibility(View.GONE);
mWindowManager.removeView(mView);
}
return true;
case MSG_CANCEL:
if (mCallback != null) {
try {
mCallback.cancel();
}
 catch (RemoteException e) {
e.printStackTrace();
}
}
return true;
case MSG_ENABLE:
mPicturePassword.reset();
mPicturePassword.setShowNumbers(true,true);
mPicturePassword.setEnabled(true);
return true;
}
return false;
}
Program: 87027
Project: 87027
Buggy source:
public FaceLockService(){
  binder=new Stub(){
    @Override public void startUi(    IBinder windowToken,    int x,    int y,    int w,    int h,    boolean useLiveliness) throws RemoteException {
      LayoutParams p=new LayoutParams(LayoutParams.TYPE_APPLICATION_PANEL);
      p.flags=LayoutParams.FLAG_HARDWARE_ACCELERATED | LayoutParams.FLAG_NOT_FOCUSABLE;
      p.token=windowToken;
      p.x=x;
      p.y=y;
      p.width=w;
      p.height=h;
      p.gravity=8388659;
      FaceLockService.this.mLayoutParams=p;
      FaceLockService.this.mHandler.obtainMessage(MSG_SERVICE_CONNECTED,p).sendToTarget();
      if (PicturePasswordUtils.getLockedOut(FaceLockService.this)) {
        lockOut(false);
      }
    }
    @Override public void stopUi() throws RemoteException {
      FaceLockService.this.mHandler.sendEmptyMessage(MSG_SERVICE_DISCONNECTED);
    }
    @Override public void registerCallback(    IFaceLockCallback callback) throws RemoteException {
      FaceLockService.this.mCallback=callback;
    }
    @Override public void unregisterCallback(    IFaceLockCallback callback) throws RemoteException {
      FaceLockService.this.mCallback=null;
    }
  }
;
}

Fixed version (ground truth):
public FaceLockService(){
  binder=new Stub(){
    @Override public void startUi(    IBinder windowToken,    int x,    int y,    int w,    int h,    boolean useLiveliness) throws RemoteException {
      DisplayMetrics metrics=new DisplayMetrics();
      mWindowManager.getDefaultDisplay().getRealMetrics(metrics);
      Log.d("String_Node_Str","String_Node_Str" + (y + h));
      if (y + h > metrics.heightPixels)       return;
      LayoutParams p=new LayoutParams(LayoutParams.TYPE_APPLICATION_PANEL);
      p.flags=LayoutParams.FLAG_HARDWARE_ACCELERATED | LayoutParams.FLAG_NOT_FOCUSABLE;
      p.token=windowToken;
      p.x=x;
      p.y=y;
      p.width=w;
      p.height=h;
      p.gravity=8388659;
      FaceLockService.this.mLayoutParams=p;
      FaceLockService.this.mHandler.obtainMessage(MSG_SERVICE_CONNECTED,p).sendToTarget();
      if (PicturePasswordUtils.getLockedOut(FaceLockService.this)) {
        lockOut(false);
      }
    }
    @Override public void stopUi() throws RemoteException {
      FaceLockService.this.mHandler.sendEmptyMessage(MSG_SERVICE_DISCONNECTED);
    }
    @Override public void registerCallback(    IFaceLockCallback callback) throws RemoteException {
      FaceLockService.this.mCallback=callback;
    }
    @Override public void unregisterCallback(    IFaceLockCallback callback) throws RemoteException {
      FaceLockService.this.mCallback=null;
    }
  }
;
}
Program: 87028
Project: 87028
Buggy source:
@Override public void startUi(IBinder windowToken,int x,int y,int w,int h,boolean useLiveliness) throws RemoteException {
  LayoutParams p=new LayoutParams(LayoutParams.TYPE_APPLICATION_PANEL);
  p.flags=LayoutParams.FLAG_HARDWARE_ACCELERATED | LayoutParams.FLAG_NOT_FOCUSABLE;
  p.token=windowToken;
  p.x=x;
  p.y=y;
  p.width=w;
  p.height=h;
  p.gravity=8388659;
  FaceLockService.this.mLayoutParams=p;
  FaceLockService.this.mHandler.obtainMessage(MSG_SERVICE_CONNECTED,p).sendToTarget();
  if (PicturePasswordUtils.getLockedOut(FaceLockService.this)) {
    lockOut(false);
  }
}

Fixed version (ground truth):
@Override public void startUi(IBinder windowToken,int x,int y,int w,int h,boolean useLiveliness) throws RemoteException {
  DisplayMetrics metrics=new DisplayMetrics();
  mWindowManager.getDefaultDisplay().getRealMetrics(metrics);
  Log.d("String_Node_Str","String_Node_Str" + (y + h));
  if (y + h > metrics.heightPixels)   return;
  LayoutParams p=new LayoutParams(LayoutParams.TYPE_APPLICATION_PANEL);
  p.flags=LayoutParams.FLAG_HARDWARE_ACCELERATED | LayoutParams.FLAG_NOT_FOCUSABLE;
  p.token=windowToken;
  p.x=x;
  p.y=y;
  p.width=w;
  p.height=h;
  p.gravity=8388659;
  FaceLockService.this.mLayoutParams=p;
  FaceLockService.this.mHandler.obtainMessage(MSG_SERVICE_CONNECTED,p).sendToTarget();
  if (PicturePasswordUtils.getLockedOut(FaceLockService.this)) {
    lockOut(false);
  }
}
Program: 87030
Project: 87030
Buggy source:
protected TriplePatternFragment createTriplePatternFragment(final Model triples,final long totalSize,final boolean isLastPage){
  return new TriplePatternFragmentImpl(triples,totalSize,request.getFragmentURL(),request.getDatasetURL(),request.getPageNumber(),isLastPage);
}

Fixed version (ground truth):
protected TriplePatternFragment createTriplePatternFragment(final Model triples,final long totalSize,final boolean isLastPage){
  final long pageNumber;
  if (request.isPageRequest())   pageNumber=request.getPageNumber();
 else   pageNumber=1L;
  return new TriplePatternFragmentImpl(triples,totalSize,request.getFragmentURL(),request.getDatasetURL(),pageNumber,isLastPage);
}
Program: 87031
Project: 87031
Buggy source:
/** 
 * Setup the multicast facilities.
 * @throws java.io.IOException
 */
public void setupNetworking() throws IOException {
  if (NetworkUtil.getNetworkInterface() == null) {
    LOG.error("String_Node_Str");
    return;
  }
  try {
    if (!NetworkUtil.getNetworkInterface().supportsMulticast()) {
      LOG.error("String_Node_Str");
      return;
    }
  }
 catch (  SocketException ex) {
    LOG.error("String_Node_Str",ex);
    return;
  }
  try {
    if (NetworkUtil.getNetworkInterface() == null || !NetworkUtil.getNetworkInterface().isUp()) {
      LOG.error("String_Node_Str");
      return;
    }
  }
 catch (  SocketException ex) {
    LOG.error("String_Node_Str",ex);
    return;
  }
  socket=new MulticastSocket(multicastPort);
  socket.setReuseAddress(true);
  socket.setTimeToLive(multicastTtl);
  group=InetAddress.getByName(multicastGroup);
  socket.joinGroup(new InetSocketAddress(group,multicastPort),NetworkUtil.getNetworkInterface());
  LOG.info("String_Node_Str");
  try {
    GossipMessage message=new GossipMessage(me.getIp(),me.getGossipPort(),me.getDataPort());
    message.setMillisecondsSinceMidnight(TimeUtil.getMillisecondsSinceMidnight());
    message.getTags().putAll(me.getTags());
    message.getMembers().add(MemberKey.getKey(me));
    message.getClock().add(me.getSequence().incrementAndGet());
    message.setPublicKey(me.getPublicKey());
    sendMessage(message);
  }
 catch (  IOException ex) {
    LOG.error("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * Setup the multicast facilities.
 * @throws java.io.IOException
 */
public void setupNetworking() throws IOException {
  if (NetworkUtil.getNetworkInterface() == null) {
    LOG.error("String_Node_Str");
    return;
  }
  try {
    if (!NetworkUtil.getNetworkInterface().supportsMulticast()) {
      LOG.error("String_Node_Str");
      return;
    }
  }
 catch (  SocketException ex) {
    LOG.error("String_Node_Str",ex);
    return;
  }
  try {
    if (NetworkUtil.getNetworkInterface() == null || !NetworkUtil.getNetworkInterface().isUp()) {
      LOG.error("String_Node_Str");
      return;
    }
  }
 catch (  SocketException ex) {
    LOG.error("String_Node_Str",ex);
    return;
  }
  socket=new MulticastSocket(multicastPort);
  socket.setReuseAddress(true);
  socket.setTimeToLive(multicastTtl);
  group=InetAddress.getByName(multicastGroup);
switch (Parameters.INSTANCE.currentOS()) {
case MAC_64:
case MAC_32:
    socket.joinGroup(new InetSocketAddress(group,multicastPort),NetworkUtil.getNetworkInterface());
  break;
case WIN_64:
case WIN_32:
case LINUX_64:
case LINUX_32:
default :
socket.joinGroup(group);
break;
}
LOG.info("String_Node_Str");
try {
GossipMessage message=new GossipMessage(me.getIp(),me.getGossipPort(),me.getDataPort());
message.setMillisecondsSinceMidnight(TimeUtil.getMillisecondsSinceMidnight());
message.getTags().putAll(me.getTags());
message.getMembers().add(MemberKey.getKey(me));
message.getClock().add(me.getSequence().incrementAndGet());
message.setPublicKey(me.getPublicKey());
sendMessage(message);
}
 catch (IOException ex) {
LOG.error("String_Node_Str",ex);
}
}
Program: 87033
Project: 87033
Buggy source:
@BeforeClass public static void init() throws InterruptedException {
  speaker1=Starter.bootstrap();
  speaker2=Starter.bootstrap();
  speaker2.addListener("String_Node_Str",listener);
  Thread.sleep(1000l);
}

Fixed version (ground truth):
@BeforeClass public static void init() throws InterruptedException {
  speaker1=Starter.bootstrap();
  speaker2=Starter.bootstrap();
  speaker2.addListener("String_Node_Str",listener);
  Thread.sleep(2000l);
}
Program: 87034
Project: 87034
Buggy source:
@BeforeClass public static void init() throws InterruptedException {
  Parameters.INSTANCE.setProperty(ClusterService.PROTOCOL_PROPERTY,"String_Node_Str");
  speaker1=Starter.bootstrap();
  speaker2=Starter.bootstrap();
  speaker2.addListener("String_Node_Str",listener);
  speaker2.addListener("String_Node_Str",delayedListener);
  Thread.sleep(1000l);
}

Fixed version (ground truth):
@BeforeClass public static void init() throws InterruptedException {
  Parameters.INSTANCE.setProperty(ClusterService.PROTOCOL_PROPERTY,"String_Node_Str");
  speaker1=Starter.bootstrap();
  speaker2=Starter.bootstrap();
  speaker2.addListener("String_Node_Str",listener);
  speaker2.addListener("String_Node_Str",delayedListener);
  Thread.sleep(2000l);
}
Program: 87036
Project: 87036
Buggy source:
public void testMessage() throws Exception {
  failed=false;
  speaker1.send("String_Node_Str",new EmptyMessage());
  EmptyMessage m=queue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  if (failed) {
    fail();
  }
  speaker1.send("String_Node_Str",new EmptyMessage());
  m=queue.poll(500l,TimeUnit.MILLISECONDS);
  assertNull(m);
  queue.clear();
}

Fixed version (ground truth):
@Test public void testMessage() throws Exception {
  failed=false;
  speaker1.send("String_Node_Str",new EmptyMessage());
  EmptyMessage m=queue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  if (failed) {
    fail();
  }
  speaker1.send("String_Node_Str",new EmptyMessage());
  m=queue.poll(500l,TimeUnit.MILLISECONDS);
  assertNull(m);
  queue.clear();
}
Program: 87037
Project: 87037
Buggy source:
private static void findNIC(){
  try {
    String networkInterfaceName=Parameters.INSTANCE.getProperty(NETWORK_INTERFACE_PROPETY);
    if (networkInterfaceName == null || "String_Node_Str".equals(networkInterfaceName)) {
switch (Parameters.INSTANCE.currentOS()) {
case WIN_64:
case WIN_32:
        networkInterfaceName="String_Node_Str";
      break;
case LINUX_64:
case LINUX_32:
    networkInterfaceName="String_Node_Str";
  break;
case MAC_64:
case MAC_32:
networkInterfaceName="String_Node_Str";
break;
default :
LOG.error("String_Node_Str");
}
}
nic=NetworkInterface.getByName(networkInterfaceName);
if (nic != null && !nic.isUp()) {
LOG.error("String_Node_Str" + networkInterfaceName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
if (nic != null) {
Enumeration e=nic.getInetAddresses();
while (e.hasMoreElements()) {
InetAddress i=(InetAddress)e.nextElement();
String address=i.getHostAddress();
if (!address.contains("String_Node_Str")) {
inetAddress=i;
ip=address;
break;
}
}
}
 else {
LOG.error("String_Node_Str" + networkInterfaceName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
}
 catch (SocketException ex) {
LOG.error("String_Node_Str",ex);
nic=null;
}
}

Fixed version (ground truth):
private static void findNIC(){
  try {
    String networkInterfaceName=Parameters.INSTANCE.getProperty(NETWORK_INTERFACE_PROPETY);
    if (networkInterfaceName == null || "String_Node_Str".equals(networkInterfaceName)) {
switch (Parameters.INSTANCE.currentOS()) {
case WIN_64:
case WIN_32:
        networkInterfaceName="String_Node_Str";
      break;
case LINUX_64:
case LINUX_32:
    networkInterfaceName="String_Node_Str";
  break;
case MAC_64:
case MAC_32:
networkInterfaceName="String_Node_Str";
break;
default :
LOG.error("String_Node_Str");
}
}
 else {
networkInterfaceName=networkInterfaceName.trim();
}
nic=NetworkInterface.getByName(networkInterfaceName);
if (nic != null && !nic.isUp()) {
LOG.error("String_Node_Str" + networkInterfaceName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
if (nic != null) {
Enumeration e=nic.getInetAddresses();
while (e.hasMoreElements()) {
InetAddress i=(InetAddress)e.nextElement();
String address=i.getHostAddress();
if (!address.contains("String_Node_Str")) {
inetAddress=i;
ip=address;
break;
}
}
}
 else {
LOG.error("String_Node_Str" + networkInterfaceName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
}
 catch (SocketException ex) {
LOG.error("String_Node_Str",ex);
nic=null;
}
}
Program: 87039
Project: 87039
Buggy source:
@Test public void testMessage() throws Exception {
  failed=false;
  List<List<Double>> doubles=new ArrayList<>();
  for (int i=0; i < 6; ++i) {
    List<Double> value=new ArrayList<>();
    for (int j=0; j < 6; ++j) {
      value.add(Math.random());
    }
    doubles.add(value);
  }
  LOG.info("String_Node_Str");
  speaker1.send("String_Node_Str",new MyMessage(MESSAGE + "String_Node_Str",doubles));
  MyMessage m=queue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  assertEquals(m.getMessage(),MESSAGE + "String_Node_Str");
  List<List<Double>> received=m.cov.a;
  for (int i=0; i < 6; ++i) {
    List<Double> value=doubles.get(i);
    List<Double> receivedValue=received.get(i);
    for (int j=0; j < 6; ++j) {
      LOG.info("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ value.get(j)+ "String_Node_Str"+ receivedValue.get(j));
      assertEquals(value.get(j),receivedValue.get(j),0.0001);
    }
  }
}

Fixed version (ground truth):
@Test public void testMessage() throws Exception {
  failed=false;
  List<List<Double>> doubles=new ArrayList<>();
  for (int i=0; i < 6; ++i) {
    List<Double> value=new ArrayList<>();
    for (int j=0; j < 6; ++j) {
      value.add(Math.random());
    }
    doubles.add(value);
  }
  speaker1.send("String_Node_Str",new MyMessage(MESSAGE + "String_Node_Str",doubles));
  MyMessage m=queue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  assertEquals(m.getMessage(),MESSAGE + "String_Node_Str");
  List<List<Double>> received=m.cov.a;
  for (int i=0; i < 6; ++i) {
    List<Double> value=doubles.get(i);
    List<Double> receivedValue=received.get(i);
    for (int j=0; j < 6; ++j) {
      LOG.info("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ value.get(j)+ "String_Node_Str"+ receivedValue.get(j));
      assertEquals(value.get(j),receivedValue.get(j),0.0001);
    }
  }
}
Program: 87040
Project: 87040
Buggy source:
@Test public void testFailMessage() throws Exception {
  failed=false;
  List<List<Double>> doubles=new ArrayList<>();
  for (int i=0; i < 6; ++i) {
    List<Double> value=new ArrayList<>();
    for (int j=0; j < 6; ++j) {
      value.add(Math.random());
    }
    doubles.add(value);
  }
  LOG.info("String_Node_Str");
  speaker1.send("String_Node_Str",new FailMessage(MESSAGE + "String_Node_Str",doubles));
  FailMessage m=failQueue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  assertEquals(m.getMessage(),MESSAGE + "String_Node_Str");
  List<List<Double>> received=m.cov.a;
  for (int i=0; i < 6; ++i) {
    List<Double> value=doubles.get(i);
    List<Double> receivedValue=received.get(i);
    for (int j=0; j < 6; ++j) {
      LOG.info("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ value.get(j)+ "String_Node_Str"+ receivedValue.get(j));
      assertEquals(value.get(j),receivedValue.get(j),0.0001);
    }
  }
}

Fixed version (ground truth):
@Test public void testFailMessage() throws Exception {
  failed=false;
  List<List<Double>> doubles=new ArrayList<>();
  for (int i=0; i < 6; ++i) {
    List<Double> value=new ArrayList<>();
    for (int j=0; j < 6; ++j) {
      value.add(Math.random());
    }
    doubles.add(value);
  }
  speaker1.send("String_Node_Str",new FailMessage(MESSAGE + "String_Node_Str",doubles));
  FailMessage m=failQueue.poll(2000l,TimeUnit.MILLISECONDS);
  assertNotNull(m);
  assertEquals(m.getMessage(),MESSAGE + "String_Node_Str");
  List<List<Double>> received=m.cov.a;
  for (int i=0; i < 6; ++i) {
    List<Double> value=doubles.get(i);
    List<Double> receivedValue=received.get(i);
    for (int j=0; j < 6; ++j) {
      assertEquals(value.get(j),receivedValue.get(j),0.0001);
    }
  }
}
Program: 87041
Project: 87041
Buggy source:
/** 
 * Shutdown communication objects.
 */
public void shutdown(){
  shuttingDown=true;
  gossiper.shutdown();
  try {
    multicast.shutdown();
  }
 catch (  InterruptedException ex) {
    LOG.warn("String_Node_Str",ex);
  }
  for (  Member member : memberHolder.getAllMembers()) {
    ((AbstractMember)member).shutdown();
  }
  memberHolder.clear();
}

Fixed version (ground truth):
/** 
 * Shutdown communication objects.
 */
public void shutdown(){
  shuttingDown=true;
  gossiper.shutdown();
  multicast.shutdown();
  for (  Member member : memberHolder.getAllMembers()) {
    ((AbstractMember)member).shutdown();
  }
  memberHolder.clear();
}
Program: 87042
Project: 87042
Buggy source:
/** 
 * Shutdown the discovery service.
 */
public void shutdown(){
  if (isEnabled() && workerGroup != null) {
    workerGroup.shutdownGracefully();
    try {
      join();
    }
 catch (    InterruptedException ex) {
      LOG.error("String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Shutdown the discovery service.
 */
public void shutdown(){
  if (isEnabled() && workerGroup != null) {
    workerGroup.shutdownGracefully();
    try {
      join();
    }
 catch (    InterruptedException ex) {
      LOG.warn("String_Node_Str",ex);
    }
  }
}
Program: 87044
Project: 87044
Buggy source:
public void removeRegistrations(List<Registration> regs){
  map.remove(regs);
}

Fixed version (ground truth):
public void removeRegistrations(List<Registration> regs){
  for (  Map<String,List<Registration>> allRegs : map.values()) {
    if (allRegs != null) {
      for (      String key : allRegs.keySet()) {
        allRegs.get(key).removeAll(regs);
      }
    }
  }
}
Program: 87045
Project: 87045
Buggy source:
public List<Member> getRegisteredMembers(String topic){
  List<Member> ret=new ArrayList<>();
  List<Registration> members=map.query(topic);
  for (  Registration reg : members) {
    ret.add(reg.getMember());
  }
  return ret;
}

Fixed version (ground truth):
public List<Member> getRegisteredMembers(String topic){
  List<Member> ret=new ArrayList<>();
  for (  Member member : map.keySet()) {
    Map<String,List<Registration>> allRegs=map.get(member);
    if (allRegs != null) {
      for (      String key : allRegs.keySet()) {
        if (key.equals(topic)) {
          ret.add(member);
        }
      }
    }
  }
  return ret;
}
Program: 87046
Project: 87046
Buggy source:
public void removeAllLocalListeners(String topic){
  List<Registration> regs=map.query(me,topic);
  if (!regs.isEmpty()) {
    LOG.trace("String_Node_Str" + regs.size() + "String_Node_Str");
    reactor.getConsumerRegistry().unregister(topic);
    map.remove(regs);
  }
 else {
    LOG.trace("String_Node_Str" + topic);
  }
}

Fixed version (ground truth):
public void removeAllLocalListeners(String topic){
  Map<String,List<Registration>> allRegs=map.get(me);
  if (allRegs != null) {
    List<Registration> regs=allRegs.get(topic);
    if (regs != null) {
      LOG.trace("String_Node_Str" + regs.size() + "String_Node_Str");
      reactor.getConsumerRegistry().unregister(topic);
      regs.clear();
    }
 else {
      LOG.trace("String_Node_Str" + topic);
    }
  }
}
Program: 87047
Project: 87047
Buggy source:
protected synchronized void registerMemberForTopic(String topic,String partition,Member member){
  Pattern pattern=Pattern.compile(partition);
  List<Registration> regs=map.query(member,topic,pattern);
  if (regs.isEmpty()) {
    Registration reg=new Registration(member,topic,pattern);
    map.add(reg);
    if (LOG.isTraceEnabled()) {
      LOG.trace(new StringBuilder().append("String_Node_Str").append(MemberKey.getKey(member)).append("String_Node_Str").append(topic).append("String_Node_Str").append(partition).append("String_Node_Str").toString());
    }
  }
}

Fixed version (ground truth):
protected synchronized void registerMemberForTopic(String topic,String partition,Member member){
  if (map.get(member) == null) {
    map.put(member,new HashMap<String,List<Registration>>());
  }
  if (map.get(member).get(topic) == null) {
    map.get(member).put(topic,new ArrayList<Registration>());
  }
  boolean found=false;
  for (  Registration reg : map.get(member).get(topic)) {
    if (topic.equals(reg.getTopic()) && partition.equals(reg.getPartition()) && member.equals(reg.getMember())) {
      found=true;
      break;
    }
  }
  if (!found) {
    Registration reg=new Registration(member,topic,partition);
    map.get(member).get(topic).add(reg);
    if (LOG.isTraceEnabled()) {
      LOG.trace(new StringBuilder().append(MemberKey.getKey(me)).append("String_Node_Str").append(MemberKey.getKey(member)).append("String_Node_Str").append(topic).append("String_Node_Str").append(partition).append("String_Node_Str").toString());
    }
  }
}
Program: 87048
Project: 87048
Buggy source:
public List<Registration> getAllRegistrations(){
  return map.query();
}

Fixed version (ground truth):
public List<Registration> getAllRegistrations(){
  List<Registration> ret=new ArrayList<>();
  for (  Map<String,List<Registration>> allRegs : map.values()) {
    if (allRegs != null) {
      for (      String key : allRegs.keySet()) {
        ret.addAll(allRegs.get(key));
      }
    }
  }
  return ret;
}
Program: 87049
Project: 87049
Buggy source:
public <T>void addLocalListener(String topic,String partition,final MessageListener<T> listener){
  Consumer<Event<Envelope>> consumer=new Consumer<Event<Envelope>>(){
    @Override public void accept(    Event<Envelope> m){
      try {
        listener.receive((T)m.getData().getMessage());
      }
 catch (      Throwable ex) {
        LOG.error("String_Node_Str",ex);
      }
    }
  }
;
  reactor.on(Selectors.regex(TopicUtils.getTopicString(topic,partition)),consumer);
  List<Registration> regs=map.query(me,topic);
  if (!regs.isEmpty()) {
    regs.get(0).setConsumer(consumer);
    regs.get(0).setListener(listener);
  }
 else {
    LOG.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
public <T>void addLocalListener(String topic,String partition,final MessageListener<T> listener){
  Consumer<Event<Envelope>> consumer=new Consumer<Event<Envelope>>(){
    @Override public void accept(    Event<Envelope> m){
      try {
        listener.receive((T)m.getData().getMessage());
      }
 catch (      Throwable ex) {
        LOG.error("String_Node_Str",ex);
      }
    }
  }
;
  reactor.on(Selectors.regex(TopicUtils.getTopicString(topic,partition)),consumer);
}
Program: 87050
Project: 87050
Buggy source:
/** 
 * @return the partition 
 */
public Pattern getPartition(){
  return partition;
}

Fixed version (ground truth):
/** 
 * @return the partition 
 */
public String getPartition(){
  return partition;
}
Program: 87051
Project: 87051
Buggy source:
/** 
 * @param partition the partition to set
 */
public void setPartition(Pattern partition){
  this.partition=partition;
}

Fixed version (ground truth):
/** 
 * @param partition the partition to set
 */
public void setPartition(String partition){
  this.partition=partition;
}
Program: 87052
Project: 87052
Buggy source:
public Registration(Member member,String topic,Pattern partition){
  this.member=member;
  this.topic=topic;
  this.partition=partition;
}

Fixed version (ground truth):
public Registration(Member member,String topic,String partition){
  this.member=member;
  this.topic=topic;
  this.partition=partition;
}
Program: 87053
Project: 87053
Buggy source:
@Override public void receive(SimpleMessage message){
  if (messageCount >= throwAway && !warmedUp) {
    LOG.info("String_Node_Str");
    warmedUp=true;
    messageCount=0;
    time=System.currentTimeMillis();
  }
  ++messageCount;
  if (messageCount > maxMessages) {
    running=false;
    LOG.info("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void receive(SimpleMessage message){
  if (messageCount >= throwAway && !warmedUp) {
    LOG.info("String_Node_Str");
    warmedUp=true;
    messageCount=0;
    memThread.start();
    time=System.currentTimeMillis();
  }
  ++messageCount;
  if (messageCount > maxMessages) {
    running=false;
    LOG.info("String_Node_Str");
  }
}