nus-yam/ex-repair huggingface dataset:
Program: 94957
Project: 94957
Buggy source:
void destroy(){
  this.apiListener.asBinder().unlinkToDeath(this,0);
  this.droneMgr.setDroneEventsListener(null);
  this.droneMgr.destroy();
  this.serviceRef.clear();
  this.observersList.clear();
  this.mavlinkObserversList.clear();
}

Fixed version (ground truth):
void destroy(){
  this.serviceRef.clear();
  this.observersList.clear();
  this.mavlinkObserversList.clear();
  this.apiListener.asBinder().unlinkToDeath(this,0);
  this.droneMgr.setDroneEventsListener(null);
  this.droneMgr.destroy();
}
Program: 94958
Project: 94958
Buggy source:
@Override public void removeEventUpdates(IDroidPlannerApiCallback callback) throws RemoteException {
  if (callback != null)   apiCallbacks.remove(callback);
}

Fixed version (ground truth):
@Override public void removeEventUpdates(IDroidPlannerApiCallback callback) throws RemoteException {
  if (callback != null) {
    apiCallbacks.remove(callback);
    if (apiCallbacks.isEmpty())     getService().releaseDroidPlannerApi(this);
  }
}
Program: 94960
Project: 94960
Buggy source:
void disconnectMAVConnection(ConnectionParameter connParams){
  final AndroidMavLinkConnection conn=mavConnections.get(connParams);
  if (conn == null)   return;
  if (conn.getConnectionStatus() != MavLinkConnection.MAVLINK_DISCONNECTED) {
    Log.d(TAG,"String_Node_Str");
    conn.disconnect();
    GAUtils.sendEvent(new HitBuilders.EventBuilder().setCategory(GAUtils.Category.MAVLINK_CONNECTION).setAction("String_Node_Str").setLabel(connParams.toString()));
  }
}

Fixed version (ground truth):
void disconnectMAVConnection(ConnectionParameter connParams,String listenerTag){
  final AndroidMavLinkConnection conn=mavConnections.get(connParams);
  if (conn == null)   return;
  conn.removeMavLinkConnectionListener(listenerTag);
  if (conn.getMavLinkConnectionListenersCount() == 0 && conn.getConnectionStatus() != MavLinkConnection.MAVLINK_DISCONNECTED) {
    Log.d(TAG,"String_Node_Str");
    conn.disconnect();
    GAUtils.sendEvent(new HitBuilders.EventBuilder().setCategory(GAUtils.Category.MAVLINK_CONNECTION).setAction("String_Node_Str").setLabel(connParams.toString()));
  }
}
Program: 94961
Project: 94961
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  for (  DPApi dpApi : dpApiStore) {
    dpApi.destroy();
  }
  dpApiStore.clear();
  for (  ConnectionParameter connParams : mavConnections.keySet()) {
    disconnectMAVConnection(connParams);
  }
  mavConnections.clear();
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  for (  DPApi dpApi : dpApiStore) {
    dpApi.destroy();
  }
  dpApiStore.clear();
  for (  AndroidMavLinkConnection conn : mavConnections.values()) {
    conn.disconnect();
    conn.removeAllMavLinkConnectionListeners();
  }
  mavConnections.clear();
}
Program: 94962
Project: 94962
Buggy source:
public void connectMavLink(ConnectionParameter connParams){
  getService().connectMAVConnection(connParams);
}

Fixed version (ground truth):
public void connectMavLink(ConnectionParameter connParams,String tag,MavLinkConnectionListener listener){
  getService().connectMAVConnection(connParams,tag,listener);
}
Program: 94963
Project: 94963
Buggy source:
public int getConnectionStatus(ConnectionParameter connParams){
  final AndroidMavLinkConnection mavConnection=getService().mavConnections.get(connParams);
  if (mavConnection == null) {
    return MavLinkConnection.MAVLINK_DISCONNECTED;
  }
  return mavConnection.getConnectionStatus();
}

Fixed version (ground truth):
public int getConnectionStatus(ConnectionParameter connParams,String tag){
  final AndroidMavLinkConnection mavConnection=getService().mavConnections.get(connParams);
  if (mavConnection == null || !mavConnection.hasMavLinkConnectionListener(tag)) {
    return MavLinkConnection.MAVLINK_DISCONNECTED;
  }
  return mavConnection.getConnectionStatus();
}
Program: 94964
Project: 94964
Buggy source:
public void disconnectMavLink(ConnectionParameter connParams){
  getService().disconnectMAVConnection(connParams);
}

Fixed version (ground truth):
public void disconnectMavLink(ConnectionParameter connParams,String tag){
  getService().disconnectMAVConnection(connParams,tag);
}
Program: 94965
Project: 94965
Buggy source:
@Override public void openConnection(){
  if (this.connParams == null)   return;
  if (mavLinkApi.getConnectionStatus(this.connParams) == MavLinkConnection.MAVLINK_DISCONNECTED) {
    mavLinkApi.connectMavLink(this.connParams);
    mavLinkApi.addMavLinkConnectionListener(this.connParams,TAG,mConnectionListener);
  }
}

Fixed version (ground truth):
@Override public void openConnection(){
  if (this.connParams == null)   return;
  final String tag=toString();
  if (mavLinkApi.getConnectionStatus(this.connParams,tag) == MavLinkConnection.MAVLINK_DISCONNECTED) {
    mavLinkApi.connectMavLink(this.connParams,tag,mConnectionListener);
  }
}
Program: 94966
Project: 94966
Buggy source:
@Override public boolean isConnected(){
  return this.connParams != null && mavLinkApi.getConnectionStatus(this.connParams) == MavLinkConnection.MAVLINK_CONNECTED;
}

