nus-yam/ex-repair huggingface dataset:
Program: 95026
Project: 95026
Buggy source:
IDroidPlannerApi connectToApi(ConnectionParameter connParams,IDroidPlannerApiCallback callback) throws RemoteException {
  ConcurrentHashMap<IBinder,IDroidPlannerApi> binderApis=dpApisCache.putIfAbsent(connParams,new ConcurrentHashMap<IBinder,IDroidPlannerApi>());
  return binderApis.putIfAbsent(callback.asBinder(),new DPApi(this,connParams,callback));
}

Fixed version (ground truth):
IDroidPlannerApi connectToApi(ConnectionParameter connParams,IDroidPlannerApiCallback callback) throws RemoteException {
  ConcurrentHashMap<IBinder,IDroidPlannerApi> binderApis=dpApisCache.get(connParams);
  if (binderApis == null) {
    binderApis=new ConcurrentHashMap<IBinder,IDroidPlannerApi>();
    ConcurrentHashMap<IBinder,IDroidPlannerApi> previous=dpApisCache.putIfAbsent(connParams,binderApis);
    if (previous != null)     binderApis=previous;
  }
  IBinder callbackBinder=callback.asBinder();
  IDroidPlannerApi dpApi=binderApis.get(callbackBinder);
  if (dpApi == null) {
    dpApi=new DPApi(this,connParams,callback);
    IDroidPlannerApi previous=binderApis.putIfAbsent(callbackBinder,dpApi);
    if (previous != null)     dpApi=previous;
  }
  return dpApi;
}
Program: 95027
Project: 95027
Buggy source:
boolean disconnectFromApi(ConnectionParameter connParams,IDroidPlannerApiCallback callback){
  ConcurrentHashMap<IBinder,IDroidPlannerApi> binderApis=dpApisCache.get(connParams);
  if (binderApis == null)   return false;
  boolean wasRemoved=binderApis.remove(callback.asBinder()) != null;
  if (binderApis.isEmpty()) {
    dpApisCache.remove(connParams);
    DroneManager droneMgr=dronePerConnection.remove(connParams);
    droneMgr.destroy();
  }
  return wasRemoved;
}

Fixed version (ground truth):
boolean disconnectFromApi(final ConnectionParameter connParams,IDroidPlannerApiCallback callback){
  ConcurrentHashMap<IBinder,IDroidPlannerApi> binderApis=dpApisCache.get(connParams);
  if (binderApis == null)   return false;
  boolean wasRemoved=binderApis.remove(callback.asBinder()) != null;
  if (binderApis.isEmpty()) {
    dpApisCache.remove(connParams);
    DroneManager droneMgr=dronePerConnection.remove(connParams);
    droneMgr.destroy();
    lbm.sendBroadcast(new Intent(ACTION_DRONE_DESTROYED));
  }
  return wasRemoved;
}
Program: 95028
Project: 95028
Buggy source:
DroneManager getDroneForConnection(ConnectionParameter params) throws ConnectionException {
  return dronePerConnection.putIfAbsent(params,new DroneManager(getApplicationContext(),params));
}

Fixed version (ground truth):
DroneManager getDroneForConnection(final ConnectionParameter params) throws ConnectionException {
  DroneManager droneMgr=dronePerConnection.get(params);
  if (droneMgr == null) {
    droneMgr=new DroneManager(getApplicationContext(),handler,params);
    DroneManager previous=dronePerConnection.putIfAbsent(params,droneMgr);
    if (previous != null)     droneMgr=previous;
    lbm.sendBroadcast(new Intent(ACTION_DRONE_CREATED));
  }
  return droneMgr;
}
Program: 95029
Project: 95029
Buggy source:
public void clear(){
  removeItemList(mMissionItems);
}

Fixed version (ground truth):
public void clear(){
  selection.clearSelection();
  removeItemList(mMissionItems);
}
Program: 95030
Project: 95030
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_send_mission:
    final MissionProxy missionProxy=app.getMissionProxy();
  if (drone.getMission().hasTakeoffAndLandOrRTL()) {
    missionProxy.sendMissionToAPM();
  }
 else {
    YesNoWithPrefsDialog dialog=YesNoWithPrefsDialog.newInstance(getApplicationContext(),"String_Node_Str","String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str",new YesNoDialog.Listener(){
      @Override public void onYes(){
        missionProxy.addTakeOffAndRTL();
        missionProxy.sendMissionToAPM();
      }
      @Override public void onNo(){
        missionProxy.sendMissionToAPM();
      }
    }
,getString(R.string.pref_auto_insert_mission_takeoff_rtl_land_key));
    if (dialog != null) {
      dialog.show(getSupportFragmentManager(),"String_Node_Str");
    }
  }
return true;
case R.id.menu_load_mission:
drone.getWaypointManager().getWaypoints();
return true;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_send_mission:
    final MissionProxy missionProxy=app.getMissionProxy();
  if (missionProxy.getItems().isEmpty() || drone.getMission().hasTakeoffAndLandOrRTL()) {
    missionProxy.sendMissionToAPM();
  }
 else {
    YesNoWithPrefsDialog dialog=YesNoWithPrefsDialog.newInstance(getApplicationContext(),"String_Node_Str","String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str",new YesNoDialog.Listener(){
      @Override public void onYes(){
        missionProxy.addTakeOffAndRTL();
        missionProxy.sendMissionToAPM();
      }
      @Override public void onNo(){
        missionProxy.sendMissionToAPM();
      }
    }
,getString(R.string.pref_auto_insert_mission_takeoff_rtl_land_key));
    if (dialog != null) {
      dialog.show(getSupportFragmentManager(),"String_Node_Str");
    }
  }
return true;
case R.id.menu_load_mission:
drone.getWaypointManager().getWaypoints();
return true;
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 95031
Project: 95031
Buggy source:
public void addTakeOffAndRTL(){
  if (!mMission.isFirstItemTakeoff()) {
    final Takeoff takeOff=new Takeoff(mMission,new Altitude(Takeoff.DEFAULT_TAKEOFF_ALTITUDE));
    mMissionItems.add(0,new MissionItemProxy(this,takeOff));
    mMission.addMissionItem(0,takeOff);
  }
  if (!mMission.isLastItemLandOrRTL()) {
    final ReturnToHome rtl=new ReturnToHome(mMission);
    mMissionItems.add(new MissionItemProxy(this,rtl));
    mMission.addMissionItem(rtl);
  }
}

