nus-yam/ex-repair huggingface dataset:
Program: 94663
Project: 94663
Buggy source:
@Override public void onLocationResult(LocationResult result){
  final Location androidLocation=result.getLastLocation();
  if (androidLocation == null)   return;
  org.droidplanner.services.android.impl.core.gcs.location.Location gcsLocation=locationRelay.toGcsLocation(androidLocation);
  Timber.d("String_Node_Str" + LocationRelay.getLatLongFromLocation(androidLocation));
  notifyLocationUpdate(gcsLocation);
}

Fixed version (ground truth):
@Override public void onLocationResult(LocationResult result){
  final Location androidLocation=result.getLastLocation();
  if (androidLocation == null)   return;
  org.droidplanner.services.android.impl.core.gcs.location.Location gcsLocation=locationRelay.toGcsLocation(androidLocation);
  if (gcsLocation == null)   return;
  Timber.d("String_Node_Str" + LocationRelay.getLatLongFromLocation(androidLocation));
  notifyLocationUpdate(gcsLocation);
}
Program: 94664
Project: 94664
Buggy source:
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    if (!connParams.equals(this.connectionParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}

Fixed version (ground truth):
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    ConnectionParameter currentConnParams=this.connectionParams == null ? this.connectionParams : checkConnectionParameter(this.connectionParams);
    if (!connParams.equals(currentConnParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}
Program: 94665
Project: 94665
Buggy source:
public AndroidTcpConnection(Context context,String tcpServerIp,int tcpServerPort){
  super(context);
  this.serverIp=tcpServerIp;
  this.serverPort=tcpServerPort;
  mConnectionImpl=new TcpConnection(){
    @Override protected int loadServerPort(){
      return serverPort;
    }
    @Override protected String loadServerIP(){
      return serverIp;
    }
    @Override protected Logger initLogger(){
      return AndroidTcpConnection.this.initLogger();
    }
    @Override protected void onConnectionOpened(){
      AndroidTcpConnection.this.onConnectionOpened();
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      AndroidTcpConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}

Fixed version (ground truth):
public AndroidTcpConnection(Context context,String tcpServerIp,int tcpServerPort){
  this(context,tcpServerIp,tcpServerPort,null);
}
Program: 94666
Project: 94666
Buggy source:
public AndroidUdpConnection(Context context,int udpServerPort){
  super(context);
  this.serverPort=udpServerPort;
  mConnectionImpl=new UdpConnection(){
    @Override protected int loadServerPort(){
      return serverPort;
    }
    @Override protected Logger initLogger(){
      return AndroidUdpConnection.this.initLogger();
    }
    @Override protected void onConnectionOpened(){
      AndroidUdpConnection.this.onConnectionOpened();
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      AndroidUdpConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}

Fixed version (ground truth):
public AndroidUdpConnection(Context context,int udpServerPort){
  this(context,udpServerPort,null);
}
Program: 94668
Project: 94668
Buggy source:
private void enableFollowMe(){
  lastLocation=null;
  state=FollowStates.FOLLOW_START;
  locationFinder.enableLocationUpdates();
  followAlgorithm.enableFollow();
  droneMgr.onAttributeEvent(AttributeEvent.FOLLOW_START,null,false);
}

Fixed version (ground truth):
private void enableFollowMe(){
  GuidedPoint.changeToGuidedMode(droneMgr.getDrone(),null);
  state=FollowStates.FOLLOW_START;
  locationFinder.enableLocationUpdates();
  followAlgorithm.enableFollow();
  droneMgr.onAttributeEvent(AttributeEvent.FOLLOW_START,null,false);
}
Program: 94669
Project: 94669
Buggy source:
private void disableFollowMe(){
  followAlgorithm.disableFollow();
  locationFinder.disableLocationUpdates();
  lastLocation=null;
  if (isEnabled()) {
    state=FollowStates.FOLLOW_END;
    droneMgr.onAttributeEvent(AttributeEvent.FOLLOW_STOP,null,false);
  }
}

Fixed version (ground truth):
private void disableFollowMe(){
  followAlgorithm.disableFollow();
  locationFinder.disableLocationUpdates();
  lastLocation=null;
  if (isEnabled()) {
    state=FollowStates.FOLLOW_END;
    droneMgr.onAttributeEvent(AttributeEvent.FOLLOW_STOP,null,false);
  }
  final MavLinkDrone drone=droneMgr.getDrone();
  if (GuidedPoint.isGuidedMode(drone)) {
    droneMgr.getDrone().executeAsyncAction(new Action(ControlActions.ACTION_SEND_BRAKE_VEHICLE),null);
  }
}
Program: 94670
Project: 94670
Buggy source:
public void toggleFollowMeState(){
  final MavLinkDrone drone=droneMgr.getDrone();
  final State droneState=drone == null ? null : drone.getState();
  if (droneState == null) {
    state=FollowStates.FOLLOW_INVALID_STATE;
    return;
  }
  if (isEnabled()) {
    disableFollowMe();
  }
 else {
    if (droneMgr.isConnected()) {
      if (droneState.isArmed()) {
        GuidedPoint.changeToGuidedMode(drone,null);
        enableFollowMe();
      }
 else {
        state=FollowStates.FOLLOW_DRONE_NOT_ARMED;
      }
    }
 else {
      state=FollowStates.FOLLOW_DRONE_DISCONNECTED;
    }
  }
}

Fixed version (ground truth):
public void toggleFollowMeState(){
  final MavLinkDrone drone=droneMgr.getDrone();
  final State droneState=drone == null ? null : drone.getState();
  if (droneState == null) {
    state=FollowStates.FOLLOW_INVALID_STATE;
    return;
  }
  if (isEnabled()) {
    disableFollowMe();
  }
 else {
    if (droneMgr.isConnected()) {
      if (droneState.isArmed()) {
        enableFollowMe();
      }
 else {
        state=FollowStates.FOLLOW_DRONE_NOT_ARMED;
      }
    }
 else {
      state=FollowStates.FOLLOW_DRONE_DISCONNECTED;
    }
  }
}
Program: 94671
Project: 94671
Buggy source:
public void disableFollow(){
  if (isFollowEnabled.compareAndSet(true,false)) {
    final MavLinkDrone drone=droneMgr.getDrone();
    if (GuidedPoint.isGuidedMode(drone)) {
      droneMgr.getDrone().executeAsyncAction(new Action(ControlActions.ACTION_SEND_BRAKE_VEHICLE),null);
    }
    if (roiEstimator != null)     roiEstimator.disableFollow();
  }
}

Fixed version (ground truth):
public void disableFollow(){
  if (isFollowEnabled.compareAndSet(true,false)) {
    if (roiEstimator != null)     roiEstimator.disableFollow();
  }
}
Program: 94672
Project: 94672
Buggy source:
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    if (!connParams.equals(this.connectionParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}

Fixed version (ground truth):
public void connect(ConnectionParameter connParams){
  try {
    connParams=checkConnectionParameter(connParams);
    ConnectionParameter currentConnParams=this.connectionParams == null ? this.connectionParams : checkConnectionParameter(this.connectionParams);
    if (!connParams.equals(currentConnParams)) {
      if (this.droneMgr != null) {
        LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.ADDRESS_IN_USE,"String_Node_Str");
        onConnectionStatus(connectionStatus);
        return;
      }
      this.connectionParams=connParams;
      this.droneMgr=service.connectDroneManager(this.connectionParams,ownerId,this);
    }
  }
 catch (  ConnectionException e) {
    LinkConnectionStatus connectionStatus=LinkConnectionStatus.newFailedConnectionStatus(LinkConnectionStatus.INVALID_CREDENTIALS,e.getMessage());
    onConnectionStatus(connectionStatus);
    disconnect();
  }
}
Program: 94673
Project: 94673
Buggy source:
public AndroidTcpConnection(Context context,String tcpServerIp,int tcpServerPort){
  super(context);
  this.serverIp=tcpServerIp;
  this.serverPort=tcpServerPort;
  mConnectionImpl=new TcpConnection(){
    @Override protected int loadServerPort(){
      return serverPort;
    }
    @Override protected String loadServerIP(){
      return serverIp;
    }
    @Override protected Logger initLogger(){
      return AndroidTcpConnection.this.initLogger();
    }
    @Override protected void onConnectionOpened(){
      AndroidTcpConnection.this.onConnectionOpened();
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      AndroidTcpConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}

Fixed version (ground truth):
public AndroidTcpConnection(Context context,String tcpServerIp,int tcpServerPort){
  this(context,tcpServerIp,tcpServerPort,null);
}
Program: 94674
Project: 94674
Buggy source:
public AndroidUdpConnection(Context context,int udpServerPort){
  super(context);
  this.serverPort=udpServerPort;
  mConnectionImpl=new UdpConnection(){
    @Override protected int loadServerPort(){
      return serverPort;
    }
    @Override protected Logger initLogger(){
      return AndroidUdpConnection.this.initLogger();
    }
    @Override protected void onConnectionOpened(){
      AndroidUdpConnection.this.onConnectionOpened();
    }
    @Override protected void onConnectionStatus(    LinkConnectionStatus connectionStatus){
      AndroidUdpConnection.this.onConnectionStatus(connectionStatus);
    }
  }
;
}

Fixed version (ground truth):
public AndroidUdpConnection(Context context,int udpServerPort){
  this(context,udpServerPort,null);
}
Program: 94676
Project: 94676
Buggy source:
public void setCurrentHomeLocation(LatLongAlt currentHomeLocation){
  this.currentHomeLocation=currentHomeLocation;
}

Fixed version (ground truth):
public void setCurrentHomeLocation(LatLongAlt currentHomeLocation){
  this.currentHomeLocation=currentHomeLocation == null ? null : new LatLongAlt(currentHomeLocation);
}
Program: 94677
Project: 94677
Buggy source:
public void setOriginalHomeLocation(LatLongAlt originalHomeLocation){
  this.originalHomeLocation=originalHomeLocation;
}

Fixed version (ground truth):
public void setOriginalHomeLocation(LatLongAlt originalHomeLocation){
  this.originalHomeLocation=originalHomeLocation == null ? null : new LatLongAlt(originalHomeLocation);
}
Program: 94678
Project: 94678
Buggy source:
public void disable(){
  if (isEnabled.compareAndSet(true,false)) {
    Timber.i("String_Node_Str");
    locationFinder.disableLocationUpdates();
    currentState.setCurrentHomeLocation(null);
    updateCurrentState(ReturnToMeState.STATE_IDLE);
    this.commandListener=null;
  }
}

Fixed version (ground truth):
public void disable(){
  if (isEnabled.compareAndSet(true,false)) {
    Timber.i("String_Node_Str");
    locationFinder.disableLocationUpdates();
    currentState.setCurrentHomeLocation(null);
    final LatLongAlt originalHomeLocation=currentState.getOriginalHomeLocation();
    if (originalHomeLocation != null) {
      MavLinkDoCmds.setVehicleHome(droneMgr.getDrone(),originalHomeLocation,new AbstractCommandListener(){
        @Override public void onSuccess(){
          Timber.i("String_Node_Str",originalHomeLocation.toString());
          droneMgr.getDrone().executeAsyncAction(requestHomeUpdateAction,null);
        }
        @Override public void onError(        int executionError){
          Timber.e("String_Node_Str",executionError);
        }
        @Override public void onTimeout(){
          Timber.w("String_Node_Str");
        }
      }
);
    }
    updateCurrentState(ReturnToMeState.STATE_IDLE);
    this.commandListener=null;
  }
}
Program: 94679
Project: 94679
Buggy source:
/** 
 * Update the vehicle data stream rate.
 * @param rate          The new data stream rate
 * @param listener      Register a callback to receive update of the command execution state
 * @since 2.9.0
 */
public void updateVehicleDataStreamRate(int rate,final AbstractCommandListener listener){
  Bundle params=new Bundle();
  params.putInt(EXTRA_VEHICLE_DATA_STREAM_RATE,rate);
  drone.performAsyncActionOnDroneThread(new Action(ACTION_UPDATE_VEHICLE_DATA_STREAM_RATE,params),listener);
}

Fixed version (ground truth):
/** 
 * Update the vehicle data stream rate. Note: This is ineffective for Solo vehicles since their data stream rate is handled by the onboard companion computer.
 * @param rate          The new data stream rate
 * @param listener      Register a callback to receive update of the command execution state
 * @since 2.9.0
 */
public void updateVehicleDataStreamRate(int rate,final AbstractCommandListener listener){
  Bundle params=new Bundle();
  params.putInt(EXTRA_VEHICLE_DATA_STREAM_RATE,rate);
  drone.performAsyncActionOnDroneThread(new Action(ACTION_UPDATE_VEHICLE_DATA_STREAM_RATE,params),listener);
}
Program: 94681
Project: 94681
Buggy source:
private void resetNetworkBindings(ConnectivityManager.NetworkCallback netCb){
  Timber.i("String_Node_Str");
  connectedSoloWifi.set("String_Node_Str");
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    try {
      connMgr.unregisterNetworkCallback(netCb);
    }
 catch (    IllegalArgumentException e) {
      Timber.w(e,"String_Node_Str");
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      connMgr.bindProcessToNetwork(null);
    }
 else {
      ConnectivityManager.setProcessDefaultNetwork(null);
    }
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void resetNetworkBindings(ConnectivityManager.NetworkCallback netCb){
  Timber.i("String_Node_Str");
  connectedSoloWifi.set("String_Node_Str");
  try {
    connMgr.unregisterNetworkCallback(netCb);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    connMgr.bindProcessToNetwork(null);
  }
 else {
    ConnectivityManager.setProcessDefaultNetwork(null);
  }
}
Program: 94682
Project: 94682
Buggy source:
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  resetNetworkBindings((ConnectivityManager.NetworkCallback)netReqCb);
}

Fixed version (ground truth):
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    resetNetworkBindings((ConnectivityManager.NetworkCallback)netReqCb);
  }
}
Program: 94683
Project: 94683
Buggy source:
public MockMAVLinkClient(Context context,DataLink.DataLinkListener listener,ConnectionParameter connParams){
  super(context,listener,connParams);
}

Fixed version (ground truth):
public MockMAVLinkClient(Context context,DataLink.DataLinkListener listener,ConnectionParameter connParams){
  super(context,listener,connParams,null);
}
Program: 94684
Project: 94684
Buggy source:
protected SoloFollowOptionsV2(Parcel in){
  super(in);
  this.freeLook=in.readByte() != 0;
}

Fixed version (ground truth):
protected SoloFollowOptionsV2(Parcel in){
  super(in);
  this.freeLook=in.readByte() != FREE_LOOK_DISABLED_VALUE;
}
Program: 94685
Project: 94685
Buggy source:
@Override public int hashCode(){
  int result=super.hashCode();
  result=31 * result + (freeLook ? 1 : 0);
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=super.hashCode();
  result=31 * result + (freeLook ? FREE_LOOK_ENABLED_VALUE : FREE_LOOK_DISABLED_VALUE);
  return result;
}
Program: 94686
Project: 94686
Buggy source:
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeByte(freeLook ? (byte)1 : (byte)0);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeByte(freeLook ? (byte)FREE_LOOK_ENABLED_VALUE : (byte)FREE_LOOK_DISABLED_VALUE);
}
Program: 94688
Project: 94688
Buggy source:
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(Network network){
  final String currentWifi=getCurrentWifiLink();
  if (!isSoloWifi(currentWifi)) {
    Timber.i("String_Node_Str");
    connMgr.unregisterNetworkCallback(this);
    connectedSoloWifi.set("String_Node_Str");
    return;
  }
  Timber.i("String_Node_Str",network);
  getNetworkInfo(network);
  final boolean wasBound;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    wasBound=connMgr.bindProcessToNetwork(network);
  }
 else {
    wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
  }
  if (wasBound) {
    Timber.i("String_Node_Str",network);
    notifyWifiConnected(currentWifi);
  }
 else {
    Timber.w("String_Node_Str",network);
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(Network network){
  final String currentWifi=getCurrentWifiLink();
  if (!isSoloWifi(currentWifi)) {
    resetNetworkBindings(this);
    return;
  }
  Timber.i("String_Node_Str",network);
  getNetworkInfo(network);
  final boolean wasBound;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    wasBound=connMgr.bindProcessToNetwork(network);
  }
 else {
    wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
  }
  if (wasBound) {
    Timber.i("String_Node_Str",network);
    notifyWifiConnected(currentWifi);
  }
 else {
    Timber.w("String_Node_Str",network);
  }
}
Program: 94690
Project: 94690
Buggy source:
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  try {
    connectedSoloWifi.set("String_Node_Str");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      connMgr.unregisterNetworkCallback((ConnectivityManager.NetworkCallback)netReqCb);
    }
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  resetNetworkBindings((ConnectivityManager.NetworkCallback)netReqCb);
}
Program: 94692
Project: 94692
Buggy source:
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(Network network){
  Timber.i("String_Node_Str",network);
  getNetworkInfo(network);
  final boolean wasBound;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    wasBound=connMgr.bindProcessToNetwork(network);
  }
 else {
    wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
  }
  if (wasBound) {
    Timber.i("String_Node_Str",network);
    notifyWifiConnected(trimmedSsid);
  }
 else {
    Timber.w("String_Node_Str",network);
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(Network network){
  final String currentWifi=getCurrentWifiLink();
  if (!isSoloWifi(currentWifi)) {
    Timber.i("String_Node_Str");
    connMgr.unregisterNetworkCallback(this);
    connectedSoloWifi.set("String_Node_Str");
    return;
  }
  Timber.i("String_Node_Str",network);
  getNetworkInfo(network);
  final boolean wasBound;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    wasBound=connMgr.bindProcessToNetwork(network);
  }
 else {
    wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
  }
  if (wasBound) {
    Timber.i("String_Node_Str",network);
    notifyWifiConnected(currentWifi);
  }
 else {
    Timber.w("String_Node_Str",network);
  }
}
Program: 94693
Project: 94693
Buggy source:
private void setDefaultNetworkIfNecessary(String wifiSsid){
  final String trimmedSsid=trimWifiSsid(wifiSsid);
  if (isConnected(wifiSsid)) {
    notifyWifiConnected(wifiSsid);
    return;
  }
  if (isSoloWifi(trimmedSsid)) {
    Timber.i("String_Node_Str");
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
      NetworkRequest netReq=new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED).addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addTransportType(NetworkCapabilities.TRANSPORT_WIFI).build();
      connMgr.requestNetwork(netReq,new ConnectivityManager.NetworkCallback(){
        @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void getNetworkInfo(        Network network){
          if (network == null) {
            Timber.i("String_Node_Str");
          }
 else {
            Timber.i("String_Node_Str",network,connMgr.isDefaultNetworkActive());
            LinkProperties linkProps=connMgr.getLinkProperties(network);
            Timber.i("String_Node_Str",linkProps.toString());
            Timber.i("String_Node_Str",connMgr.getNetworkCapabilities(network));
          }
        }
        @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(        Network network){
          Timber.i("String_Node_Str",network);
          getNetworkInfo(network);
          final boolean wasBound;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            wasBound=connMgr.bindProcessToNetwork(network);
          }
 else {
            wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
          }
          if (wasBound) {
            Timber.i("String_Node_Str",network);
            notifyWifiConnected(trimmedSsid);
          }
 else {
            Timber.w("String_Node_Str",network);
          }
        }
        @Override public void onLosing(        Network network,        int maxMsToLive){
          Timber.w("String_Node_Str",network);
        }
        @Override public void onLost(        Network network){
          Timber.w("String_Node_Str",network);
        }
      }
);
    }
 else {
      notifyWifiConnected(trimmedSsid);
    }
  }
 else {
    notifyWifiConnected(trimmedSsid);
  }
}

Fixed version (ground truth):
private void setDefaultNetworkIfNecessary(String wifiSsid){
  final String trimmedSsid=trimWifiSsid(wifiSsid);
  if (isConnected(wifiSsid)) {
    notifyWifiConnected(wifiSsid);
    return;
  }
  if (isSoloWifi(trimmedSsid)) {
    Timber.i("String_Node_Str");
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
      if (!trimmedSsid.equals(connectedSoloWifi.get())) {
        connMgr.requestNetwork((NetworkRequest)netReq,(ConnectivityManager.NetworkCallback)netReqCb);
        connectedSoloWifi.set(trimmedSsid);
      }
    }
 else {
      notifyWifiConnected(trimmedSsid);
    }
  }
 else {
    notifyWifiConnected(trimmedSsid);
  }
}
Program: 94694
Project: 94694
Buggy source:
public WifiConnectionHandler(Context context){
  this.context=context;
  this.wifiMgr=(WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
  this.connMgr=(ConnectivityManager)this.context.getSystemService(Context.CONNECTIVITY_SERVICE);
}

Fixed version (ground truth):
public WifiConnectionHandler(Context context){
  this.context=context;
  this.wifiMgr=(WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
  this.connMgr=(ConnectivityManager)this.context.getSystemService(Context.CONNECTIVITY_SERVICE);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    netReq=new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED).addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addTransportType(NetworkCapabilities.TRANSPORT_WIFI).build();
    netReqCb=new ConnectivityManager.NetworkCallback(){
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void getNetworkInfo(      Network network){
        if (network == null) {
          Timber.i("String_Node_Str");
        }
 else {
          Timber.i("String_Node_Str",network,connMgr.isDefaultNetworkActive());
          LinkProperties linkProps=connMgr.getLinkProperties(network);
          Timber.i("String_Node_Str",linkProps.toString());
          Timber.i("String_Node_Str",connMgr.getNetworkCapabilities(network));
        }
      }
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(      Network network){
        final String currentWifi=getCurrentWifiLink();
        if (!isSoloWifi(currentWifi)) {
          Timber.i("String_Node_Str");
          connMgr.unregisterNetworkCallback(this);
          connectedSoloWifi.set("String_Node_Str");
          return;
        }
        Timber.i("String_Node_Str",network);
        getNetworkInfo(network);
        final boolean wasBound;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
          wasBound=connMgr.bindProcessToNetwork(network);
        }
 else {
          wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
        }
        if (wasBound) {
          Timber.i("String_Node_Str",network);
          notifyWifiConnected(currentWifi);
        }
 else {
          Timber.w("String_Node_Str",network);
        }
      }
      @Override public void onLosing(      Network network,      int maxMsToLive){
        Timber.w("String_Node_Str",network);
      }
      @Override public void onLost(      Network network){
        Timber.w("String_Node_Str",network);
      }
    }
;
  }
 else {
    netReq=null;
    netReqCb=null;
  }
}
Program: 94695
Project: 94695
Buggy source:
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.d("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Stop the wifi connection handler process.
 */
public void stop(){
  try {
    this.context.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
  try {
    connectedSoloWifi.set("String_Node_Str");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      connMgr.unregisterNetworkCallback((ConnectivityManager.NetworkCallback)netReqCb);
    }
  }
 catch (  IllegalArgumentException e) {
    Timber.w(e,"String_Node_Str");
  }
}
Program: 94696
Project: 94696
Buggy source:
@Override public void destroy(){
  events.removeAllDroneListeners();
  ParameterManager parameterManager=getParameterManager();
  if (parameterManager != null)   parameterManager.setParameterListener(null);
  MagnetometerCalibrationImpl magnetometer=getMagnetometerCalibration();
  if (magnetometer != null)   magnetometer.setListener(null);
}

Fixed version (ground truth):
@Override public void destroy(){
  ParameterManager parameterManager=getParameterManager();
  if (parameterManager != null)   parameterManager.setParameterListener(null);
  MagnetometerCalibrationImpl magnetometer=getMagnetometerCalibration();
  if (magnetometer != null)   magnetometer.setListener(null);
}
Program: 94697
Project: 94697
Buggy source:
private boolean processNALUChunk(NALUChunk naluChunk){
  if (naluChunk == null)   return false;
  final MediaCodec mediaCodec=mediaCodecRef.get();
  if (mediaCodec == null)   return false;
  try {
    final int index=mediaCodec.dequeueInputBuffer(-1);
    if (index >= 0) {
      ByteBuffer inputBuffer;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        inputBuffer=mediaCodec.getInputBuffer(index);
      }
 else {
        inputBuffer=mediaCodec.getInputBuffers()[index];
      }
      if (inputBuffer == null)       return false;
      inputBuffer.clear();
      int totalLength=0;
      int payloadCount=naluChunk.payloads.length;
      for (int i=0; i < payloadCount; i++) {
        ByteBuffer payload=naluChunk.payloads[i];
        if (payload.capacity() == 0)         continue;
        inputBuffer.order(payload.order());
        final int dataLength=payload.position();
        byte[] payloadData=payload.array();
        inputBuffer.put(payloadData,0,dataLength);
        totalLength+=dataLength;
        streamRecorder.onNaluChunkUpdated(payloadData,0,dataLength);
      }
      mediaCodec.queueInputBuffer(index,0,totalLength,naluChunk.presentationTime,naluChunk.flags);
    }
  }
 catch (  IllegalStateException e) {
    Log.e(TAG,e.getMessage(),e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean processNALUChunk(NALUChunk naluChunk){
  if (naluChunk == null)   return false;
  final MediaCodec mediaCodec=mediaCodecRef.get();
  if (mediaCodec == null)   return false;
  try {
    final int index=mediaCodec.dequeueInputBuffer(-1);
    if (index >= 0) {
      ByteBuffer inputBuffer;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        inputBuffer=mediaCodec.getInputBuffer(index);
      }
 else {
        inputBuffer=mediaCodec.getInputBuffers()[index];
      }
      if (inputBuffer == null)       return false;
      inputBuffer.clear();
      int totalLength=0;
      int payloadCount=naluChunk.payloads.length;
      for (int i=0; i < payloadCount; i++) {
        ByteBuffer payload=naluChunk.payloads[i];
        if (payload.capacity() == 0)         continue;
        inputBuffer.order(payload.order());
        final int dataLength=payload.position();
        byte[] payloadData=payload.array();
        inputBuffer.put(payloadData,0,dataLength);
        totalLength+=dataLength;
      }
      streamRecorder.onNaluChunkUpdated(naluChunkAssembler.getParametersSet(),naluChunk);
      mediaCodec.queueInputBuffer(index,0,totalLength,naluChunk.presentationTime,naluChunk.flags);
    }
  }
 catch (  IllegalStateException e) {
    Log.e(TAG,e.getMessage(),e);
    return false;
  }
  return true;
}
Program: 94698
Project: 94698
Buggy source:
boolean disableRecording(){
  if (isRecordingEnabled()) {
    Timber.i("String_Node_Str");
    if (h264Writer != null) {
      try {
        h264Writer.close();
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
 finally {
        h264Writer=null;
        convertToMp4(recordingFilename.get());
        recordingFilename.set(null);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
boolean disableRecording(){
  if (isRecordingEnabled()) {
    Timber.i("String_Node_Str");
    if (h264Writer != null) {
      try {
        h264Writer.close();
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
 finally {
        h264Writer=null;
        convertToMp4(recordingFilename.get());
        recordingFilename.set(null);
      }
    }
  }
  areParametersSet.set(false);
  return true;
}
Program: 94699
Project: 94699
Buggy source:
void onNaluChunkUpdated(byte[] payload,int index,int payloadLength){
  if (isRecordingEnabled() && h264Writer != null) {
    try {
      h264Writer.write(payload,index,payloadLength);
    }
 catch (    IOException e) {
      Timber.e(e,e.getMessage());
    }
  }
}

Fixed version (ground truth):
void onNaluChunkUpdated(NALUChunk parametersSet,NALUChunk dataChunk){
  if (isRecordingEnabled() && h264Writer != null) {
    if (areParametersSet.get()) {
      try {
        writeNaluChunk(h264Writer,dataChunk);
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
    }
 else {
      try {
        areParametersSet.set(writeNaluChunk(h264Writer,parametersSet));
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
    }
  }
}
Program: 94700
Project: 94700
Buggy source:
boolean enableRecording(String mediaFilename){
  if (!isRecordingEnabled()) {
    recordingFilename.set(mediaFilename);
    Timber.i("String_Node_Str",mediaFilename);
    File h264File=new File(mediaRootDir,mediaFilename);
    if (h264File.exists())     h264File.delete();
    try {
      h264Writer=new BufferedOutputStream(new FileOutputStream(h264File));
      return true;
    }
 catch (    FileNotFoundException e) {
      Timber.e(e,e.getMessage());
      recordingFilename.set(null);
      return false;
    }
  }
 else {
    Timber.w("String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
boolean enableRecording(String mediaFilename){
  if (!isRecordingEnabled()) {
    areParametersSet.set(false);
    recordingFilename.set(mediaFilename);
    Timber.i("String_Node_Str",mediaFilename);
    File h264File=new File(mediaRootDir,mediaFilename);
    if (h264File.exists())     h264File.delete();
    try {
      h264Writer=new BufferedOutputStream(new FileOutputStream(h264File));
      return true;
    }
 catch (    FileNotFoundException e) {
      Timber.e(e,e.getMessage());
      recordingFilename.set(null);
      return false;
    }
  }
 else {
    Timber.w("String_Node_Str");
    return false;
  }
}
Program: 94703
Project: 94703
Buggy source:
StreamRecorder(Context context){
  this.mediaRootDir=new File(context.getExternalFilesDir(Environment.DIRECTORY_MOVIES),"String_Node_Str");
  if (!this.mediaRootDir.exists()) {
    this.mediaRootDir.mkdirs();
  }
  this.mediaScanner=new MediaScannerConnection(context,new MediaScannerConnection.MediaScannerConnectionClient(){
    @Override public void onMediaScannerConnected(){
    }
    @Override public void onScanCompleted(    String path,    Uri uri){
      Timber.i("String_Node_Str",path,uri);
    }
  }
);
}

Fixed version (ground truth):
StreamRecorder(Context context){
  this.context=context;
  this.mediaRootDir=new File(context.getExternalFilesDir(Environment.DIRECTORY_MOVIES),"String_Node_Str");
  if (!this.mediaRootDir.exists()) {
    this.mediaRootDir.mkdirs();
  }
}
Program: 94704
Project: 94704
Buggy source:
@Override public void run(){
  Timber.i("String_Node_Str");
  Timber.i("String_Node_Str",filename);
  if (TextUtils.isEmpty(filename)) {
    Timber.w("String_Node_Str");
    return;
  }
  File rawMedia=new File(mediaRootDir,filename);
  if (!rawMedia.exists()) {
    Timber.w("String_Node_Str");
    return;
  }
  try {
    H264TrackImpl h264Track=new H264TrackImpl(new FileDataSourceImpl(rawMedia));
    Movie movie=new Movie();
    movie.addTrack(h264Track);
    Container mp4File=new DefaultMp4Builder().build(movie);
    File dstDir=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
    File mp4Media=new File(dstDir,filename + "String_Node_Str");
    Timber.i("String_Node_Str",mp4Media.getAbsolutePath());
    FileChannel fc=new FileOutputStream(mp4Media).getChannel();
    mp4File.writeContainer(fc);
    fc.close();
    Timber.i("String_Node_Str");
    rawMedia.delete();
    Timber.i("String_Node_Str");
    mediaScanner.scanFile(mp4Media.getAbsolutePath(),null);
  }
 catch (  IOException e) {
    Timber.e(e,e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void run(){
  Timber.i("String_Node_Str",filename);
  try {
    H264TrackImpl h264Track=new H264TrackImpl(new FileDataSourceImpl(rawMedia));
    Movie movie=new Movie();
    movie.addTrack(h264Track);
    Container mp4File=new DefaultMp4Builder().build(movie);
    File dstDir=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
    File mp4Media=new File(dstDir,filename + "String_Node_Str");
    Timber.i("String_Node_Str",mp4Media.getAbsolutePath());
    FileChannel fc=new FileOutputStream(mp4Media).getChannel();
    mp4File.writeContainer(fc);
    fc.close();
    Timber.i("String_Node_Str");
    rawMedia.delete();
    Timber.i("String_Node_Str");
    MediaScannerConnection.scanFile(context,new String[]{mp4Media.getAbsolutePath()},null,scanCompletedListener);
  }
 catch (  IOException e) {
    Timber.e(e,e.getMessage());
  }
}
Program: 94705
Project: 94705
Buggy source:
void convertToMp4(final String filename){
  asyncExecutor.execute(new Runnable(){
    @Override public void run(){
      Timber.i("String_Node_Str");
      Timber.i("String_Node_Str",filename);
      if (TextUtils.isEmpty(filename)) {
        Timber.w("String_Node_Str");
        return;
      }
      File rawMedia=new File(mediaRootDir,filename);
      if (!rawMedia.exists()) {
        Timber.w("String_Node_Str");
        return;
      }
      try {
        H264TrackImpl h264Track=new H264TrackImpl(new FileDataSourceImpl(rawMedia));
        Movie movie=new Movie();
        movie.addTrack(h264Track);
        Container mp4File=new DefaultMp4Builder().build(movie);
        File dstDir=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
        File mp4Media=new File(dstDir,filename + "String_Node_Str");
        Timber.i("String_Node_Str",mp4Media.getAbsolutePath());
        FileChannel fc=new FileOutputStream(mp4Media).getChannel();
        mp4File.writeContainer(fc);
        fc.close();
        Timber.i("String_Node_Str");
        rawMedia.delete();
        Timber.i("String_Node_Str");
        mediaScanner.scanFile(mp4Media.getAbsolutePath(),null);
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
    }
  }
);
}

Fixed version (ground truth):
void convertToMp4(final String filename){
  if (TextUtils.isEmpty(filename)) {
    Timber.w("String_Node_Str");
    return;
  }
  final File rawMedia=new File(mediaRootDir,filename);
  if (!rawMedia.exists()) {
    Timber.w("String_Node_Str");
    return;
  }
  asyncExecutor.execute(new Runnable(){
    @Override public void run(){
      Timber.i("String_Node_Str",filename);
      try {
        H264TrackImpl h264Track=new H264TrackImpl(new FileDataSourceImpl(rawMedia));
        Movie movie=new Movie();
        movie.addTrack(h264Track);
        Container mp4File=new DefaultMp4Builder().build(movie);
        File dstDir=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
        File mp4Media=new File(dstDir,filename + "String_Node_Str");
        Timber.i("String_Node_Str",mp4Media.getAbsolutePath());
        FileChannel fc=new FileOutputStream(mp4Media).getChannel();
        mp4File.writeContainer(fc);
        fc.close();
        Timber.i("String_Node_Str");
        rawMedia.delete();
        Timber.i("String_Node_Str");
        MediaScannerConnection.scanFile(context,new String[]{mp4Media.getAbsolutePath()},null,scanCompletedListener);
      }
 catch (      IOException e) {
        Timber.e(e,e.getMessage());
      }
    }
  }
);
}
Program: 94706
Project: 94706
Buggy source:
private void startVideoStream(Surface videoSurface){
  SoloCameraApi.getApi(drone).startVideoStream(videoSurface,new AbstractCommandListener(){
    @Override public void onSuccess(){
      if (stopVideoStream != null)       stopVideoStream.setEnabled(true);
      if (startVideoStream != null)       startVideoStream.setEnabled(false);
    }
    @Override public void onError(    int executionError){
      alertUser("String_Node_Str" + executionError);
    }
    @Override public void onTimeout(){
      alertUser("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
private void startVideoStream(Surface videoSurface){
  SoloCameraApi.getApi(drone).startVideoStream(videoSurface,"String_Node_Str",true,new AbstractCommandListener(){
    @Override public void onSuccess(){
      if (stopVideoStream != null)       stopVideoStream.setEnabled(true);
      if (startVideoStream != null)       startVideoStream.setEnabled(false);
    }
    @Override public void onError(    int executionError){
      alertUser("String_Node_Str" + executionError);
    }
    @Override public void onTimeout(){
      alertUser("String_Node_Str");
    }
  }
);
}
Program: 94707
Project: 94707
Buggy source:
@Before public void setUp() throws Exception {
  final Context context=Robolectric.getShadowApplication().getApplicationContext();
  ConnectionParameter connParams=new ConnectionParameter(0,new Bundle(),null);
  mavlinkApi=new MockMavLinkServiceAPI();
  DroidPlannerPrefs dpPrefs=new DroidPlannerPrefs(context);
  MAVLinkClient mavClient=new MAVLinkClient(context,inputStreamListener,connParams,mavlinkApi);
  drone=new ArduCopter(context,mavClient,dpHandler,dpPrefs,new AndroidApWarningParser(),new LogMessageListener(){
    @Override public void onMessageLogged(    int logLevel,    String message){
    }
  }
,new DroneInterfaces.AttributeEventListener(){
    @Override public void onAttributeEvent(    String attributeEvent,    Bundle eventInfo,    boolean checkForSololinkApi){
    }
  }
);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  final Context context=Robolectric.getShadowApplication().getApplicationContext();
  ConnectionParameter connParams=new ConnectionParameter(0,new Bundle(),null);
  mavlinkApi=new MockMavLinkServiceAPI();
  DroidPlannerPrefs dpPrefs=new DroidPlannerPrefs(context);
  MAVLinkClient mavClient=new MAVLinkClient(context,inputStreamListener,connParams,mavlinkApi);
  drone=new ArduCopter(context,mavClient,dpHandler,new AndroidApWarningParser(),new LogMessageListener(){
    @Override public void onMessageLogged(    int logLevel,    String message){
    }
  }
,new DroneInterfaces.AttributeEventListener(){
    @Override public void onAttributeEvent(    String attributeEvent,    Bundle eventInfo,    boolean checkForSololinkApi){
    }
  }
);
}
Program: 94708
Project: 94708
Buggy source:
@Before public void setUp() throws Exception {
  final Context context=Robolectric.getShadowApplication().getApplicationContext();
  ConnectionParameter connParams=new ConnectionParameter(0,new Bundle(),null);
  mavlinkApi=new MockMavLinkServiceAPI();
  DroidPlannerPrefs dpPrefs=new DroidPlannerPrefs(context);
  MAVLinkClient mavClient=new MAVLinkClient(context,inputStreamListener,connParams,mavlinkApi);
  drone=new ArduCopter(context,mavClient,dpHandler,dpPrefs,new AndroidApWarningParser(),new LogMessageListener(){
    @Override public void onMessageLogged(    int logLevel,    String message){
    }
  }
,new DroneInterfaces.AttributeEventListener(){
    @Override public void onAttributeEvent(    String attributeEvent,    Bundle eventInfo,    boolean checkForSololinkApi){
    }
  }
);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  final Context context=Robolectric.getShadowApplication().getApplicationContext();
  ConnectionParameter connParams=new ConnectionParameter(0,new Bundle(),null);
  mavlinkApi=new MockMavLinkServiceAPI();
  MAVLinkClient mavClient=new MAVLinkClient(context,inputStreamListener,connParams,mavlinkApi);
  drone=new ArduCopter(context,mavClient,dpHandler,new AndroidApWarningParser(),new LogMessageListener(){
    @Override public void onMessageLogged(    int logLevel,    String message){
    }
  }
,new DroneInterfaces.AttributeEventListener(){
    @Override public void onAttributeEvent(    String attributeEvent,    Bundle eventInfo,    boolean checkForSololinkApi){
    }
  }
);
}
Program: 94709
Project: 94709
Buggy source:
public void updateFollowCenter(SoloMessageLocation location){
  soloLinkMgr.sendTLVPacket(location,true,null);
}

Fixed version (ground truth):
public void updateFollowCenter(SoloMessageLocation location){
  soloLinkMgr.sendTLVPacket(location,true,new AbstractCommandListener(){
    @Override public void onSuccess(){
    }
    @Override public void onError(    int executionError){
      Timber.w("String_Node_Str",executionError);
    }
    @Override public void onTimeout(){
      Timber.w("String_Node_Str");
    }
  }
);
}
Program: 94710
Project: 94710
Buggy source:
@Override protected ROIEstimator initROIEstimator(MavLinkDrone drone,Handler handler){
  return null;
}

Fixed version (ground truth):
@Override protected ROIEstimator initROIEstimator(MavLinkDrone drone,Handler handler){
  return new SoloROIEstimator(drone,handler,((ArduSolo)drone).getSoloComp());
}
Program: 94711
Project: 94711
Buggy source:
@Override public void enableFollow(){
  super.enableFollow();
  soloComp.enableFollowDataConnection();
}

Fixed version (ground truth):
@Override public void enableFollow(){
  isFollowEnabled.set(true);
}
Program: 94712
Project: 94712
Buggy source:
public FollowSoloShot(DroneManager droneMgr,Handler handler){
  super(droneMgr,handler);
  final ArduSolo drone=(ArduSolo)droneMgr.getDrone();
  this.soloComp=drone.getSoloComp();
}

Fixed version (ground truth):
public FollowSoloShot(DroneManager droneMgr,Handler handler){
  super(droneMgr,handler);
  ArduSolo drone=(ArduSolo)droneMgr.getDrone();
  this.soloComp=drone.getSoloComp();
}
Program: 94713
Project: 94713
Buggy source:
@Override protected void processNewLocation(Location location){
  if (location != null) {
    final LatLongAlt receivedCoord=location.getCoord();
    locationCoord.setAltitude(receivedCoord.getAltitude());
    locationCoord.setLatitude(receivedCoord.getLatitude());
    locationCoord.setLongitude(receivedCoord.getLongitude());
    locationSetter.setCoordinate(locationCoord);
    soloComp.updateFollowCenter(locationSetter);
  }
}

Fixed version (ground truth):
@Override protected void processNewLocation(Location location){
  if (location != null) {
    LatLongAlt receivedCoord=location.getCoord();
    locationCoord.set((LatLong)receivedCoord);
    locationSetter.setCoordinate(locationCoord);
    soloComp.updateFollowCenter(locationSetter);
  }
}
Program: 94714
Project: 94714
Buggy source:
@Override public void disableFollow(){
  super.disableFollow();
  soloComp.disableFollowDataConnection();
}

Fixed version (ground truth):
@Override public void disableFollow(){
  if (isFollowEnabled.compareAndSet(true,false)) {
    realLocation=null;
    disableWatchdog();
  }
}
Program: 94715
Project: 94715
Buggy source:
protected void updateROI(){
  if (realLocation == null) {
    return;
  }
  LatLong gcsCoord=realLocation.getCoord();
  double bearing=realLocation.getBearing();
  double distanceTraveledSinceLastPoint=realLocation.getSpeed() * (System.currentTimeMillis() - timeOfLastLocation) / 1000f;
  LatLong goCoord=GeoTools.newCoordFromBearingAndDistance(gcsCoord,bearing,distanceTraveledSinceLastPoint);
  MavLinkDoCmds.setROI(drone,new LatLongAlt(goCoord.getLatitude(),goCoord.getLongitude(),(0.0)),null);
  if (realLocation.getSpeed() > 0)   watchdog.postDelayed(watchdogCallback,TIMEOUT);
}

Fixed version (ground truth):
protected void updateROI(){
  if (realLocation == null) {
    return;
  }
  LatLong gcsCoord=realLocation.getCoord();
  double bearing=realLocation.getBearing();
  double distanceTraveledSinceLastPoint=realLocation.getSpeed() * (System.currentTimeMillis() - timeOfLastLocation) / 1000f;
  LatLong goCoord=GeoTools.newCoordFromBearingAndDistance(gcsCoord,bearing,distanceTraveledSinceLastPoint);
  sendUpdateROI(goCoord);
  if (realLocation.getSpeed() > 0)   watchdog.postDelayed(watchdogCallback,getUpdatePeriod());
}