Fixed version (ground truth):
@Override public boolean isConnected(){
  return this.connParams != null && mavLinkApi.getConnectionStatus(this.connParams,toString()) == MavLinkConnection.MAVLINK_CONNECTED;
}
Program: 94967
Project: 94967
Buggy source:
@Override public void closeConnection(){
  if (this.connParams == null)   return;
  if (mavLinkApi.getConnectionStatus(this.connParams) == MavLinkConnection.MAVLINK_CONNECTED) {
    mavLinkApi.disconnectMavLink(this.connParams);
    mavLinkApi.removeMavLinkConnectionListener(this.connParams,TAG);
    listener.notifyDisconnected();
  }
}

Fixed version (ground truth):
@Override public void closeConnection(){
  if (this.connParams == null)   return;
  final String tag=toString();
  if (mavLinkApi.getConnectionStatus(this.connParams,tag) == MavLinkConnection.MAVLINK_CONNECTED) {
    mavLinkApi.disconnectMavLink(this.connParams,tag);
    listener.notifyDisconnected();
  }
}
Program: 94968
Project: 94968
Buggy source:
@Override public void parameterFileLoaded(List<Parameter> parameters){
  loadAdapter(parameters);
}

Fixed version (ground truth):
@Override public void parameterFileLoaded(List<Parameter> parameters){
  loadAdapter(parameters,true);
}
Program: 94969
Project: 94969
Buggy source:
private void openParametersFromFile(){
  OpenFileDialog dialog=new OpenParameterDialog(){
    @Override public void parameterFileLoaded(    List<Parameter> parameters){
      loadAdapter(parameters);
    }
  }
;
  dialog.openDialog(getActivity());
}

Fixed version (ground truth):
private void openParametersFromFile(){
  OpenFileDialog dialog=new OpenParameterDialog(){
    @Override public void parameterFileLoaded(    List<Parameter> parameters){
      loadAdapter(parameters,true);
    }
  }
;
  dialog.openDialog(getActivity());
}
Program: 94970
Project: 94970
Buggy source:
private void loadAdapter(List<Parameter> parameters){
  if (parameters == null || parameters.isEmpty()) {
    return;
  }
  Set<Parameter> prunedParameters=new TreeSet<Parameter>(parameters);
  adapter.loadParameters(drone,prunedParameters);
  if (mParamsFilter != null && mParamsFilter.getVisibility() == View.VISIBLE) {
    mParamsFilter.setText("String_Node_Str");
  }
 else {
    filterInput(null);
  }
}

Fixed version (ground truth):
private void loadAdapter(List<Parameter> parameters,boolean isUpdate){
  if (parameters == null || parameters.isEmpty()) {
    return;
  }
  TreeMap<String,Parameter> prunedParameters=new TreeMap<>();
  for (  Parameter parameter : parameters) {
    prunedParameters.put(parameter.name,parameter);
  }
  if (isUpdate) {
    adapter.updateParameters(prunedParameters);
  }
 else {
    adapter.loadParameters(drone,prunedParameters);
  }
  if (mParamsFilter != null && mParamsFilter.getVisibility() == View.VISIBLE) {
    mParamsFilter.setText("String_Node_Str");
  }
 else {
    filterInput(null);
  }
}
Program: 94971
Project: 94971
Buggy source:
@Override public void onEndReceivingParameters(List<Parameter> parameters){
  loadAdapter(parameters);
  stopProgress();
}