Fixed version (ground truth):
public void addTakeOffAndRTL(){
  if (!mMission.isFirstItemTakeoff()) {
    Altitude defaultAlt=new Altitude(Takeoff.DEFAULT_TAKEOFF_ALTITUDE);
    if (!mMissionItems.isEmpty()) {
      MissionItem firstItem=mMissionItems.get(0).getMissionItem();
      if (firstItem instanceof SpatialCoordItem)       defaultAlt=new Altitude(((SpatialCoordItem)firstItem).getCoordinate().getAltitude().valueInMeters());
    }
    final Takeoff takeOff=new Takeoff(mMission,defaultAlt);
    mMissionItems.add(0,new MissionItemProxy(this,takeOff));
    mMission.addMissionItem(0,takeOff);
  }
  if (!mMission.isLastItemLandOrRTL()) {
    final ReturnToHome rtl=new ReturnToHome(mMission);
    mMissionItems.add(new MissionItemProxy(this,rtl));
    mMission.addMissionItem(rtl);
  }
}
Program: 95032
Project: 95032
Buggy source:
public void clear(){
  removeItemList(mMissionItems);
}

Fixed version (ground truth):
public void clear(){
  selection.clearSelection();
  removeItemList(mMissionItems);
}
Program: 95033
Project: 95033
Buggy source:
public boolean isLastItemLandOrRTL(){
  MissionItem last=items.get(items.size() - 1);
  return (last instanceof ReturnToHome) || (last instanceof Land);
}

Fixed version (ground truth):
public boolean isLastItemLandOrRTL(){
  if (items.isEmpty())   return false;
  MissionItem last=items.get(items.size() - 1);
  return (last instanceof ReturnToHome) || (last instanceof Land);
}
Program: 95034
Project: 95034
Buggy source:
public boolean isFirstItemTakeoff(){
  return items.get(0) instanceof Takeoff;
}

Fixed version (ground truth):
public boolean isFirstItemTakeoff(){
  return !items.isEmpty() && items.get(0) instanceof Takeoff;
}
Program: 95035
Project: 95035
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
switch (event) {
case MISSION_UPDATE:
    Length missionLength=missionProxy.getMissionLength();
  Speed speedParameter=drone.getSpeed().getSpeedParameter();
String infoString="String_Node_Str" + missionLength;
if (speedParameter != null) {
int time=(int)(missionLength.valueInMeters() / speedParameter.valueInMetersPerSecond());
infoString=infoString + String.format("String_Node_Str",time / 60,time % 60);
}
infoView.setText(infoString);
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
switch (event) {
case MISSION_UPDATE:
    Length missionLength=missionProxy.getMissionLength();
  Speed speedParameter=drone.getSpeed().getSpeedParameter();
String infoString="String_Node_Str" + missionLength;
if (speedParameter != null) {
int time=(int)(missionLength.valueInMeters() / speedParameter.valueInMetersPerSecond());
infoString=infoString + String.format("String_Node_Str",time / 60,time % 60);
}
infoView.setText(infoString);
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
break;
case MISSION_RECEIVED:
if (planningMapFragment != null) {
planningMapFragment.zoomToFit();
}
break;
default :
break;
}
}
Program: 95036
Project: 95036
Buggy source:
@Override public void onMarkerDragEnd(MarkerInfo markerInfo){
  checkForWaypointMarker(markerInfo);
  checkForPolygonMarker();
}

Fixed version (ground truth):
@Override public void onMarkerDragEnd(MarkerInfo markerInfo){
  checkForWaypointMarker(markerInfo);
}
Program: 95037
Project: 95037
Buggy source:
@Override public void onResume(){
  super.onResume();
  mMapFragment.selectAutoPanMode(mAppPrefs.getAutoPanMode());
  guidedModeOnLongPress=mAppPrefs.isGuidedModeOnLongPressEnabled();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  mMapFragment.selectAutoPanMode(mAppPrefs.getAutoPanMode());
  guidedModeOnLongPress=mAppPrefs.isGuidedModeOnLongPressEnabled();
  if (!didZoomOnUserLocation) {
    super.goToMyLocation();
    didZoomOnUserLocation=true;
  }
}
Program: 95038
Project: 95038
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
switch (event) {
case MISSION_UPDATE:
    Length missionLength=missionProxy.getMissionLength();
  Speed speedParameter=drone.getSpeed().getSpeedParameter();
String infoString="String_Node_Str" + missionLength;
if (speedParameter != null) {
int time=(int)(missionLength.valueInMeters() / speedParameter.valueInMetersPerSecond());
infoString=infoString + String.format("String_Node_Str",time / 60,time % 60);
}
infoView.setText(infoString);
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
switch (event) {
case MISSION_UPDATE:
    Length missionLength=missionProxy.getMissionLength();
  Speed speedParameter=drone.getSpeed().getSpeedParameter();
String infoString="String_Node_Str" + missionLength;
if (speedParameter != null) {
int time=(int)(missionLength.valueInMeters() / speedParameter.valueInMetersPerSecond());
infoString=infoString + String.format("String_Node_Str",time / 60,time % 60);
}
infoView.setText(infoString);
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
break;
case MISSION_RECEIVED:
if (planningMapFragment != null) {
planningMapFragment.zoomToFit();
}
break;
default :
break;
}
}
Program: 95039
Project: 95039
Buggy source:
@Override public boolean onActionItemClicked(ActionMode mode,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_action_multi_edit:
    if (mMultiEditEnabled) {
      removeItemDetail();
      enableMultiEdit(false);
      return true;
    }
  final List<MissionItemProxy> selectedProxies=missionProxy.selection.getSelected();
if (selectedProxies.size() >= 1) {
  showItemDetail(selectMissionDetailType(selectedProxies));
  enableMultiEdit(true);
  return true;
}
Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
return true;
case R.id.menu_action_delete:
missionProxy.removeSelection(missionProxy.selection);
mode.finish();
return true;
case R.id.menu_action_reverse:
missionProxy.reverse();
return true;
default :
return false;
}
}