Fixed version (ground truth):
@Override public void onEndReceivingParameters(List<Parameter> parameters){
  loadAdapter(parameters,false);
  stopProgress();
}
Program: 94972
Project: 94972
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  final DroidPlannerApp dpApp=(DroidPlannerApp)getActivity().getApplication();
  drone=dpApp.getDrone();
  mPrefs=dpApp.getPreferences();
  if (savedInstanceState != null) {
    @SuppressWarnings("String_Node_Str") final ArrayList<ParamsAdapterItem> pwms=(ArrayList<ParamsAdapterItem>)savedInstanceState.getSerializable(ADAPTER_ITEMS);
    adapter=new ParamsAdapter(getActivity(),R.layout.row_params,pwms);
  }
 else {
    adapter=new ParamsAdapter(getActivity(),R.layout.row_params);
    final List<Parameter> parametersList=drone.getParameters().getParametersList();
    if (!parametersList.isEmpty()) {
      loadAdapter(parametersList);
    }
  }
  setListAdapter(adapter);
  adapter.setOnInfoListener(new ParamsAdapter.OnInfoListener(){
    @Override public void onHelp(    int position,    EditText valueView){
      showInfo(position,valueView);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  final DroidPlannerApp dpApp=(DroidPlannerApp)getActivity().getApplication();
  drone=dpApp.getDrone();
  mPrefs=dpApp.getPreferences();
  if (savedInstanceState != null) {
    @SuppressWarnings("String_Node_Str") final ArrayList<ParamsAdapterItem> pwms=(ArrayList<ParamsAdapterItem>)savedInstanceState.getSerializable(ADAPTER_ITEMS);
    adapter=new ParamsAdapter(getActivity(),R.layout.row_params,pwms);
  }
 else {
    adapter=new ParamsAdapter(getActivity(),R.layout.row_params);
    final List<Parameter> parametersList=drone.getParameters().getParametersList();
    if (!parametersList.isEmpty()) {
      loadAdapter(parametersList,false);
    }
  }
  setListAdapter(adapter);
  adapter.setOnInfoListener(new ParamsAdapter.OnInfoListener(){
    @Override public void onHelp(    int position,    EditText valueView){
      showInfo(position,valueView);
    }
  }
);
}
Program: 94973
Project: 94973
Buggy source:
private void addParameter(Parameter parameter){
  try {
    Parameter.checkParameterName(parameter.name);
    add(new ParamsAdapterItem(parameter,getMetadata(parameter.name)));
  }
 catch (  Exception ex) {
  }
}

Fixed version (ground truth):
private void addParameter(String name,Parameter parameter,boolean isDirty){
  try {
    Parameter.checkParameterName(name);
    ParamsAdapterItem item=new ParamsAdapterItem(parameter,getMetadata(name));
    item.setDirtyValue(parameter.getValue(),isDirty);
    add(item);
  }
 catch (  Exception ex) {
  }
}
Program: 94974
Project: 94974
Buggy source:
public void loadParameters(Drone drone,Set<Parameter> parameters){
  loadMetadataInternal(drone);
  clear();
  for (  Parameter parameter : parameters) {
    addParameter(parameter);
  }
}

Fixed version (ground truth):
public void loadParameters(Drone drone,Map<String,Parameter> parameters){
  loadMetadataInternal(drone);
  clear();
  for (  Map.Entry<String,Parameter> entry : parameters.entrySet()) {
    addParameter(entry.getKey(),entry.getValue());
  }
}
Program: 94975
Project: 94975
Buggy source:
public void setDirtyValue(String value){
  dirtyValue=(parameter.getValue().equals(value)) ? null : value;
  if (dirtyValue != null)   validation=validateValue(dirtyValue);
}

Fixed version (ground truth):
public void setDirtyValue(String value,boolean force){
  if (force) {
    dirtyValue=value;
  }
 else {
    dirtyValue=(parameter.getValue().equals(value)) ? null : value;
  }
  if (dirtyValue != null)   validation=validateValue(dirtyValue);
}
Program: 94976
Project: 94976
Buggy source:
@Override public void onFocusChange(View view,boolean hasFocus){
  if (!hasFocus) {
    valueView.setText(formatter.format(getValue()));
    focusView=null;
  }
 else {
    focusView=view;
  }
}

Fixed version (ground truth):
@Override public void onFocusChange(View view,boolean hasFocus){
  if (!hasFocus) {
    focusView=null;
  }
 else {
    focusView=view;
  }
}
Program: 94977
Project: 94977
Buggy source:
private CameraProxy getCameraProxy(){
  Camera droneCamera=droneMgr.getDrone().getCamera();
  List<Footprint> footprints=droneCamera.getFootprints();
  final int printsCount=footprints.size();
  List<FootPrint> proxyPrints=new ArrayList<FootPrint>(footprints.size());
  for (  Footprint footprint : footprints) {
    proxyPrints.add(getProxyCameraFootPrint(footprint));
  }
  return new CameraProxy(ProxyUtils.getCameraDetail(droneCamera.getCamera()),getProxyCameraFootPrint(droneCamera.getCurrentFieldOfView()),proxyPrints,getCameraDetails());
}

Fixed version (ground truth):
private CameraProxy getCameraProxy(){
  Drone drone=droneMgr.getDrone();
  Camera droneCamera=drone.getCamera();
  List<Footprint> footprints=droneCamera.getFootprints();
  final int printsCount=footprints.size();
  List<FootPrint> proxyPrints=new ArrayList<FootPrint>(footprints.size());
  for (  Footprint footprint : footprints) {
    proxyPrints.add(getProxyCameraFootPrint(footprint));
  }
  GPS droneGps=drone.getGps();
  final FootPrint currentFieldOfView=droneGps.isPositionValid() ? getProxyCameraFootPrint(droneCamera.getCurrentFieldOfView()) : new FootPrint();
  return new CameraProxy(ProxyUtils.getCameraDetail(droneCamera.getCamera()),currentFieldOfView,proxyPrints,getCameraDetails());
}
Program: 94979
Project: 94979
Buggy source:
public void setCameraInfo(CameraInfo info){
  this.camera=info;
  tryToLoadOverlapFromCamera();
}

Fixed version (ground truth):
public void setCameraInfo(CameraInfo info){
  this.camera=info;
  this.footprint=new Footprint(this.camera,this.altitude);
  tryToLoadOverlapFromCamera();
}
Program: 94980
Project: 94980
Buggy source:
@Override public void onFocusChange(View view,boolean hasFocus){
  if (!hasFocus) {
    valueView.setText(formatter.format(getValue()));
    focusView=null;
  }
 else {
    focusView=view;
  }
}

Fixed version (ground truth):
@Override public void onFocusChange(View view,boolean hasFocus){
  if (!hasFocus) {
    focusView=null;
  }
 else {
    focusView=view;
  }
}
Program: 94981
Project: 94981
Buggy source:
@Override protected AlertDialog.Builder buildDialog(Bundle savedInstanceState){
  final Bundle arguments=getArguments();
  final AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()).setTitle(arguments.getString(EXTRA_TITLE)).setView(generateContentView(savedInstanceState)).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      CharSequence input=mEditText.getText();
      if (input == null)       input=mEditText.getHint();
      mListener.onOk(input);
    }
  }
).setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mListener.onCancel();
    }
  }
);
  return builder;
}

Fixed version (ground truth):
@Override protected AlertDialog.Builder buildDialog(Bundle savedInstanceState){
  final Bundle arguments=getArguments();
  final AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()).setTitle(arguments.getString(EXTRA_TITLE)).setView(generateContentView(savedInstanceState)).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      CharSequence input=mEditText.getText();
      if (TextUtils.isEmpty(input))       input=mEditText.getHint();
      mListener.onOk(input);
    }
  }
).setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mListener.onCancel();
    }
  }
);
  return builder;
}
Program: 94982
Project: 94982
Buggy source:
@Override protected AlertDialog.Builder buildDialog(Bundle savedInstanceState){
  final Bundle arguments=getArguments();
  final AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()).setTitle(arguments.getString(EXTRA_TITLE)).setView(generateContentView(savedInstanceState)).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      CharSequence input=mEditText.getText();
      if (input == null)       input=mEditText.getHint();
      mListener.onOk(input);
    }
  }
).setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mListener.onCancel();
    }
  }
);
  return builder;
}

Fixed version (ground truth):
@Override protected AlertDialog.Builder buildDialog(Bundle savedInstanceState){
  final Bundle arguments=getArguments();
  final AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()).setTitle(arguments.getString(EXTRA_TITLE)).setView(generateContentView(savedInstanceState)).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      CharSequence input=mEditText.getText();
      if (TextUtils.isEmpty(input))       input=mEditText.getHint();
      mListener.onOk(input);
    }
  }
).setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      mListener.onCancel();
    }
  }
);
  return builder;
}
Program: 94983
Project: 94983
Buggy source:
@Override public void enableLocationUpdates(){
  mSpeedReadings=0;
  mTotalSpeed=0f;
  gApiMgr.addTask(requestLocationUpdate);
}

Fixed version (ground truth):
@Override public void enableLocationUpdates(){
  mSpeedReadings=0;
  mTotalSpeed=0f;
  try {
    gApiMgr.addTask(requestLocationUpdate);
  }
 catch (  IllegalStateException e) {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 94984
Project: 94984
Buggy source:
@Override public void disableLocationUpdates(){
  gApiMgr.addTask(removeLocationUpdate);
}

Fixed version (ground truth):
@Override public void disableLocationUpdates(){
  try {
    gApiMgr.addTask(removeLocationUpdate);
  }
 catch (  IllegalStateException e) {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 94985
Project: 94985
Buggy source:
/** 
 * Activates the google api client manager.
 */
public void start(){
  initializeDriverThread();
  initializeBgHandler();
}

Fixed version (ground truth):
/** 
 * Activates the google api client manager.
 */
public void start(){
  if (isGooglePlayServicesValid()) {
    initializeDriverThread();
    initializeBgHandler();
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 94986
Project: 94986
Buggy source:
/** 
 * Release the resources used by this manager. After calling this method, start() needs to be called again to use that manager again.
 */
public void stop(){
  destroyBgHandler();
  destroyDriverThread();
  mTaskQueue.clear();
  if (mGoogleApiClient.isConnected() || mGoogleApiClient.isConnecting()) {
    mGoogleApiClient.disconnect();
  }
}

Fixed version (ground truth):
/** 
 * Release the resources used by this manager. After calling this method, start() needs to be called again to use that manager again.
 */
public void stop(){
  if (isGooglePlayServicesValid()) {
    destroyBgHandler();
    destroyDriverThread();
    mTaskQueue.clear();
    if (mGoogleApiClient.isConnected() || mGoogleApiClient.isConnecting()) {
      mGoogleApiClient.disconnect();
    }
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 94988
Project: 94988
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final DroneManager droneMgr=getItem(position);
  View view;
  if (convertView == null)   view=inflater.inflate(R.layout.list_item_drone_info,parent,false);
 else   view=convertView;
  ViewHolder viewHolder=(ViewHolder)view.getTag();
  if (viewHolder == null) {
    viewHolder=new ViewHolder();
    viewHolder.listenersCount=(TextView)view.findViewById(R.id.drone_info_listeners_count);
    viewHolder.infoPanel=(TextView)view.findViewById(R.id.drone_info_connection_params);
    view.setTag(viewHolder);
  }
  viewHolder.listenersCount.setText("String_Node_Str" + droneMgr.getListenersCount());
  viewHolder.infoPanel.setText("String_Node_Str" + droneMgr.getConnectionParameter().toString());
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final DroneManager droneMgr=getItem(position);
  View view;
  if (convertView == null)   view=inflater.inflate(R.layout.list_item_drone_info,parent,false);
 else   view=convertView;
  ViewHolder viewHolder=(ViewHolder)view.getTag();
  if (viewHolder == null) {
    viewHolder=new ViewHolder();
    viewHolder.listenersCount=(TextView)view.findViewById(R.id.drone_info_listeners_count);
    viewHolder.infoPanel=(TextView)view.findViewById(R.id.drone_info_connection_params);
    view.setTag(viewHolder);
  }
  viewHolder.listenersCount.setText("String_Node_Str" + droneMgr.getListenersCount());
  viewHolder.infoPanel.setText("String_Node_Str" + droneMgr.getConnectionParameter());
  return view;
}
Program: 94989
Project: 94989
Buggy source:
@Override public void disconnect() throws RemoteException {
  if (droneMgr != null) {
    try {
      droneMgr.disconnect();
    }
 catch (    ConnectionException e) {
      try {
        getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
      }
 catch (      DeadObjectException d) {
        handleDeadObjectException(d);
      }
    }
    getService().releaseDroneManager(droneMgr,this);
    droneMgr=null;
  }
  apiCallback=null;
}

Fixed version (ground truth):
@Override public void disconnect() throws RemoteException {
  if (droneMgr != null) {
    try {
      droneMgr.disconnect();
    }
 catch (    ConnectionException e) {
      try {
        getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
      }
 catch (      DeadObjectException d) {
        Log.e(TAG,e.getMessage(),e);
      }
    }
    getService().releaseDroneManager(droneMgr,this);
    droneMgr=null;
  }
  apiCallback=null;
}
Program: 94990
Project: 94990
Buggy source:
private void handleDeadObjectException(DeadObjectException e){
  Log.e(TAG,e.getMessage(),e);
}

Fixed version (ground truth):
private void handleDeadObjectException(DeadObjectException e){
  Log.e(TAG,e.getMessage(),e);
  try {
    disconnect();
  }
 catch (  RemoteException e1) {
    Log.e(TAG,e1.getMessage(),e1);
  }
}
Program: 94991
Project: 94991
Buggy source:
public HeartBeat(Drone myDrone,Handler handler){
  super(myDrone);
  this.watchdog=handler;
  myDrone.addDroneListener(this);
}

Fixed version (ground truth):
public HeartBeat(Drone myDrone,Handler handler){
  super(myDrone);
  this.watchdog=handler;
  this.gcsHeartbeat=new GCSHeartbeat(myDrone,1);
  myDrone.addDroneListener(this);
}
Program: 94992
Project: 94992
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case CALIBRATION_IMU:
    heartbeatState=HeartbeatState.IMU_CALIBRATION;
  restartWatchdog(HEARTBEAT_IMU_CALIBRATION_TIMEOUT);
break;
case CONNECTED:
notifyConnected();
break;
case DISCONNECTED:
notifyDisconnected();
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case CALIBRATION_IMU:
    heartbeatState=HeartbeatState.IMU_CALIBRATION;
  restartWatchdog(HEARTBEAT_IMU_CALIBRATION_TIMEOUT);
break;
case CONNECTED:
gcsHeartbeat.setActive(true);
notifyConnected();
break;
case DISCONNECTED:
gcsHeartbeat.setActive(false);
notifyDisconnected();
break;
default :
break;
}
}
Program: 94993
Project: 94993
Buggy source:
@Override public Parameters getParameters() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  final Map<String,com.ox3dr.services.android.lib.drone.property.Parameter> proxyParams=new HashMap<String,com.ox3dr.services.android.lib.drone.property.Parameter>();
  List<Parameter> droneParameters=drone.getParameters().getParametersList();
  if (!droneParameters.isEmpty()) {
    for (    Parameter param : droneParameters) {
      proxyParams.put(param.name,new com.ox3dr.services.android.lib.drone.property.Parameter(param.name,param.value,param.type));
    }
    try {
      final VehicleProfile profile=drone.getVehicleProfile();
      if (profile != null) {
        String metadataType=profile.getParameterMetadataType();
        if (metadataType != null) {
          ParameterMetadataLoader.load(getService().getApplicationContext(),metadataType,proxyParams);
        }
      }
    }
 catch (    IOException e) {
      Log.e(TAG,e.getMessage(),e);
    }
catch (    XmlPullParserException e) {
      Log.e(TAG,e.getMessage(),e);
    }
  }
  return new Parameters(new ArrayList<com.ox3dr.services.android.lib.drone.property.Parameter>(proxyParams.values()));
}

Fixed version (ground truth):
@Override public Parameters getParameters() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  final Map<String,com.ox3dr.services.android.lib.drone.property.Parameter> proxyParams=new HashMap<String,com.ox3dr.services.android.lib.drone.property.Parameter>();
  List<Parameter> droneParameters=drone.getParameters().getParametersList();
  if (!droneParameters.isEmpty()) {
    for (    Parameter param : droneParameters) {
      if (param.name != null) {
        proxyParams.put(param.name,new com.ox3dr.services.android.lib.drone.property.Parameter(param.name,param.value,param.type));
      }
    }
    try {
      final VehicleProfile profile=drone.getVehicleProfile();
      if (profile != null) {
        String metadataType=profile.getParameterMetadataType();
        if (metadataType != null) {
          ParameterMetadataLoader.load(getService().getApplicationContext(),metadataType,proxyParams);
        }
      }
    }
 catch (    IOException e) {
      Log.e(TAG,e.getMessage(),e);
    }
catch (    XmlPullParserException e) {
      Log.e(TAG,e.getMessage(),e);
    }
  }
  return new Parameters(new ArrayList<com.ox3dr.services.android.lib.drone.property.Parameter>(proxyParams.values()));
}
Program: 94994
Project: 94994
Buggy source:
@Override public State getState() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  org.droidplanner.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  return new State(getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getWarning(),drone.getMavlinkVersion(),drone.getCalibrationSetup().getMessage());
}

Fixed version (ground truth):
@Override public State getState() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  org.droidplanner.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  Calibration calibration=drone.getCalibrationSetup();
  String calibrationMessage=calibration.isCalibrating() ? calibration.getMessage() : null;
  return new State(getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getWarning(),drone.getMavlinkVersion(),calibrationMessage);
}
Program: 94995
Project: 94995
Buggy source:
@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;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case HEARTBEAT_FIRST:
case HEARTBEAT_RESTORED:
case MODE:
    if (isGuidedMode(myDrone)) {
      initialize();
    }
 else {
      disable();
    }
  break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
disable();
default :
break;
}
}
Program: 94996
Project: 94996
Buggy source:
public Radio(Drone myDrone){
  super(myDrone);
}