Fixed version (ground truth):
@Override public boolean onActionItemClicked(ActionMode mode,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_action_multi_edit:
    if (mMultiEditEnabled) {
      removeItemDetail();
      enableMultiEdit(false);
      return true;
    }
  final List<MissionItemProxy> selectedProxies=missionProxy.selection.getSelected();
if (selectedProxies.size() >= 1) {
  showItemDetail(selectMissionDetailType(selectedProxies));
  enableMultiEdit(true);
  return true;
}
Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
return true;
case R.id.menu_action_delete:
missionProxy.removeSelection(missionProxy.selection);
mode.finish();
planningMapFragment.zoomToFit();
return true;
case R.id.menu_action_reverse:
missionProxy.reverse();
return true;
default :
return false;
}
}
Program: 95040
Project: 95040
Buggy source:
@Override public void onItemClick(MissionItemProxy item){
  enableMultiEdit(false);
switch (getTool()) {
default :
    if (contextualActionBar != null) {
      if (missionProxy.selection.selectionContains(item)) {
        missionProxy.selection.removeItemFromSelection(item);
      }
 else {
        missionProxy.selection.addToSelection(item);
      }
    }
 else {
      if (missionProxy.selection.selectionContains(item)) {
        missionProxy.selection.clearSelection();
      }
 else {
        editorToolsFragment.setTool(EditorTools.NONE);
        missionProxy.selection.setSelectionTo(item);
      }
    }
  break;
case TRASH:
missionProxy.removeItem(item);
missionProxy.selection.clearSelection();
if (missionProxy.getItems().size() <= 0) {
editorToolsFragment.setTool(EditorTools.NONE);
}
break;
}
}

Fixed version (ground truth):
@Override public void onItemClick(MissionItemProxy item,boolean zoomToFit){
  enableMultiEdit(false);
switch (getTool()) {
default :
    if (contextualActionBar != null) {
      if (missionProxy.selection.selectionContains(item)) {
        missionProxy.selection.removeItemFromSelection(item);
      }
 else {
        missionProxy.selection.addToSelection(item);
      }
    }
 else {
      if (missionProxy.selection.selectionContains(item)) {
        missionProxy.selection.clearSelection();
      }
 else {
        editorToolsFragment.setTool(EditorTools.NONE);
        missionProxy.selection.setSelectionTo(item);
      }
    }
  break;
case TRASH:
missionProxy.removeItem(item);
missionProxy.selection.clearSelection();
if (missionProxy.getItems().size() <= 0) {
editorToolsFragment.setTool(EditorTools.NONE);
}
break;
}
if (zoomToFit) {
List<MissionItemProxy> selected=missionProxy.selection.getSelected();
if (selected.isEmpty()) {
planningMapFragment.zoomToFit();
}
 else {
planningMapFragment.zoomToFit(MissionProxy.getVisibleCoords(selected));
}
}
}
Program: 95041
Project: 95041
Buggy source:
public void onItemClick(MissionItemProxy item);

Fixed version (ground truth):
public void onItemClick(MissionItemProxy item,boolean zoomToFit);
Program: 95042
Project: 95042
Buggy source:
@Override public void onItemClick(AdapterView<?> adapter,View view,int position,long id){
  MissionItemProxy missionItem=(MissionItemProxy)adapter.getItemAtPosition(position);
  editorListener.onItemClick(missionItem);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapter,View view,int position,long id){
  MissionItemProxy missionItem=(MissionItemProxy)adapter.getItemAtPosition(position);
  editorListener.onItemClick(missionItem,true);
}
Program: 95043
Project: 95043
Buggy source:
@Override public void onMarkerDragEnd(MarkerInfo markerInfo){
  checkForWaypointMarker(markerInfo);
  checkForPolygonMarker();
}

Fixed version (ground truth):
@Override public void onMarkerDragEnd(MarkerInfo markerInfo){
  checkForWaypointMarker(markerInfo);
}
Program: 95044
Project: 95044
Buggy source:
public void zoomToFit(){
  final List<Coord2D> visibleCoords=missionProxy.getVisibleCoords();
  final Coord2D homeCoord=drone.getHome().getCoord();
  if (homeCoord != null && !homeCoord.isEmpty())   visibleCoords.add(homeCoord);
  mMapFragment.zoomToFit(visibleCoords);
}