Fixed version (ground truth):
public Radio(Drone myDrone){
  super(myDrone);
  myDrone.addDroneListener(this);
}
Program: 94997
Project: 94997
Buggy source:
@Override public FootPrint[] getCameraFootPrints() throws RemoteException {
  List<Footprint> footprints=getDroneMgr().getDrone().getCameraFootprints().getFootprints();
  final int printsCount=footprints.size();
  FootPrint[] proxyPrints=new FootPrint[printsCount];
  for (int i=0; i < printsCount; i++) {
    proxyPrints[i]=getProxyCameraFootPrint(footprints.get(i));
  }
  return proxyPrints;
}

Fixed version (ground truth):
@Override public FootPrint[] getCameraFootPrints() throws RemoteException {
  List<Footprint> footprints=getDroneMgr().getDrone().getCamera().getFootprints();
  final int printsCount=footprints.size();
  FootPrint[] proxyPrints=new FootPrint[printsCount];
  for (int i=0; i < printsCount; i++) {
    proxyPrints[i]=getProxyCameraFootPrint(footprints.get(i));
  }
  return proxyPrints;
}
Program: 94998
Project: 94998
Buggy source:
private static FootPrint getProxyCameraFootPrint(Footprint footprint){
  if (footprint == null)   return null;
  return new FootPrint(MathUtils.coord2DToLatLong(footprint.getCenter()),MathUtils.coord2DToLatLong(footprint.getVertex()));
}