Fixed version (ground truth):
public void zoomToFit(List<Coord2D> itemsToFit){
  if (!itemsToFit.isEmpty()) {
    mMapFragment.zoomToFit(itemsToFit);
  }
}
Program: 95045
Project: 95045
Buggy source:
@Override public boolean onMarkerClick(MarkerInfo info){
  if (info instanceof MissionItemMarkerInfo) {
    editorListener.onItemClick(((MissionItemMarkerInfo)info).getMarkerOrigin());
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean onMarkerClick(MarkerInfo info){
  if (info instanceof MissionItemMarkerInfo) {
    editorListener.onItemClick(((MissionItemMarkerInfo)info).getMarkerOrigin(),false);
    return true;
  }
 else {
    return false;
  }
}
Program: 95046
Project: 95046
Buggy source:
@Override public void onResume(){
  super.onResume();
  mMapFragment.selectAutoPanMode(mAppPrefs.getAutoPanMode());
  guidedModeOnLongPress=mAppPrefs.isGuidedModeOnLongPressEnabled();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  mMapFragment.selectAutoPanMode(mAppPrefs.getAutoPanMode());
  guidedModeOnLongPress=mAppPrefs.isGuidedModeOnLongPressEnabled();
  if (!didZoomOnUserLocation) {
    super.goToMyLocation();
    didZoomOnUserLocation=true;
  }
}
Program: 95047
Project: 95047
Buggy source:
@Override public void run(){
  final List<MarkerInfo> missionMarkerInfos=missionProxy.getMarkersInfos();
  final boolean isThereMissionMarkers=!missionMarkerInfos.isEmpty();
  final boolean isHomeValid=home.isValid();
  final Set<MarkerInfo> markersOnTheMap=mMapFragment.getMarkerInfoList();
  if (!markersOnTheMap.isEmpty()) {
    if (isHomeValid) {
      markersOnTheMap.remove(home);
    }
    if (isThereMissionMarkers) {
      markersOnTheMap.removeAll(missionMarkerInfos);
    }
    mMapFragment.removeMarkers(markersOnTheMap);
  }
  if (isHomeValid) {
    mMapFragment.updateMarker(home);
  }
  if (isThereMissionMarkers) {
    mMapFragment.updateMarkers(missionMarkerInfos,isMissionDraggable());
  }
  mMapFragment.updateMissionPath(missionProxy);
  mHandler.removeCallbacks(this);
}

Fixed version (ground truth):
@Override public void run(){
  final List<MarkerInfo> missionMarkerInfos=missionProxy.getMarkersInfos();
  final boolean isThereMissionMarkers=!missionMarkerInfos.isEmpty();
  final boolean isHomeValid=home.isValid();
  final boolean isGuidedVisible=guided.isVisible();
  final Set<MarkerInfo> markersOnTheMap=mMapFragment.getMarkerInfoList();
  if (!markersOnTheMap.isEmpty()) {
    if (isHomeValid) {
      markersOnTheMap.remove(home);
    }
    if (isGuidedVisible) {
      markersOnTheMap.remove(guided);
    }
    if (isThereMissionMarkers) {
      markersOnTheMap.removeAll(missionMarkerInfos);
    }
    mMapFragment.removeMarkers(markersOnTheMap);
  }
  if (isHomeValid) {
    mMapFragment.updateMarker(home);
  }
  if (isGuidedVisible) {
    mMapFragment.updateMarker(guided);
  }
  if (isThereMissionMarkers) {
    mMapFragment.updateMarkers(missionMarkerInfos,isMissionDraggable());
  }
  mMapFragment.updateMissionPath(missionProxy);
  mHandler.removeCallbacks(this);
}
Program: 95048
Project: 95048
Buggy source:
@Override public void enableLocationUpdates(){
  mSpeedReadings=0;
  mTotalSpeed=0f;
  LocationRequest mLocationRequest=LocationRequest.create();
  mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
  mLocationRequest.setInterval(MIN_TIME_MS);
  mLocationRequest.setFastestInterval(MIN_TIME_MS);
  mLocationRequest.setSmallestDisplacement(MIN_DISTANCE_M);
  mLocationClient.requestLocationUpdates(mLocationRequest,this);
}

Fixed version (ground truth):
@Override public void enableLocationUpdates(){
  mSpeedReadings=0;
  mTotalSpeed=0f;
  gApiMgr.addTask(requestLocationUpdate);
}
Program: 95049
Project: 95049
Buggy source:
private boolean isLocationAccurate(float accuracy,float currentSpeed){
  if (accuracy >= LOCATION_ACCURACY_THRESHOLD) {
    return false;
  }
  mTotalSpeed+=currentSpeed;
  float avg=(mTotalSpeed / ++mSpeedReadings);
  if (currentSpeed > 0) {
    if (avg >= 1.0) {
      if (currentSpeed >= (avg * JUMP_FACTOR)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isLocationAccurate(float accuracy,float currentSpeed){
  if (accuracy >= LOCATION_ACCURACY_THRESHOLD) {
    Log.d(TAG,"String_Node_Str" + accuracy);
    return false;
  }
  mTotalSpeed+=currentSpeed;
  float avg=(mTotalSpeed / ++mSpeedReadings);
  if (currentSpeed > 0) {
    if (avg >= 1.0) {
      if (currentSpeed >= (avg * JUMP_FACTOR)) {
        Log.d(TAG,"String_Node_Str" + currentSpeed);
        return false;
      }
    }
  }
  return true;
}
Program: 95050
Project: 95050
Buggy source:
public FusedLocation(Context context){
  mLocationClient=new LocationClient(context,this,this);
  mLocationClient.connect();
}

Fixed version (ground truth):
public FusedLocation(Context context){
  gApiMgr=new GoogleApiClientManager(context,LocationServices.API);
  requestLocationUpdate=gApiMgr.new GoogleApiClientTask(){
    @Override protected void doRun(){
      final LocationRequest locationRequest=LocationRequest.create();
      locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
      locationRequest.setInterval(MIN_TIME_MS);
      locationRequest.setFastestInterval(MIN_TIME_MS);
      locationRequest.setSmallestDisplacement(MIN_DISTANCE_M);
      LocationServices.FusedLocationApi.requestLocationUpdates(getGoogleApiClient(),locationRequest,FusedLocation.this);
    }
  }
;
  removeLocationUpdate=gApiMgr.new GoogleApiClientTask(){
    @Override protected void doRun(){
      LocationServices.FusedLocationApi.removeLocationUpdates(getGoogleApiClient(),FusedLocation.this);
    }
  }
;
  gApiMgr.start();
}
Program: 95051
Project: 95051
Buggy source:
@Override public void disableLocationUpdates(){
  if (mLocationClient.isConnected()) {
    mLocationClient.removeLocationUpdates(this);
  }
}

Fixed version (ground truth):
@Override public void disableLocationUpdates(){
  gApiMgr.addTask(removeLocationUpdate);
}
Program: 95052
Project: 95052
Buggy source:
@Override public void onLocationChanged(Location androidLocation){
  if (receiver != null) {
    float distanceToLast=-1.0f;
    long timeSinceLast=-1L;
    if (mLastLocation != null) {
      distanceToLast=androidLocation.distanceTo(mLastLocation);
      timeSinceLast=(androidLocation.getTime() - mLastLocation.getTime());
    }
    final float currentSpeed=distanceToLast > 0f && timeSinceLast > 0 ? (distanceToLast / (timeSinceLast / 1000)) : 0f;
    org.droidplanner.core.gcs.location.Location location=new org.droidplanner.core.gcs.location.Location(new Coord2D(androidLocation.getLatitude(),androidLocation.getLongitude()),androidLocation.getBearing(),androidLocation.getSpeed(),isLocationAccurate(androidLocation.getAccuracy(),currentSpeed));
    mLastLocation=androidLocation;
    receiver.onLocationChanged(location);
  }
}

Fixed version (ground truth):
@Override public void onLocationChanged(Location androidLocation){
  if (receiver != null) {
    float distanceToLast=-1.0f;
    long timeSinceLast=-1L;
    if (mLastLocation != null) {
      distanceToLast=androidLocation.distanceTo(mLastLocation);
      timeSinceLast=(androidLocation.getTime() - mLastLocation.getTime()) / 1000;
    }
    final float currentSpeed=distanceToLast > 0f && timeSinceLast > 0 ? (distanceToLast / timeSinceLast) : 0f;
    final boolean isLocationAccurate=isLocationAccurate(androidLocation.getAccuracy(),currentSpeed);
    Log.d(TAG,"String_Node_Str" + isLocationAccurate);
    org.droidplanner.core.gcs.location.Location location=new org.droidplanner.core.gcs.location.Location(new Coord2D(androidLocation.getLatitude(),androidLocation.getLongitude()),androidLocation.getBearing(),androidLocation.getSpeed(),isLocationAccurate);
    mLastLocation=androidLocation;
    receiver.onLocationChanged(location);
  }
}
Program: 95054
Project: 95054
Buggy source:
private void enableSlidingUpPanel(Drone drone){
  if (mSlidingPanel == null) {
    return;
  }
  final State droneState=drone.getState();
  final boolean isEnabled=drone.getMavClient().isConnected() && droneState.isArmed() && droneState.isFlying();
  if (isEnabled) {
    mSlidingPanel.setSlidingEnabled(true);
  }
 else {
    if (!mSlidingPanelCollapsing.get()) {
      if (mSlidingPanel.isPanelExpanded()) {
        mSlidingPanel.setPanelSlideListener(mDisablePanelSliding);
        mSlidingPanel.collapsePanel();
        mSlidingPanelCollapsing.set(true);
      }
 else {
        mSlidingPanel.setSlidingEnabled(false);
        mSlidingPanelCollapsing.set(false);
      }
    }
  }
}

Fixed version (ground truth):
private void enableSlidingUpPanel(Drone drone){
  if (mSlidingPanel == null) {
    return;
  }
  final boolean isEnabled=flightActions != null && flightActions.isSlidingUpPanelEnabled(drone);
  if (isEnabled) {
    mSlidingPanel.setSlidingEnabled(true);
  }
 else {
    if (!mSlidingPanelCollapsing.get()) {
      if (mSlidingPanel.isPanelExpanded()) {
        mSlidingPanel.setPanelSlideListener(mDisablePanelSliding);
        mSlidingPanel.collapsePanel();
        mSlidingPanelCollapsing.set(true);
      }
 else {
        mSlidingPanel.setSlidingEnabled(false);
        mSlidingPanelCollapsing.set(false);
      }
    }
  }
}
Program: 95055
Project: 95055
Buggy source:
private void selectActionsBar(int droneType){
  final FragmentManager fm=getChildFragmentManager();
  Fragment actionsBarFragment;
  if (Type.isCopter(droneType)) {
    actionsBarFragment=new CopterFlightActionsFragment();
  }
 else   if (Type.isPlane(droneType)) {
    actionsBarFragment=new PlaneFlightActionsFragment();
  }
 else {
    actionsBarFragment=new GenericActionsFragment();
  }
  fm.beginTransaction().replace(R.id.flight_actions_bar,actionsBarFragment).commit();
}

Fixed version (ground truth):
private void selectActionsBar(int droneType){
  final FragmentManager fm=getChildFragmentManager();
  Fragment actionsBarFragment;
  if (Type.isCopter(droneType)) {
    actionsBarFragment=new CopterFlightActionsFragment();
  }
 else   if (Type.isPlane(droneType)) {
    actionsBarFragment=new PlaneFlightActionsFragment();
  }
 else {
    actionsBarFragment=new GenericActionsFragment();
  }
  fm.beginTransaction().replace(R.id.flight_actions_bar,actionsBarFragment).commit();
  header=(SlidingUpHeader)actionsBarFragment;
}
Program: 95056
Project: 95056
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
  connectBtn.setOnClickListener(this);
}
Program: 95057
Project: 95057
Buggy source:
public void doGuidedTakeoff(Altitude alt){
  if (Type.isCopter(myDrone.getType())) {
    coord=myDrone.getGps().getPosition();
    altitude.set(alt.valueInMeters());
    state=GuidedStates.IDLE;
    changeToGuidedMode();
    MavLinkTakeoff.sendTakeoff(myDrone,alt);
    myDrone.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
  }
}

Fixed version (ground truth):
public void doGuidedTakeoff(Altitude alt){
  if (Type.isCopter(myDrone.getType())) {
    coord=myDrone.getGps().getPosition();
    altitude.set(alt.valueInMeters());
    state=GuidedStates.IDLE;
    changeToGuidedMode(myDrone);
    MavLinkTakeoff.sendTakeoff(myDrone,alt);
    myDrone.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
  }
}
Program: 95058
Project: 95058
Buggy source:
public void forcedGuidedCoordinate(final Coord2D coord) throws Exception {
  if ((myDrone.getGps().getFixTypeNumeric() != GPS.LOCK_3D)) {
    throw new Exception("String_Node_Str");
  }
  if (isInitialized()) {
    changeCoord(coord);
  }
 else {
    mPostInitializationTask=new Runnable(){
      @Override public void run(){
        changeCoord(coord);
      }
    }
;
    changeToGuidedMode();
  }
}

Fixed version (ground truth):
public void forcedGuidedCoordinate(final Coord2D coord) throws Exception {
  if ((myDrone.getGps().getFixTypeNumeric() != GPS.LOCK_3D)) {
    throw new Exception("String_Node_Str");
  }
  if (isInitialized()) {
    changeCoord(coord);
  }
 else {
    mPostInitializationTask=new Runnable(){
      @Override public void run(){
        changeCoord(coord);
      }
    }
;
    changeToGuidedMode(myDrone);
  }
}
Program: 95059
Project: 95059
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MODE:
    if (isGuidedMode()) {
      initialize();
    }
 else {
      disable();
    }
  break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
disable();
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MODE:
    if (isGuidedMode(myDrone)) {
      initialize();
    }
 else {
      disable();
    }
  break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
disable();
default :
break;
}
}
Program: 95060
Project: 95060
Buggy source:
public void pauseAtCurrentLocation(){
  if (state != GuidedStates.ACTIVE) {
    changeToGuidedMode();
  }
 else {
    newGuidedCoord(myDrone.getGps().getPosition());
  }
}

Fixed version (ground truth):
public void pauseAtCurrentLocation(){
  if (state != GuidedStates.ACTIVE) {
    changeToGuidedMode(myDrone);
  }
 else {
    newGuidedCoord(myDrone.getGps().getPosition());
  }
}
Program: 95061
Project: 95061
Buggy source:
private double getDroneAltConstrained(){
  double alt=Math.floor(myDrone.getAltitude().getAltitude());
  return Math.max(alt,getMinAltitude(myDrone));
}

Fixed version (ground truth):
private static double getDroneAltConstrained(Drone drone){
  double alt=Math.floor(drone.getAltitude().getAltitude());
  return Math.max(alt,getMinAltitude(drone));
}
Program: 95062
Project: 95062
Buggy source:
private void initialize(){
  if (state == GuidedStates.UNINITIALIZED) {
    coord=myDrone.getGps().getPosition();
    altitude.set(getDroneAltConstrained());
    state=GuidedStates.IDLE;
    myDrone.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
  }
  if (mPostInitializationTask != null) {
    mPostInitializationTask.run();
    mPostInitializationTask=null;
  }
}

Fixed version (ground truth):
private void initialize(){
  if (state == GuidedStates.UNINITIALIZED) {
    coord=myDrone.getGps().getPosition();
    altitude.set(getDroneAltConstrained(myDrone));
    state=GuidedStates.IDLE;
    myDrone.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
  }
  if (mPostInitializationTask != null) {
    mPostInitializationTask.run();
    mPostInitializationTask=null;
  }
}
Program: 95063
Project: 95063
Buggy source:
private boolean isGuidedMode(){
  final int droneType=myDrone.getType();
  final ApmModes droneMode=myDrone.getState().getMode();
  if (Type.isCopter(droneType)) {
    return droneMode == ApmModes.ROTOR_GUIDED;
  }
  if (Type.isPlane(droneType)) {
    return droneMode == ApmModes.FIXED_WING_GUIDED;
  }
  if (Type.isRover(droneType)) {
    return droneMode == ApmModes.ROVER_GUIDED;
  }
  return false;
}

Fixed version (ground truth):
public static boolean isGuidedMode(Drone drone){
  final int droneType=drone.getType();
  final ApmModes droneMode=drone.getState().getMode();
  if (Type.isCopter(droneType)) {
    return droneMode == ApmModes.ROTOR_GUIDED;
  }
  if (Type.isPlane(droneType)) {
    return droneMode == ApmModes.FIXED_WING_GUIDED;
  }
  if (Type.isRover(droneType)) {
    return droneMode == ApmModes.ROVER_GUIDED;
  }
  return false;
}
Program: 95064
Project: 95064
Buggy source:
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    myDrone.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
    MavLinkModes.setGuidedMode(myDrone,coord.getLat(),coord.getLng(),altitude.valueInMeters());
  }
}

Fixed version (ground truth):
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    forceSendGuidedPoint(myDrone,coord,altitude.valueInMeters());
  }
}
Program: 95065
Project: 95065
Buggy source:
private void changeToGuidedMode(){
  final State droneState=myDrone.getState();
  final int droneType=myDrone.getType();
  if (Type.isCopter(droneType)) {
    droneState.changeFlightMode(ApmModes.ROTOR_GUIDED);
  }
 else   if (Type.isPlane(droneType)) {
    droneState.changeFlightMode(ApmModes.FIXED_WING_GUIDED);
  }
 else   if (Type.isRover(droneType)) {
    droneState.changeFlightMode(ApmModes.ROVER_GUIDED);
  }
}

Fixed version (ground truth):
public static void changeToGuidedMode(Drone drone){
  final State droneState=drone.getState();
  final int droneType=drone.getType();
  if (Type.isCopter(droneType)) {
    droneState.changeFlightMode(ApmModes.ROTOR_GUIDED);
  }
 else   if (Type.isPlane(droneType)) {
    forceSendGuidedPoint(drone,drone.getGps().getPosition(),getDroneAltConstrained(drone));
  }
 else   if (Type.isRover(droneType)) {
    droneState.changeFlightMode(ApmModes.ROVER_GUIDED);
  }
}
Program: 95066
Project: 95066
Buggy source:
private void disableFollowMe(){
  locationFinder.disableLocationUpdates();
  if (isEnabled()) {
    state=FollowStates.FOLLOW_END;
    MavLinkROI.resetROI(drone);
    if (isGuidedMode()) {
      drone.getGuidedPoint().pauseAtCurrentLocation();
    }
    drone.notifyDroneEvent(DroneEventsType.FOLLOW_STOP);
  }
}

Fixed version (ground truth):
private void disableFollowMe(){
  locationFinder.disableLocationUpdates();
  if (isEnabled()) {
    state=FollowStates.FOLLOW_END;
    MavLinkROI.resetROI(drone);
    if (GuidedPoint.isGuidedMode(drone)) {
      drone.getGuidedPoint().pauseAtCurrentLocation();
    }
    drone.notifyDroneEvent(DroneEventsType.FOLLOW_STOP);
  }
}
Program: 95067
Project: 95067
Buggy source:
public void toggleFollowMeState(){
  final State droneState=drone.getState();
  if (droneState == null) {
    state=FollowStates.FOLLOW_INVALID_STATE;
    return;
  }
  if (isEnabled()) {
    disableFollowMe();
  }
 else {
    if (drone.getMavClient().isConnected()) {
      if (drone.getState().isArmed()) {
        changeToGuidedMode();
        enableFollowMe();
      }
 else {
        state=FollowStates.FOLLOW_DRONE_NOT_ARMED;
      }
    }
 else {
      state=FollowStates.FOLLOW_DRONE_DISCONNECTED;
    }
  }
}