Fixed version (ground truth):
private static FootPrint getProxyCameraFootPrint(Footprint footprint){
  if (footprint == null)   return null;
  return new FootPrint(footprint.getGSD(),MathUtils.coord2DToLatLong(footprint.getVertexInGlobalFrame()));
}
Program: 94999
Project: 94999
Buggy source:
@Override public FootPrint getLastCameraFootPrint() throws RemoteException {
  Footprint lastFootprint=getDroneMgr().getDrone().getCameraFootprints().getLastFootprint();
  return getProxyCameraFootPrint(lastFootprint);
}

Fixed version (ground truth):
@Override public FootPrint getLastCameraFootPrint() throws RemoteException {
  Footprint lastFootprint=getDroneMgr().getDrone().getCamera().getLastFootprint();
  return getProxyCameraFootPrint(lastFootprint);
}
Program: 95000
Project: 95000
Buggy source:
private static void parseMetadata(XmlPullParser parser,String metadataType,Map<String,Parameter> parameters) throws XmlPullParserException, IOException {
  boolean parsing=false;
  int eventType=parser.getEventType();
  while (eventType != XmlPullParser.END_DOCUMENT) {
switch (eventType) {
case XmlPullParser.START_TAG:
{
        String name=parser.getName();
        if (metadataType.equals(name)) {
          parsing=true;
        }
 else         if (parsing) {
          Parameter parameter=parameters.get(name);
          if (parameter != null)           addMetaDataProperty(parameter,name,parser.nextText());
        }
        break;
      }
case XmlPullParser.END_TAG:
{
      String name=parser.getName();
      if (metadataType.equals(name)) {
        return;
      }
      break;
    }
}
eventType=parser.next();
}
}

Fixed version (ground truth):
private static void parseMetadata(XmlPullParser parser,String metadataType,Map<String,Parameter> parameters) throws XmlPullParserException, IOException {
  boolean parsing=false;
  Parameter parameter=null;
  int eventType=parser.getEventType();
  while (eventType != XmlPullParser.END_DOCUMENT) {
switch (eventType) {
case XmlPullParser.START_TAG:
{
        String name=parser.getName();
        if (metadataType.equals(name)) {
          parsing=true;
        }
 else         if (parsing) {
          if (parameter == null) {
            parameter=parameters.get(name);
          }
 else {
            addMetaDataProperty(parameter,name,parser.nextText());
          }
        }
        break;
      }
case XmlPullParser.END_TAG:
{
      String name=parser.getName();
      if (metadataType.equals(name)) {
        return;
      }
 else       if (parameter != null) {
        parameter=null;
      }
      break;
    }
}
eventType=parser.next();
}
}
Program: 95001
Project: 95001
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + connectionType + "String_Node_Str"+ paramsBundle+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  String toString="String_Node_Str" + "String_Node_Str" + connectionType + "String_Node_Str";
  if (paramsBundle != null && !paramsBundle.isEmpty()) {
    boolean isFirst=true;
    for (    String key : paramsBundle.keySet()) {
      if (isFirst)       isFirst=false;
 else       toString+="String_Node_Str";
      toString+=key + "String_Node_Str" + paramsBundle.get(key);
    }
  }
  toString+="String_Node_Str";
  return toString;
}
Program: 95002
Project: 95002
Buggy source:
@Override public StructureScanner updateStructureScanner(StructureScanner item) throws RemoteException {
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public StructureScanner updateStructureScanner(StructureScanner item) throws RemoteException {
  org.droidplanner.core.mission.Mission droneMission=getDroneMgr().getDrone().getMission();
  org.droidplanner.core.mission.waypoints.StructureScanner updatedScan=(org.droidplanner.core.mission.waypoints.StructureScanner)ProxyUtils.getMissionItem(droneMission,item);
  StructureScanner proxyScanner=(StructureScanner)ProxyUtils.getProxyMissionItem(updatedScan);
  return proxyScanner;
}
Program: 95004
Project: 95004
Buggy source:
@Override public Parameters getParameters() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  final Map<String,com.ox3dr.services.android.lib.drone.property.Parameter> proxyParams=new HashMap<String,com.ox3dr.services.android.lib.drone.property.Parameter>();
  List<Parameter> droneParameters=drone.getParameters().getParametersList();
  if (!droneParameters.isEmpty()) {
    for (    Parameter param : droneParameters) {
      proxyParams.put(param.name,new com.ox3dr.services.android.lib.drone.property.Parameter(param.name,param.value,param.type));
    }
    try {
      ParameterMetadataLoader.load(getService().getApplicationContext(),null,proxyParams);
    }
 catch (    IOException e) {
      Log.e(TAG,e.getMessage(),e);
    }
catch (    XmlPullParserException e) {
      Log.e(TAG,e.getMessage(),e);
    }
  }
  return new Parameters(new ArrayList<com.ox3dr.services.android.lib.drone.property.Parameter>(proxyParams.values()));
}

Fixed version (ground truth):
@Override public Parameters getParameters() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  final Map<String,com.ox3dr.services.android.lib.drone.property.Parameter> proxyParams=new HashMap<String,com.ox3dr.services.android.lib.drone.property.Parameter>();
  List<Parameter> droneParameters=drone.getParameters().getParametersList();
  if (!droneParameters.isEmpty()) {
    for (    Parameter param : droneParameters) {
      proxyParams.put(param.name,new com.ox3dr.services.android.lib.drone.property.Parameter(param.name,param.value,param.type));
    }
    try {
      final VehicleProfile profile=drone.getVehicleProfile();
      if (profile != null) {
        String metadataType=profile.getParameterMetadataType();
        if (metadataType != null) {
          ParameterMetadataLoader.load(getService().getApplicationContext(),metadataType,proxyParams);
        }
      }
    }
 catch (    IOException e) {
      Log.e(TAG,e.getMessage(),e);
    }
catch (    XmlPullParserException e) {
      Log.e(TAG,e.getMessage(),e);
    }
  }
  return new Parameters(new ArrayList<com.ox3dr.services.android.lib.drone.property.Parameter>(proxyParams.values()));
}
Program: 95006
Project: 95006
Buggy source:
DPServices(DroidPlannerService service){
  serviceRef=new WeakReference<DroidPlannerService>(service);
  this.tlogApi=new TLogApi(service.getApplicationContext());
}

Fixed version (ground truth):
DPServices(DroidPlannerService service){
  serviceRef=new WeakReference<DroidPlannerService>(service);
  this.tlogApi=new TLogApi(service);
}
Program: 95007
Project: 95007
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  lbm=LocalBroadcastManager.getInstance(getApplicationContext());
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  mavlinkApi=new MavLinkServiceApi(this);
  droneAccess=new DroneAccess(this);
  dpServices=new DPServices(this);
  lbm=LocalBroadcastManager.getInstance(getApplicationContext());
}
Program: 95010
Project: 95010
Buggy source:
@Override public Mission getMission() throws RemoteException {
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public Mission getMission() throws RemoteException {
  org.droidplanner.core.mission.Mission droneMission=getDroneMgr().getDrone().getMission();
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 95011
Project: 95011
Buggy source:
@Override public State getState() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  org.droidplanner.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  return new State(getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getWarning(),drone.getMavlinkVersion());
}

Fixed version (ground truth):
@Override public State getState() throws RemoteException {
  final Drone drone=getDroneMgr().getDrone();
  org.droidplanner.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  return new State(getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getWarning(),drone.getMavlinkVersion(),drone.getCalibrationSetup().getMessage());
}
Program: 95012
Project: 95012
Buggy source:
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  Log.d(TAG,"String_Node_Str" + event);
  for (  DroneEventsListener listener : droneEventsListeners)   listener.onDroneEvent(event,drone);
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  for (  DroneEventsListener listener : droneEventsListeners)   listener.onDroneEvent(event,drone);
}
Program: 95013
Project: 95013
Buggy source:
@Override public void disconnect() throws RemoteException {
  try {
    getDroneMgr().disconnect();
  }
 catch (  ConnectionException e) {
    getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void disconnect() throws RemoteException {
  try {
    getDroneMgr().disconnect();
  }
 catch (  ConnectionException e) {
    try {
      getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
    }
 catch (    DeadObjectException d) {
      handleDeadObjectException(d);
    }
  }
}
Program: 95015
Project: 95015
Buggy source:
@Override public void onEndReceivingParameters(List<Parameter> parameter){
  try {
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_REFRESH_ENDED,emptyBundle);
  }
 catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void onEndReceivingParameters(List<Parameter> parameter){
  try {
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_REFRESH_ENDED,emptyBundle);
  }
 catch (  DeadObjectException e) {
    handleDeadObjectException(e);
  }
catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95016
Project: 95016
Buggy source:
@Override public void finished(FitPoints fit,double[] offsets){
  try {
    double fitness=fit.getFitness();
    Bundle paramsBundle=new Bundle(2);
    paramsBundle.putDouble(Extra.EXTRA_CALIBRATION_MAG_FITNESS,fitness);
    paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_OFFSETS,offsets);
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_COMPLETED,paramsBundle);
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void finished(FitPoints fit,double[] offsets){
  try {
    double fitness=fit.getFitness();
    Bundle paramsBundle=new Bundle(2);
    paramsBundle.putDouble(Extra.EXTRA_CALIBRATION_MAG_FITNESS,fitness);
    paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_OFFSETS,offsets);
    try {
      getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_COMPLETED,paramsBundle);
    }
 catch (    DeadObjectException e) {
      handleDeadObjectException(e);
    }
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95017
Project: 95017
Buggy source:
@Override public void onStarted(List<ThreeSpacePoint> points){
  Bundle paramsBundle=new Bundle();
  paramsBundle.putParcelableArrayList(Extra.EXTRA_CALIBRATION_MAG_POINTS,MathUtil.threeSpacePointToPoint3D(points));
  try {
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_STARTED,paramsBundle);
  }
 catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void onStarted(List<ThreeSpacePoint> points){
  Bundle paramsBundle=new Bundle();
  paramsBundle.putParcelableArrayList(Extra.EXTRA_CALIBRATION_MAG_POINTS,MathUtil.threeSpacePointToPoint3D(points));
  try {
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_STARTED,paramsBundle);
  }
 catch (  DeadObjectException e) {
    handleDeadObjectException(e);
  }
catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95018
Project: 95018
Buggy source:
@Override public void onParameterReceived(Parameter parameter,int index,int count){
  try {
    Bundle paramsBundle=new Bundle(2);
    paramsBundle.putInt(Extra.EXTRA_PARAMETER_INDEX,index);
    paramsBundle.putInt(Extra.EXTRA_PARAMETERS_COUNT,count);
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_RECEIVED,paramsBundle);
  }
 catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void onParameterReceived(Parameter parameter,int index,int count){
  try {
    Bundle paramsBundle=new Bundle(2);
    paramsBundle.putInt(Extra.EXTRA_PARAMETER_INDEX,index);
    paramsBundle.putInt(Extra.EXTRA_PARAMETERS_COUNT,count);
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_RECEIVED,paramsBundle);
  }
 catch (  DeadObjectException e) {
    handleDeadObjectException(e);
  }
catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95019
Project: 95019
Buggy source:
@Override public void connect() throws RemoteException {
  try {
    getDroneMgr().connect();
  }
 catch (  ConnectionException e) {
    getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
  }
}

Fixed version (ground truth):
@Override public void connect() throws RemoteException {
  try {
    getDroneMgr().connect();
  }
 catch (  ConnectionException e) {
    try {
      getCallback().onConnectionFailed(new ConnectionResult(0,e.getMessage()));
    }
 catch (    DeadObjectException d) {
      handleDeadObjectException(d);
    }
  }
}
Program: 95020
Project: 95020
Buggy source:
@Override public void onBeginReceivingParameters(){
  try {
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_REFRESH_STARTED,emptyBundle);
  }
 catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void onBeginReceivingParameters(){
  try {
    getCallback().onDroneEvent(Event.EVENT_PARAMETERS_REFRESH_STARTED,emptyBundle);
  }
 catch (  DeadObjectException e) {
    handleDeadObjectException(e);
  }
catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95021
Project: 95021
Buggy source:
@Override public void newEstimation(FitPoints fit,List<ThreeSpacePoint> points){
  double fitness=fit.getFitness();
  double[] fitCenter=fit.center.isNaN() ? null : new double[]{fit.center.getEntry(0),fit.center.getEntry(1),fit.center.getEntry(2)};
  double[] fitRadii=fit.radii.isNaN() ? null : new double[]{fit.radii.getEntry(0),fit.radii.getEntry(1),fit.radii.getEntry(2)};
  Bundle paramsBundle=new Bundle(4);
  paramsBundle.putDouble(Extra.EXTRA_CALIBRATION_MAG_FITNESS,fitness);
  paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_FIT_CENTER,fitCenter);
  paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_FIT_RADII,fitRadii);
  paramsBundle.putParcelableArrayList(Extra.EXTRA_CALIBRATION_MAG_POINTS,MathUtil.threeSpacePointToPoint3D(points));
  try {
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_ESTIMATION,paramsBundle);
  }
 catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void newEstimation(FitPoints fit,List<ThreeSpacePoint> points){
  double fitness=fit.getFitness();
  double[] fitCenter=fit.center.isNaN() ? null : new double[]{fit.center.getEntry(0),fit.center.getEntry(1),fit.center.getEntry(2)};
  double[] fitRadii=fit.radii.isNaN() ? null : new double[]{fit.radii.getEntry(0),fit.radii.getEntry(1),fit.radii.getEntry(2)};
  Bundle paramsBundle=new Bundle(4);
  paramsBundle.putDouble(Extra.EXTRA_CALIBRATION_MAG_FITNESS,fitness);
  paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_FIT_CENTER,fitCenter);
  paramsBundle.putDoubleArray(Extra.EXTRA_CALIBRATION_MAG_FIT_RADII,fitRadii);
  paramsBundle.putParcelableArrayList(Extra.EXTRA_CALIBRATION_MAG_POINTS,MathUtil.threeSpacePointToPoint3D(points));
  try {
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_MAG_ESTIMATION,paramsBundle);
  }
 catch (  DeadObjectException e) {
    handleDeadObjectException(e);
  }