Fixed version (ground truth):
public void toggleFollowMeState(){
  final State droneState=drone.getState();
  if (droneState == null) {
    state=FollowStates.FOLLOW_INVALID_STATE;
    return;
  }
  if (isEnabled()) {
    disableFollowMe();
  }
 else {
    if (drone.getMavClient().isConnected()) {
      if (drone.getState().isArmed()) {
        GuidedPoint.changeToGuidedMode(drone);
        enableFollowMe();
      }
 else {
        state=FollowStates.FOLLOW_DRONE_NOT_ARMED;
      }
    }
 else {
      state=FollowStates.FOLLOW_DRONE_DISCONNECTED;
    }
  }
}
Program: 95068
Project: 95068
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MODE:
    if (!isGuidedMode()) {
      disableFollowMe();
    }
  break;
case DISCONNECTED:
disableFollowMe();
break;
default :
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MODE:
    if (!GuidedPoint.isGuidedMode(drone)) {
      disableFollowMe();
    }
  break;
case DISCONNECTED:
disableFollowMe();
break;
default :
}
}
Program: 95069
Project: 95069
Buggy source:
@Override public void run(){
  final List<MarkerInfo> missionMarkerInfos=missionProxy.getMarkersInfos();
  final boolean isThereMissionMarkers=!missionMarkerInfos.isEmpty();
  final boolean isHomeValid=home.isValid();
  final Set<MarkerInfo> markersOnTheMap=mMapFragment.getMarkerInfoList();
  if (!markersOnTheMap.isEmpty()) {
    if (isHomeValid) {
      markersOnTheMap.remove(home);
    }
    if (isThereMissionMarkers) {
      markersOnTheMap.removeAll(missionMarkerInfos);
    }
    mMapFragment.removeMarkers(markersOnTheMap);
  }
  if (isHomeValid) {
    mMapFragment.updateMarker(home);
  }
  if (isThereMissionMarkers) {
    mMapFragment.updateMarkers(missionMarkerInfos,isMissionDraggable());
  }
  mMapFragment.updateMissionPath(missionProxy);
  mHandler.removeCallbacks(this);
}