catch (  RemoteException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 95022
Project: 95022
Buggy source:
@Override public void startIMUCalibration() throws RemoteException {
  if (!getDroneMgr().getDrone().getCalibrationSetup().startCalibration()) {
    Bundle extrasBundle=new Bundle(1);
    extrasBundle.putString(Extra.EXTRA_CALIBRATION_IMU_MESSAGE,context.getString(R.string.failed_start_calibration_message));
    getCallback().onDroneEvent(Event.EVENT_CALIBRATION_IMU_ERROR,extrasBundle);
  }
}

Fixed version (ground truth):
@Override public void startIMUCalibration() throws RemoteException {
  if (!getDroneMgr().getDrone().getCalibrationSetup().startCalibration()) {
    Bundle extrasBundle=new Bundle(1);
    extrasBundle.putString(Extra.EXTRA_CALIBRATION_IMU_MESSAGE,context.getString(R.string.failed_start_calibration_message));
    try {
      getCallback().onDroneEvent(Event.EVENT_CALIBRATION_IMU_ERROR,extrasBundle);
    }
 catch (    DeadObjectException e) {
      handleDeadObjectException(e);
    }
  }
}
Program: 95023
Project: 95023
Buggy source:
boolean disconnectFromApi(final ConnectionParameter connParams,IDroidPlannerApiCallback callback){
  ConcurrentHashMap<IBinder,DPApi> binderApis=dpApisCache.get(connParams);
  if (binderApis == null) {
    return false;
  }
  boolean wasRemoved=false;
  DPApi dpApi=binderApis.remove(callback.asBinder());
  if (dpApi != null) {
    dpApi.destroy();
    wasRemoved=true;
  }
  if (binderApis.isEmpty()) {
    dpApisCache.remove(connParams);
    DroneManager droneMgr=dronePerConnection.remove(connParams);
    droneMgr.destroy();
    lbm.sendBroadcast(new Intent(ACTION_DRONE_DESTROYED));
  }
  return wasRemoved;
}

Fixed version (ground truth):
boolean disconnectFromApi(final ConnectionParameter connParams,IDroidPlannerApiCallback callback){
  ConcurrentHashMap<IBinder,DPApi> binderApis=dpApisCache.get(connParams);
  if (binderApis == null) {
    return false;
  }
  boolean wasRemoved=false;
  DPApi dpApi=binderApis.remove(callback.asBinder());
  if (dpApi != null) {
    dpApi.destroy();
    wasRemoved=true;
  }
  if (binderApis.isEmpty()) {
    dpApisCache.remove(connParams);
    DroneManager droneMgr=dronePerConnection.remove(connParams);
    if (droneMgr != null)     droneMgr.destroy();
    lbm.sendBroadcast(new Intent(ACTION_DRONE_DESTROYED));
  }
  return wasRemoved;
}
Program: 95024
Project: 95024
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (DroneManager.ACTION_DRONE_CREATED.equals(action) || DroneManager.ACTION_DRONE_DESTROYED.equals(action)) {
    refreshDroneList();
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (DroidPlannerService.ACTION_DRONE_CREATED.equals(action) || DroidPlannerService.ACTION_DRONE_DESTROYED.equals(action)) {
    refreshDroneList();
  }
}