Fixed version (ground truth):
@Override public void run(){
  final List<MarkerInfo> missionMarkerInfos=missionProxy.getMarkersInfos();
  final boolean isThereMissionMarkers=!missionMarkerInfos.isEmpty();
  final boolean isHomeValid=home.isValid();
  final boolean isGuidedVisible=guided.isVisible();
  final Set<MarkerInfo> markersOnTheMap=mMapFragment.getMarkerInfoList();
  if (!markersOnTheMap.isEmpty()) {
    if (isHomeValid) {
      markersOnTheMap.remove(home);
    }
    if (isGuidedVisible) {
      markersOnTheMap.remove(guided);
    }
    if (isThereMissionMarkers) {
      markersOnTheMap.removeAll(missionMarkerInfos);
    }
    mMapFragment.removeMarkers(markersOnTheMap);
  }
  if (isHomeValid) {
    mMapFragment.updateMarker(home);
  }
  if (isGuidedVisible) {
    mMapFragment.updateMarker(guided);
  }
  if (isThereMissionMarkers) {
    mMapFragment.updateMarkers(missionMarkerInfos,isMissionDraggable());
  }
  mMapFragment.updateMissionPath(missionProxy);
  mHandler.removeCallbacks(this);
}
Program: 95070
Project: 95070
Buggy source:
@Override public void post(Runnable thread){
  new Thread(thread).start();
}

Fixed version (ground truth):
@Override public void post(Runnable thread){
  scheduler.execute(thread);
}
Program: 95071
Project: 95071
Buggy source:
static Handler fakeHandler(){
  return new Handler(){
    @Override public void removeCallbacks(    Runnable thread){
    }
    @Override public void post(    Runnable thread){
      new Thread(thread).start();
    }
    @Override public void postDelayed(    Runnable thread,    long timeout){
    }
  }
;
}

Fixed version (ground truth):
static Handler fakeHandler(){
  return new Handler(){
    private final ScheduledExecutorService scheduler=Executors.newSingleThreadScheduledExecutor();
    @Override public void removeCallbacks(    Runnable thread){
    }
    @Override public void post(    Runnable thread){
      scheduler.execute(thread);
    }
    @Override public void postDelayed(    Runnable thread,    long timeout){
    }
  }
;
}
Program: 95072
Project: 95072
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mDisconnectedButtons=view.findViewById(R.id.mc_disconnected_buttons);
  mDisarmedButtons=view.findViewById(R.id.mc_disarmed_buttons);
  mArmedButtons=view.findViewById(R.id.mc_armed_buttons);
  mInFlightButtons=view.findViewById(R.id.mc_in_flight_buttons);
  final Button connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
  connectBtn.setOnClickListener(this);
  homeBtn=(Button)view.findViewById(R.id.mc_homeBtn);
  homeBtn.setOnClickListener(this);
  final Button armBtn=(Button)view.findViewById(R.id.mc_armBtn);
  armBtn.setOnClickListener(this);
  final Button disarmBtn=(Button)view.findViewById(R.id.mc_disarmBtn);
  disarmBtn.setOnClickListener(this);
  landBtn=(Button)view.findViewById(R.id.mc_land);
  landBtn.setOnClickListener(this);
  final Button takeoffBtn=(Button)view.findViewById(R.id.mc_takeoff);
  takeoffBtn.setOnClickListener(this);
  pauseBtn=(Button)view.findViewById(R.id.mc_pause);
  pauseBtn.setOnClickListener(this);
  autoBtn=(Button)view.findViewById(R.id.mc_autoBtn);
  autoBtn.setOnClickListener(this);
  final Button takeoffInAuto=(Button)view.findViewById(R.id.mc_TakeoffInAutoBtn);
  takeoffInAuto.setOnClickListener(this);
  followBtn=(Button)view.findViewById(R.id.mc_follow);
  followBtn.setOnClickListener(this);
  final Button dronieBtn=(Button)view.findViewById(R.id.mc_dronieBtn);
  dronieBtn.setOnClickListener(this);
  drone.addDroneListener(this);
  setupButtonsByFlightState();
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mDisconnectedButtons=view.findViewById(R.id.mc_disconnected_buttons);
  mDisarmedButtons=view.findViewById(R.id.mc_disarmed_buttons);
  mArmedButtons=view.findViewById(R.id.mc_armed_buttons);
  mInFlightButtons=view.findViewById(R.id.mc_in_flight_buttons);
  final Button connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
  connectBtn.setOnClickListener(this);
  homeBtn=(Button)view.findViewById(R.id.mc_homeBtn);
  homeBtn.setOnClickListener(this);
  final Button armBtn=(Button)view.findViewById(R.id.mc_armBtn);
  armBtn.setOnClickListener(this);
  final Button disarmBtn=(Button)view.findViewById(R.id.mc_disarmBtn);
  disarmBtn.setOnClickListener(this);
  landBtn=(Button)view.findViewById(R.id.mc_land);
  landBtn.setOnClickListener(this);
  final Button takeoffBtn=(Button)view.findViewById(R.id.mc_takeoff);
  takeoffBtn.setOnClickListener(this);
  pauseBtn=(Button)view.findViewById(R.id.mc_pause);
  pauseBtn.setOnClickListener(this);
  autoBtn=(Button)view.findViewById(R.id.mc_autoBtn);
  autoBtn.setOnClickListener(this);
  final Button takeoffInAuto=(Button)view.findViewById(R.id.mc_TakeoffInAutoBtn);
  takeoffInAuto.setOnClickListener(this);
  followBtn=(Button)view.findViewById(R.id.mc_follow);
  followBtn.setOnClickListener(this);
  final Button dronieBtn=(Button)view.findViewById(R.id.mc_dronieBtn);
  dronieBtn.setOnClickListener(this);
}
Program: 95073
Project: 95073
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mDisconnectedButtons=view.findViewById(R.id.mc_disconnected_buttons);
  mDisarmedButtons=view.findViewById(R.id.mc_disarmed_buttons);
  mArmedButtons=view.findViewById(R.id.mc_armed_buttons);
  mInFlightButtons=view.findViewById(R.id.mc_in_flight_buttons);
  final Button connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
  connectBtn.setOnClickListener(this);
  homeBtn=(Button)view.findViewById(R.id.mc_homeBtn);
  homeBtn.setOnClickListener(this);
  final Button armBtn=(Button)view.findViewById(R.id.mc_armBtn);
  armBtn.setOnClickListener(this);
  final Button disarmBtn=(Button)view.findViewById(R.id.mc_disarmBtn);
  disarmBtn.setOnClickListener(this);
  landBtn=(Button)view.findViewById(R.id.mc_land);
  landBtn.setOnClickListener(this);
  final Button takeoffBtn=(Button)view.findViewById(R.id.mc_takeoff);
  takeoffBtn.setOnClickListener(this);
  pauseBtn=(Button)view.findViewById(R.id.mc_pause);
  pauseBtn.setOnClickListener(this);
  autoBtn=(Button)view.findViewById(R.id.mc_autoBtn);
  autoBtn.setOnClickListener(this);
  final Button takeoffInAuto=(Button)view.findViewById(R.id.mc_TakeoffInAutoBtn);
  takeoffInAuto.setOnClickListener(this);
  followBtn=(Button)view.findViewById(R.id.mc_follow);
  followBtn.setOnClickListener(this);
  final Button dronieBtn=(Button)view.findViewById(R.id.mc_dronieBtn);
  dronieBtn.setOnClickListener(this);
  drone.addDroneListener(this);
  setupButtonsByFlightState();
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  mDisconnectedButtons=view.findViewById(R.id.mc_disconnected_buttons);
  mDisarmedButtons=view.findViewById(R.id.mc_disarmed_buttons);
  mArmedButtons=view.findViewById(R.id.mc_armed_buttons);
  mInFlightButtons=view.findViewById(R.id.mc_in_flight_buttons);
  final Button connectBtn=(Button)view.findViewById(R.id.mc_connectBtn);
  connectBtn.setOnClickListener(this);
  homeBtn=(Button)view.findViewById(R.id.mc_homeBtn);
  homeBtn.setOnClickListener(this);
  final Button armBtn=(Button)view.findViewById(R.id.mc_armBtn);
  armBtn.setOnClickListener(this);
  final Button disarmBtn=(Button)view.findViewById(R.id.mc_disarmBtn);
  disarmBtn.setOnClickListener(this);
  landBtn=(Button)view.findViewById(R.id.mc_land);
  landBtn.setOnClickListener(this);
  final Button takeoffBtn=(Button)view.findViewById(R.id.mc_takeoff);
  takeoffBtn.setOnClickListener(this);
  pauseBtn=(Button)view.findViewById(R.id.mc_pause);
  pauseBtn.setOnClickListener(this);
  autoBtn=(Button)view.findViewById(R.id.mc_autoBtn);
  autoBtn.setOnClickListener(this);
  final Button takeoffInAuto=(Button)view.findViewById(R.id.mc_TakeoffInAutoBtn);
  takeoffInAuto.setOnClickListener(this);
  followBtn=(Button)view.findViewById(R.id.mc_follow);
  followBtn.setOnClickListener(this);
  final Button dronieBtn=(Button)view.findViewById(R.id.mc_dronieBtn);
  dronieBtn.setOnClickListener(this);
}
Program: 95074
Project: 95074
Buggy source:
@Override public String toString(){
  String toString="String_Node_Str";
  final ParameterMetadata metadata=getMetadata();
  if (metadata != null) {
    toString=metadata.getDisplayName();
  }
  if (toString == null) {
    final Parameter param=getParameter();
    if (param != null) {
      toString=param.name;
    }
  }
  return toString;
}

Fixed version (ground truth):
@Override public String toString(){
  String toString="String_Node_Str";
  final Parameter param=getParameter();
  if (param != null) {
    toString=param.name + "String_Node_Str";
  }
  final ParameterMetadata metadata=getMetadata();
  if (metadata != null) {
    toString+=metadata.getDisplayName();
  }
  return toString;
}
Program: 95075
Project: 95075
Buggy source:
@Override public void onSelectionUpdate(List<MissionItemProxy> selected){
  final boolean isEmpty=selected.isEmpty();
  missionListFragment.setArrowsVisibility(!isEmpty);
  if (isEmpty) {
    removeItemDetail();
  }
 else {
    if (contextualActionBar != null && !mMultiEditEnabled)     removeItemDetail();
 else {
      showItemDetail(selected.get(0).getDetailFragment());
    }
  }
  planningMapFragment.postUpdate();
}

Fixed version (ground truth):
@Override public void onSelectionUpdate(List<MissionItemProxy> selected){
  final boolean isEmpty=selected.isEmpty();
  missionListFragment.setArrowsVisibility(!isEmpty);
  if (isEmpty) {
    removeItemDetail();
  }
 else {
    if (contextualActionBar != null && !mMultiEditEnabled)     removeItemDetail();
 else {
      showItemDetail(selectMissionDetailType(selected));
    }
  }
  planningMapFragment.postUpdate();
}
Program: 95076
Project: 95076
Buggy source:
@Override public boolean onItemLongClick(MissionItemProxy item){
  if (contextualActionBar != null) {
    if (missionProxy.selection.selectionContains(item)) {
      missionProxy.selection.clearSelection();
    }
 else {
      missionProxy.selection.setSelectionTo(missionProxy.getItems());
    }
  }
 else {
    editorToolsFragment.setTool(EditorTools.NONE);
    missionListFragment.updateChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
    contextualActionBar=startActionMode(this);
    missionProxy.selection.setSelectionTo(item);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemLongClick(MissionItemProxy item){
  enableMultiEdit(false);
  if (contextualActionBar != null) {
    if (missionProxy.selection.selectionContains(item)) {
      missionProxy.selection.clearSelection();
    }
 else {
      missionProxy.selection.setSelectionTo(missionProxy.getItems());
    }
  }
 else {
    editorToolsFragment.setTool(EditorTools.NONE);
    missionListFragment.updateChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
    contextualActionBar=startActionMode(this);
    missionProxy.selection.setSelectionTo(item);
  }
  return true;
}
Program: 95077
Project: 95077
Buggy source:
@Override public void onMapClick(Coord2D point){
  missionProxy.selection.clearSelection();
switch (getTool()) {
case MARKER:
    if (mIsSplineEnabled) {
      missionProxy.addSplineWaypoint(point);
    }
 else {
      missionProxy.addWaypoint(point);
    }
  break;
case DRAW:
break;
case POLY:
break;
case TRASH:
break;
case NONE:
break;
}
}

Fixed version (ground truth):
@Override public void onMapClick(Coord2D point){
  enableMultiEdit(false);
  missionProxy.selection.clearSelection();
switch (getTool()) {
case MARKER:
    if (mIsSplineEnabled) {
      missionProxy.addSplineWaypoint(point);
    }
 else {
      missionProxy.addWaypoint(point);
    }
  break;
case DRAW:
break;
case POLY:
break;
case TRASH:
break;
case NONE:
break;
}
}