nus-yam/ex-repair huggingface dataset:
Program: 94717
Project: 94717
Buggy source:
@Override public void onSuccess(){
  Timber.i("String_Node_Str",locationCoord.toString());
  droneMgr.executeAsyncAction(requestHomeUpdateAction,null);
  CommonApiUtils.postSuccessEvent(commandListener);
  updateCurrentState(ReturnToMeState.STATE_UPDATING_HOME);
}

Fixed version (ground truth):
@Override public void onSuccess(){
  Timber.i("String_Node_Str",locationCoord.toString());
  droneMgr.getDrone().executeAsyncAction(requestHomeUpdateAction,null);
  CommonApiUtils.postSuccessEvent(commandListener);
  updateCurrentState(ReturnToMeState.STATE_UPDATING_HOME);
}
Program: 94718
Project: 94718
Buggy source:
public ArduCopter(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,Preferences pref,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,pref,warningParser,logListener,listener);
}

Fixed version (ground truth):
public ArduCopter(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,warningParser,logListener,listener);
}
Program: 94719
Project: 94719
Buggy source:
public ArduPlane(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,Preferences pref,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,pref,warningParser,logListener,listener);
}

Fixed version (ground truth):
public ArduPlane(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,warningParser,logListener,listener);
}
Program: 94720
Project: 94720
Buggy source:
public ArduRover(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,Preferences pref,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,pref,warningParser,logListener,listener);
}

Fixed version (ground truth):
public ArduRover(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(context,mavClient,handler,warningParser,logListener,listener);
}
Program: 94722
Project: 94722
Buggy source:
private void checkEkfPositionState(msg_ekf_status_report ekfStatus){
  if (ekfStatus == null)   return;
  final int flags=ekfStatus.flags;
  final boolean isOk=this.armed ? (flags & EKF_STATUS_FLAGS.EKF_POS_HORIZ_ABS) != 0 && (flags & EKF_STATUS_FLAGS.EKF_CONST_POS_MODE) == 0 : (flags & EKF_STATUS_FLAGS.EKF_POS_HORIZ_ABS) != 0 || (flags & EKF_STATUS_FLAGS.EKF_PRED_POS_HORIZ_ABS) != 0;
  if (isEkfPositionOk != isOk) {
    isEkfPositionOk=isOk;
    myDrone.notifyDroneEvent(DroneEventsType.EKF_POSITION_STATE_UPDATE);
    if (isEkfPositionOk) {
      myDrone.requestHomeUpdate();
    }
  }
}

Fixed version (ground truth):
private void checkEkfPositionState(msg_ekf_status_report ekfStatus){
  if (ekfStatus == null)   return;
  int flags=ekfStatus.flags;
  boolean isOk=this.armed ? (flags & EKF_STATUS_FLAGS.EKF_POS_HORIZ_ABS) != 0 && (flags & EKF_STATUS_FLAGS.EKF_CONST_POS_MODE) == 0 : (flags & EKF_STATUS_FLAGS.EKF_POS_HORIZ_ABS) != 0 || (flags & EKF_STATUS_FLAGS.EKF_PRED_POS_HORIZ_ABS) != 0;
  if (isEkfPositionOk != isOk) {
    isEkfPositionOk=isOk;
    myDrone.notifyDroneEvent(DroneEventsType.EKF_POSITION_STATE_UPDATE);
    if (isEkfPositionOk) {
      myDrone.executeAsyncAction(requestHomeUpdateAction,null);
    }
  }
}
Program: 94724
Project: 94724
Buggy source:
@Override public void executeAction(Action action,ICommandListener listener) throws RemoteException {
  if (action == null)   return;
  final String type=action.getType();
  if (type == null)   return;
  Bundle data=action.getData();
  if (data != null)   data.setClassLoader(context.getClassLoader());
switch (type) {
case ConnectionActions.ACTION_CONNECT:
    ConnectionParameter parameter=data.getParcelable(ConnectionActions.EXTRA_CONNECT_PARAMETER);
  connect(parameter);
break;
case ConnectionActions.ACTION_DISCONNECT:
disconnect();
break;
case CameraActions.ACTION_START_VIDEO_STREAM:
{
final Surface videoSurface=data.getParcelable(CameraActions.EXTRA_VIDEO_DISPLAY);
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
Bundle videoProps=data.getBundle(CameraActions.EXTRA_VIDEO_PROPERTIES);
if (videoProps == null) {
videoProps=new Bundle();
videoProps.putInt(CameraActions.EXTRA_VIDEO_PROPS_UDP_PORT,VideoManager.ARTOO_UDP_PORT);
}
CommonApiUtils.startVideoStream(getDrone(),videoProps,ownerId,videoTag,videoSurface,listener);
break;
}
case CameraActions.ACTION_STOP_VIDEO_STREAM:
{
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
CommonApiUtils.stopVideoStream(getDrone(),ownerId,videoTag,listener);
break;
}
case MissionActions.ACTION_BUILD_COMPLEX_MISSION_ITEM:
CommonApiUtils.buildComplexMissionItem(getDrone(),data);
break;
default :
droneMgr.executeAsyncAction(action,listener);
break;
}
}

Fixed version (ground truth):
@Override public void executeAction(Action action,ICommandListener listener) throws RemoteException {
  if (action == null)   return;
  final String type=action.getType();
  if (type == null)   return;
  Bundle data=action.getData();
  if (data != null)   data.setClassLoader(context.getClassLoader());
switch (type) {
case ConnectionActions.ACTION_CONNECT:
    ConnectionParameter parameter=data.getParcelable(ConnectionActions.EXTRA_CONNECT_PARAMETER);
  connect(parameter);
break;
case ConnectionActions.ACTION_DISCONNECT:
disconnect();
break;
case CameraActions.ACTION_START_VIDEO_STREAM:
{
final Surface videoSurface=data.getParcelable(CameraActions.EXTRA_VIDEO_DISPLAY);
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
Bundle videoProps=data.getBundle(CameraActions.EXTRA_VIDEO_PROPERTIES);
if (videoProps == null) {
videoProps=new Bundle();
videoProps.putInt(CameraActions.EXTRA_VIDEO_PROPS_UDP_PORT,VideoManager.ARTOO_UDP_PORT);
}
CommonApiUtils.startVideoStream(getDrone(),videoProps,ownerId,videoTag,videoSurface,listener);
break;
}
case CameraActions.ACTION_STOP_VIDEO_STREAM:
{
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
CommonApiUtils.stopVideoStream(getDrone(),ownerId,videoTag,listener);
break;
}
case MissionActions.ACTION_BUILD_COMPLEX_MISSION_ITEM:
CommonApiUtils.buildComplexMissionItem(getDrone(),data);
break;
default :
if (droneMgr != null) {
droneMgr.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
break;
}
}
Program: 94725
Project: 94725
Buggy source:
/** 
 * Attempt to grab ownership and start the video stream from the connected drone. Can fail if the video stream is already owned by another client.
 * @param udpPort  Udp port from which to expect the video stream
 * @param surface  Surface object onto which the video is decoded.
 * @param tag      Video tag.
 * @param listener Register a callback to receive update of the command execution status.
 * @since 2.6.8
 */
public void startVideoStream(final int udpPort,final Surface surface,final String tag,final AbstractCommandListener listener){
  if (surface == null) {
    postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
    return;
  }
  final Bundle params=new Bundle();
  params.putParcelable(EXTRA_VIDEO_DISPLAY,surface);
  params.putString(EXTRA_VIDEO_TAG,tag);
  params.putInt(EXTRA_VIDEO_UDP_PORT,udpPort);
  drone.performAsyncActionOnDroneThread(new Action(ACTION_START_VIDEO_STREAM,params),listener);
}

Fixed version (ground truth):
/** 
 * Attempt to grab ownership and start the video stream from the connected drone. Can fail if the video stream is already owned by another client.
 * @param surface  Surface object onto which the video is decoded.
 * @param tag      Video tag.
 * @param videoProps Non-null video properties. @see VIDEO_PROPS_UDP_PORT
 * @param listener Register a callback to receive update of the command execution status.
 * @since 2.6.8
 */
public void startVideoStream(@NonNull final Surface surface,final String tag,@NonNull Bundle videoProps,final AbstractCommandListener listener){
  if (surface == null || videoProps == null) {
    postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
    return;
  }
  final Bundle params=new Bundle();
  params.putParcelable(EXTRA_VIDEO_DISPLAY,surface);
  params.putString(EXTRA_VIDEO_TAG,tag);
  params.putBundle(EXTRA_VIDEO_PROPERTIES,videoProps);
  drone.performAsyncActionOnDroneThread(new Action(ACTION_START_VIDEO_STREAM,params),listener);
}
Program: 94726
Project: 94726
Buggy source:
@Override public void executeAction(Action action,ICommandListener listener) throws RemoteException {
  if (action == null)   return;
  final String type=action.getType();
  if (type == null)   return;
  Bundle data=action.getData();
  if (data != null)   data.setClassLoader(context.getClassLoader());
switch (type) {
case ConnectionActions.ACTION_CONNECT:
    ConnectionParameter parameter=data.getParcelable(ConnectionActions.EXTRA_CONNECT_PARAMETER);
  connect(parameter);
break;
case ConnectionActions.ACTION_DISCONNECT:
disconnect();
break;
case CameraActions.ACTION_START_VIDEO_STREAM:
{
final Surface videoSurface=data.getParcelable(CameraActions.EXTRA_VIDEO_DISPLAY);
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
final int videoUdpPort=data.getInt(CameraActions.EXTRA_VIDEO_UDP_PORT,CameraActions.DEFAULT_VIDEO_UDP_PORT);
CommonApiUtils.startVideoStream(droneMgr.getDrone(),videoUdpPort,ownerId,videoTag,videoSurface,listener);
break;
}
case CameraActions.ACTION_STOP_VIDEO_STREAM:
{
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
CommonApiUtils.stopVideoStream(droneMgr.getDrone(),ownerId,videoTag,listener);
break;
}
case MissionActions.ACTION_BUILD_COMPLEX_MISSION_ITEM:
final MavLinkDrone drone=droneMgr == null ? null : droneMgr.getDrone();
CommonApiUtils.buildComplexMissionItem(drone,data);
break;
default :
droneMgr.executeAsyncAction(action,listener);
break;
}
}

Fixed version (ground truth):
@Override public void executeAction(Action action,ICommandListener listener) throws RemoteException {
  if (action == null)   return;
  final String type=action.getType();
  if (type == null)   return;
  Bundle data=action.getData();
  if (data != null)   data.setClassLoader(context.getClassLoader());
switch (type) {
case ConnectionActions.ACTION_CONNECT:
    ConnectionParameter parameter=data.getParcelable(ConnectionActions.EXTRA_CONNECT_PARAMETER);
  connect(parameter);
break;
case ConnectionActions.ACTION_DISCONNECT:
disconnect();
break;
case CameraActions.ACTION_START_VIDEO_STREAM:
{
final Surface videoSurface=data.getParcelable(CameraActions.EXTRA_VIDEO_DISPLAY);
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
Bundle videoProps=data.getBundle(CameraActions.EXTRA_VIDEO_PROPERTIES);
if (videoProps == null) {
videoProps=new Bundle();
videoProps.putInt(CameraActions.EXTRA_VIDEO_PROPS_UDP_PORT,VideoManager.ARTOO_UDP_PORT);
}
CommonApiUtils.startVideoStream(getDrone(),videoProps,ownerId,videoTag,videoSurface,listener);
break;
}
case CameraActions.ACTION_STOP_VIDEO_STREAM:
{
final String videoTag=data.getString(CameraActions.EXTRA_VIDEO_TAG,"String_Node_Str");
CommonApiUtils.stopVideoStream(getDrone(),ownerId,videoTag,listener);
break;
}
case MissionActions.ACTION_BUILD_COMPLEX_MISSION_ITEM:
CommonApiUtils.buildComplexMissionItem(getDrone(),data);
break;
default :
droneMgr.executeAsyncAction(action,listener);
break;
}
}
Program: 94727
Project: 94727
Buggy source:
@Override public void startVideoStream(int udpPort,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  if (!soloComp.hasStreamingPermission()) {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
    return;
  }
  super.startVideoStream(udpPort,appId,newVideoTag,videoSurface,listener);
}

Fixed version (ground truth):
@Override public void startVideoStream(Bundle videoProps,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  if (!soloComp.hasStreamingPermission()) {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
    return;
  }
  super.startVideoStream(videoProps,appId,newVideoTag,videoSurface,listener);
}
Program: 94728
Project: 94728
Buggy source:
public void startVideoStream(int udpPort,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  videoMgr.startVideoStream(udpPort,appId,newVideoTag,videoSurface,listener);
}

Fixed version (ground truth):
public void startVideoStream(Bundle videoProps,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  videoMgr.startVideoStream(videoProps,appId,newVideoTag,videoSurface,listener);
}
Program: 94729
Project: 94729
Buggy source:
@Override public void onIpDisconnected(){
  if (isStarted.get()) {
    if (shouldReconnect()) {
      handler.postDelayed(reconnectTask,RECONNECT_COUNTDOWN);
    }
    if (linkListener != null && wasConnected.get())     linkListener.onLinkDisconnected();
    wasConnected.set(false);
  }
}

Fixed version (ground truth):
@Override public void onIpDisconnected(){
  if (isStarted.get()) {
    if (shouldReconnect()) {
      handler.postDelayed(reconnectTask,RECONNECT_COUNTDOWN);
    }
  }
  if (linkListener != null && wasConnected.compareAndSet(true,false))   linkListener.onLinkDisconnected();
}
Program: 94730
Project: 94730
Buggy source:
public static void startVideoStream(Drone drone,int udpPort,String appId,String videoTag,Surface videoSurface,ICommandListener listener){
  if (!(drone instanceof GenericMavLinkDrone)) {
    postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
    return;
  }
  final GenericMavLinkDrone mavLinkDrone=(GenericMavLinkDrone)drone;
  mavLinkDrone.startVideoStream(udpPort,appId,videoTag,videoSurface,listener);
}

Fixed version (ground truth):
public static void startVideoStream(Drone drone,Bundle videoProps,String appId,String videoTag,Surface videoSurface,ICommandListener listener){
  if (!(drone instanceof GenericMavLinkDrone)) {
    postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
    return;
  }
  final GenericMavLinkDrone mavLinkDrone=(GenericMavLinkDrone)drone;
  mavLinkDrone.startVideoStream(videoProps,appId,videoTag,videoSurface,listener);
}
Program: 94732
Project: 94732
Buggy source:
private void start(int udpPort,LinkListener listener){
  if (this.linkConn == null || udpPort != this.udpPort) {
    if (isStarted.get()) {
      stop();
    }
    this.linkConn=new UdpConnection(handler,udpPort,UDP_BUFFER_SIZE,true,42);
    this.linkConn.setIpConnectionListener(this);
    this.udpPort=udpPort;
  }
  Log.d(TAG,"String_Node_Str");
  handler.removeCallbacks(reconnectTask);
  isStarted.set(true);
  this.linkConn.connect();
  this.linkListener=listener;
}

Fixed version (ground truth):
private void start(int udpPort,LinkListener listener){
  if (this.linkConn == null || udpPort != this.linkPort) {
    if (isStarted.get()) {
      stop();
    }
    this.linkConn=new UdpConnection(handler,udpPort,UDP_BUFFER_SIZE,true,42);
    this.linkConn.setIpConnectionListener(this);
    this.linkPort=udpPort;
  }
  Log.d(TAG,"String_Node_Str");
  handler.removeCallbacks(reconnectTask);
  isStarted.set(true);
  this.linkConn.connect();
  this.linkListener=listener;
}
Program: 94733
Project: 94733
Buggy source:
private void stop(){
  Log.d(TAG,"String_Node_Str");
  handler.removeCallbacks(reconnectTask);
  isStarted.set(false);
  if (this.linkConn != null) {
    this.linkConn.disconnect();
    this.linkConn=null;
  }
  this.udpPort=-1;
}

Fixed version (ground truth):
private void stop(){
  Log.d(TAG,"String_Node_Str");
  handler.removeCallbacks(reconnectTask);
  isStarted.set(false);
  if (this.linkConn != null) {
    this.linkConn.disconnect();
    this.linkConn=null;
  }
  this.linkPort=-1;
}
Program: 94734
Project: 94734
Buggy source:
public void startVideoStream(int udpPort,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  Timber.d("String_Node_Str",appId,videoOwnerId.get());
  if (TextUtils.isEmpty(appId)) {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
    return;
  }
  if (videoSurface == null) {
    postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
    return;
  }
  if (newVideoTag == null)   newVideoTag="String_Node_Str";
  if (appId.equals(videoOwnerId.get())) {
    String currentVideoTag=videoTagRef.get();
    if (currentVideoTag == null)     currentVideoTag="String_Node_Str";
    if (newVideoTag.equals(currentVideoTag)) {
      postSuccessEvent(listener);
      return;
    }
  }
  if (videoOwnerId.compareAndSet(NO_VIDEO_OWNER,appId)) {
    videoTagRef.set(newVideoTag);
    Timber.i("String_Node_Str");
    startDecoding(udpPort,videoSurface,new DecoderListener(){
      @Override public void onDecodingStarted(){
        Timber.i("String_Node_Str");
        postSuccessEvent(listener);
      }
      @Override public void onDecodingError(){
        Timber.i("String_Node_Str");
        postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
        reset();
      }
      @Override public void onDecodingEnded(){
        Timber.i("String_Node_Str");
        reset();
      }
    }
);
  }
 else {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
  }
}

Fixed version (ground truth):
public void startVideoStream(Bundle videoProps,String appId,String newVideoTag,Surface videoSurface,final ICommandListener listener){
  Timber.d("String_Node_Str",appId,videoOwnerId.get());
  if (TextUtils.isEmpty(appId)) {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
    return;
  }
  final int udpPort=videoProps.getInt(CameraActions.EXTRA_VIDEO_PROPS_UDP_PORT,-1);
  if (videoSurface == null || udpPort == -1) {
    postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
    return;
  }
  if (newVideoTag == null)   newVideoTag="String_Node_Str";
  if (appId.equals(videoOwnerId.get())) {
    String currentVideoTag=videoTagRef.get();
    if (currentVideoTag == null)     currentVideoTag="String_Node_Str";
    if (newVideoTag.equals(currentVideoTag)) {
      postSuccessEvent(listener);
      return;
    }
  }
  if (videoOwnerId.compareAndSet(NO_VIDEO_OWNER,appId)) {
    videoTagRef.set(newVideoTag);
    Timber.i("String_Node_Str");
    startDecoding(udpPort,videoSurface,new DecoderListener(){
      @Override public void onDecodingStarted(){
        Timber.i("String_Node_Str");
        postSuccessEvent(listener);
      }
      @Override public void onDecodingError(){
        Timber.i("String_Node_Str");
        postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
        reset();
      }
      @Override public void onDecodingEnded(){
        Timber.i("String_Node_Str");
        reset();
      }
    }
);
  }
 else {
    postErrorEvent(CommandExecutionError.COMMAND_DENIED,listener);
  }
}
Program: 94737
Project: 94737
Buggy source:
public static void resetROI(MavLinkDrone drone,ICommandListener listener){
  if (drone == null)   return;
  setROI(drone,new Coord3D(0,0,0),listener);
}

Fixed version (ground truth):
public static void resetROI(MavLinkDrone drone,ICommandListener listener){
  if (drone == null)   return;
  setROI(drone,new LatLongAlt(0,0,0),listener);
}
Program: 94738
Project: 94738
Buggy source:
public static void setROI(MavLinkDrone drone,Coord3D coord,ICommandListener listener){
  if (drone == null)   return;
  msg_command_long msg=new msg_command_long();
  msg.target_system=drone.getSysid();
  msg.target_component=drone.getCompid();
  msg.command=MAV_CMD.MAV_CMD_DO_SET_ROI;
  msg.param5=(float)coord.getX();
  msg.param6=(float)coord.getY();
  msg.param7=(float)coord.getAltitude();
  drone.getMavClient().sendMavMessage(msg,listener);
}

Fixed version (ground truth):
public static void setROI(MavLinkDrone drone,LatLongAlt coord,ICommandListener listener){
  if (drone == null)   return;
  msg_command_long msg=new msg_command_long();
  msg.target_system=drone.getSysid();
  msg.target_component=drone.getCompid();
  msg.command=MAV_CMD.MAV_CMD_DO_SET_ROI;
  msg.param5=(float)coord.getLatitude();
  msg.param6=(float)coord.getLongitude();
  msg.param7=(float)coord.getAltitude();
  drone.getMavClient().sendMavMessage(msg,listener);
}
Program: 94741
Project: 94741
Buggy source:
@Override public DroneAttribute getAttribute(String attributeType){
  if (!TextUtils.isEmpty(attributeType)) {
switch (attributeType) {
case AttributeType.GPS:
      return CommonApiUtils.getGps(this);
case AttributeType.PARAMETERS:
    return CommonApiUtils.getParameters(this,context,cachedParameters);
case AttributeType.HOME:
  return CommonApiUtils.getHome(this);
case AttributeType.MISSION:
return CommonApiUtils.getMission(this);
case AttributeType.TYPE:
return CommonApiUtils.getType(this);
case AttributeType.GUIDED_STATE:
return CommonApiUtils.getGuidedState(this);
case AttributeType.MAGNETOMETER_CALIBRATION_STATUS:
return CommonApiUtils.getMagnetometerCalibrationStatus(this);
}
}
return super.getAttribute(attributeType);
}

Fixed version (ground truth):
@Override public DroneAttribute getAttribute(String attributeType){
  if (!TextUtils.isEmpty(attributeType)) {
switch (attributeType) {
case AttributeType.PARAMETERS:
      return CommonApiUtils.getParameters(this,context,cachedParameters);
case AttributeType.HOME:
    return CommonApiUtils.getHome(this);
case AttributeType.MISSION:
  return CommonApiUtils.getMission(this);
case AttributeType.TYPE:
return CommonApiUtils.getType(this);
case AttributeType.GUIDED_STATE:
return CommonApiUtils.getGuidedState(this);
case AttributeType.MAGNETOMETER_CALIBRATION_STATUS:
return CommonApiUtils.getMagnetometerCalibrationStatus(this);
}
}
return super.getAttribute(attributeType);
}
Program: 94742
Project: 94742
Buggy source:
protected void processBatteryUpdate(double voltage,double remain,double current){
  if (battery.getBatteryVoltage() != voltage || battery.getBatteryRemain() != remain || battery.getBatteryCurrent() != current) {
    battery.setBatteryVoltage(voltage);
    battery.setBatteryRemain(remain);
    battery.setBatteryCurrent(current);
    battery.setBatteryDischarge(getBattDischarge(remain));
    notifyDroneEvent(DroneInterfaces.DroneEventsType.BATTERY);
  }
}

Fixed version (ground truth):
@Override protected void processBatteryUpdate(double voltage,double remain,double current){
  if (battery.getBatteryRemain() != remain) {
    battery.setBatteryDischarge(getBattDischarge(remain));
  }
  super.processBatteryUpdate(voltage,remain,current);
}
Program: 94743
Project: 94743
Buggy source:
public ArduPilot(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,Preferences pref,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(handler,mavClient,warningParser,listener);
  this.context=context;
  this.preferences=pref;
  this.logListener=logListener;
  heartbeat=new HeartBeat(this,handler);
  parameters=new Parameters(this,handler);
  this.waypointManager=new WaypointManager(this,handler);
  rc=new RC(this);
  GPS=new GPS(this);
  this.home=new Home(this);
  this.mission=new Mission(this);
  this.missionStats=new MissionStats(this);
  this.guidedPoint=new GuidedPoint(this,handler);
  this.accelCalibrationSetup=new AccelCalibration(this,handler);
  this.magCalibration=new MagnetometerCalibrationImpl(this);
  this.mag=new Magnetometer(this);
  this.footprints=new Camera(this);
  loadVehicleProfile();
}

Fixed version (ground truth):
public ArduPilot(Context context,MAVLinkStreams.MAVLinkOutputStream mavClient,Handler handler,Preferences pref,AutopilotWarningParser warningParser,LogMessageListener logListener,DroneInterfaces.AttributeEventListener listener){
  super(handler,mavClient,warningParser,listener);
  this.context=context;
  this.preferences=pref;
  this.logListener=logListener;
  heartbeat=new HeartBeat(this,handler);
  parameters=new Parameters(this,handler);
  this.waypointManager=new WaypointManager(this,handler);
  rc=new RC(this);
  this.home=new Home(this);
  this.mission=new Mission(this);
  this.missionStats=new MissionStats(this);
  this.guidedPoint=new GuidedPoint(this,handler);
  this.accelCalibrationSetup=new AccelCalibration(this,handler);
  this.magCalibration=new MagnetometerCalibrationImpl(this);
  this.mag=new Magnetometer(this);
  this.footprints=new Camera(this);
  loadVehicleProfile();
}
Program: 94745
Project: 94745
Buggy source:
public void stop(){
  if (!BuildConfig.SITL_DEBUG) {
    controllerLinkManager.stop();
  }
  soloLinkMgr.stop();
}

Fixed version (ground truth):
public void stop(){
  soloLinkMgr.stop();
  if (!BuildConfig.SITL_DEBUG) {
    controllerLinkManager.stop();
  }
}
Program: 94746
Project: 94746
Buggy source:
@Override public void onLinkDisconnected(){
  if (compListener != null)   compListener.onDisconnected();
  if (!BuildConfig.SITL_DEBUG) {
    controllerLinkManager.stop();
  }
  soloLinkMgr.stop();
}

Fixed version (ground truth):
@Override public void onLinkDisconnected(){
  if (compListener != null)   compListener.onDisconnected();
  soloLinkMgr.stop();
  if (!BuildConfig.SITL_DEBUG) {
    controllerLinkManager.stop();
  }
}
Program: 94747
Project: 94747
Buggy source:
public void stop(){
  Timber.d("String_Node_Str");
  stopVideoManager();
  super.stop();
}

Fixed version (ground truth):
public void stop(){
  Timber.d("String_Node_Str");
  super.stop();
}
Program: 94748
Project: 94748
Buggy source:
/** 
 * Disables control of the gimbal. After calling this method, no call to   {@link GimbalApi#updateGimbalOrientation(float,float,float,GimbalOrientationListener)}will be allowed.
 * @param listener non-null GimbalStatusListener callback.
 */
public void stopGimbalControl(final GimbalOrientationListener listener){
  if (listener == null)   throw new NullPointerException("String_Node_Str");
  if (!gimbalListeners.contains(listener)) {
    drone.post(new Runnable(){
      @Override public void run(){
        listener.onGimbalOrientationCommandError(CommandExecutionError.COMMAND_DENIED);
      }
    }
);
    return;
  }
  drone.performAsyncActionOnDroneThread(new Action(ACTION_RESET_GIMBAL_MOUNT_MODE,null),new SimpleCommandListener(){
    @Override public void onTimeout(){
      listener.onGimbalOrientationCommandError(CommandExecutionError.COMMAND_FAILED);
    }
    @Override public void onError(    int error){
      listener.onGimbalOrientationCommandError(error);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Disables control of the gimbal. After calling this method, no call to   {@link GimbalApi#updateGimbalOrientation(float,float,float,GimbalOrientationListener)}will be allowed.
 * @since 2.5.0
 * @param listener non-null GimbalStatusListener callback.
 */
public void stopGimbalControl(final GimbalOrientationListener listener){
  if (listener == null)   throw new NullPointerException("String_Node_Str");
  if (!gimbalListeners.contains(listener)) {
    drone.post(new Runnable(){
      @Override public void run(){
        listener.onGimbalOrientationCommandError(CommandExecutionError.COMMAND_DENIED);
      }
    }
);
    return;
  }
  gimbalListeners.remove(listener);
  Bundle params=new Bundle(1);
  params.putInt(GIMBAL_MOUNT_MODE,MAV_MOUNT_MODE.MAV_MOUNT_MODE_RC_TARGETING);
  drone.performAsyncActionOnDroneThread(new Action(ACTION_SET_GIMBAL_MOUNT_MODE,params),new SimpleCommandListener(){
    @Override public void onTimeout(){
      listener.onGimbalOrientationCommandError(CommandExecutionError.COMMAND_FAILED);
    }
    @Override public void onError(    int error){
      listener.onGimbalOrientationCommandError(error);
    }
  }
);
}
Program: 94750
Project: 94750
Buggy source:
public void disconnect(String appId) throws ConnectionException {
  if (TextUtils.isEmpty(appId))   return;
  if (drone instanceof GenericMavLinkDrone) {
    ((GenericMavLinkDrone)drone).tryStoppingVideoStream(appId);
  }
  Log.d(TAG,"String_Node_Str" + appId);
  DroneEventsListener listener=connectedApps.remove(appId);
  if (listener != null) {
    mavClient.removeLoggingFile(appId);
    listener.onDroneEvent(DroneInterfaces.DroneEventsType.DISCONNECTED,drone);
    notifyDisconnected(appId,listener);
  }
  if (mavClient.isConnected() && connectedApps.isEmpty()) {
    executeAsyncAction(new Action(GimbalActions.ACTION_RESET_GIMBAL_MOUNT_MODE),new AbstractCommandListener(){
      @Override public void onSuccess(){
        mavClient.closeConnection();
      }
      @Override public void onError(      int executionError){
        mavClient.closeConnection();
      }
      @Override public void onTimeout(){
        mavClient.closeConnection();
      }
    }
);
  }
}

Fixed version (ground truth):
public void disconnect(String appId) throws ConnectionException {
  if (TextUtils.isEmpty(appId))   return;
  if (drone instanceof GenericMavLinkDrone) {
    ((GenericMavLinkDrone)drone).tryStoppingVideoStream(appId);
  }
  Log.d(TAG,"String_Node_Str" + appId);
  DroneEventsListener listener=connectedApps.remove(appId);
  if (listener != null) {
    mavClient.removeLoggingFile(appId);
    listener.onDroneEvent(DroneInterfaces.DroneEventsType.DISCONNECTED,drone);
    notifyDisconnected(appId,listener);
  }
  if (mavClient.isConnected() && connectedApps.isEmpty()) {
    executeAsyncAction(new Action(GimbalActions.ACTION_RESET_GIMBAL_MOUNT_MODE),null);
    mavClient.closeConnection();
  }
}
Program: 94751
Project: 94751
Buggy source:
public static State getState(MavLinkDrone drone,boolean isConnected,Vibration vibration){
  if (drone == null)   return new State();
  org.droidplanner.services.android.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  AccelCalibration accelCalibration=drone.getCalibrationSetup();
  String calibrationMessage=accelCalibration.isCalibrating() ? accelCalibration.getMessage() : null;
  final msg_ekf_status_report ekfStatus=droneState.getEkfStatus();
  final EkfStatus proxyEkfStatus=ekfStatus == null ? new EkfStatus() : new EkfStatus(ekfStatus.flags,ekfStatus.compass_variance,ekfStatus.pos_horiz_variance,ekfStatus.terrain_alt_variance,ekfStatus.velocity_variance,ekfStatus.pos_vert_variance);
  return new State(isConnected,CommonApiUtils.getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getErrorId(),drone.getMavlinkVersion(),calibrationMessage,droneState.getFlightStartTime(),proxyEkfStatus,isConnected && drone.isConnectionAlive(),vibration);
}

Fixed version (ground truth):
public static State getState(MavLinkDrone drone,boolean isConnected,Vibration vibration){
  if (drone == null)   return new State();
  org.droidplanner.services.android.core.drone.variables.State droneState=drone.getState();
  ApmModes droneMode=droneState.getMode();
  AccelCalibration accelCalibration=drone.getCalibrationSetup();
  String calibrationMessage=accelCalibration != null && accelCalibration.isCalibrating() ? accelCalibration.getMessage() : null;
  final msg_ekf_status_report ekfStatus=droneState.getEkfStatus();
  final EkfStatus proxyEkfStatus=ekfStatus == null ? new EkfStatus() : new EkfStatus(ekfStatus.flags,ekfStatus.compass_variance,ekfStatus.pos_horiz_variance,ekfStatus.terrain_alt_variance,ekfStatus.velocity_variance,ekfStatus.pos_vert_variance);
  return new State(isConnected,CommonApiUtils.getVehicleMode(droneMode),droneState.isArmed(),droneState.isFlying(),droneState.getErrorId(),drone.getMavlinkVersion(),calibrationMessage,droneState.getFlightStartTime(),proxyEkfStatus,isConnected && drone.isConnectionAlive(),vibration);
}
Program: 94752
Project: 94752
Buggy source:
private void unregisterUsbPermissionBroadcastReceiver(){
  mContext.unregisterReceiver(broadcastReceiver);
}

Fixed version (ground truth):
private void unregisterUsbPermissionBroadcastReceiver(){
  try {
    mContext.unregisterReceiver(broadcastReceiver);
  }
 catch (  IllegalArgumentException e) {
    Timber.e(e,"String_Node_Str");
  }
}
Program: 94753
Project: 94753
Buggy source:
@Override public void notifyReceivedData(MAVLinkPacket packet){
  MAVLinkMessage receivedMsg=packet.unpack();
  if (receivedMsg.msgid == msg_command_ack.MAVLINK_MSG_ID_COMMAND_ACK) {
    final msg_command_ack commandAck=(msg_command_ack)receivedMsg;
    handleCommandAck(commandAck);
  }
 else {
    this.mavLinkMsgHandler.receiveData(receivedMsg);
    if (this.drone != null) {
      this.drone.onMavLinkMessageReceived(receivedMsg);
    }
  }
  if (!connectedApps.isEmpty()) {
    for (    DroneEventsListener droneEventsListener : connectedApps.values()) {
      droneEventsListener.onReceivedMavLinkMessage(receivedMsg);
    }
  }
  if (!tlogUploaders.isEmpty()) {
    final byte[] packetData=packet.encodePacket();
    for (    DroneshareClient uploader : tlogUploaders.values()) {
      try {
        uploader.filterMavlink(uploader.interfaceNum,packetData);
      }
 catch (      Exception e) {
        Log.e(TAG,e.getMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void notifyReceivedData(MAVLinkPacket packet){
  MAVLinkMessage receivedMsg=packet.unpack();
  if (receivedMsg == null)   return;
  if (receivedMsg.msgid == msg_command_ack.MAVLINK_MSG_ID_COMMAND_ACK) {
    final msg_command_ack commandAck=(msg_command_ack)receivedMsg;
    handleCommandAck(commandAck);
  }
 else {
    this.mavLinkMsgHandler.receiveData(receivedMsg);
    if (this.drone != null) {
      this.drone.onMavLinkMessageReceived(receivedMsg);
    }
  }
  if (!connectedApps.isEmpty()) {
    for (    DroneEventsListener droneEventsListener : connectedApps.values()) {
      droneEventsListener.onReceivedMavLinkMessage(receivedMsg);
    }
  }
  if (!tlogUploaders.isEmpty()) {
    final byte[] packetData=packet.encodePacket();
    for (    DroneshareClient uploader : tlogUploaders.values()) {
      try {
        uploader.filterMavlink(uploader.interfaceNum,packetData);
      }
 catch (      Exception e) {
        Log.e(TAG,e.getMessage(),e);
      }
    }
  }
}
Program: 94754
Project: 94754
Buggy source:
/** 
 * Set the state of the heartbeat.
 * @param active true to activate the heartbeat, false to deactivate it
 */
public void setActive(boolean active){
  if (active) {
    if (heartbeatExecutor == null || heartbeatExecutor.isShutdown()) {
      heartbeatExecutor=Executors.newSingleThreadScheduledExecutor();
      heartbeatExecutor.scheduleWithFixedDelay(heartbeatRunnable,0,period,TimeUnit.SECONDS);
    }
  }
 else   if (heartbeatExecutor != null && !heartbeatExecutor.isShutdown()) {
    heartbeatExecutor.shutdownNow();
    heartbeatExecutor=null;
  }
}

Fixed version (ground truth):
/** 
 * Set the state of the heartbeat.
 * @param active true to activate the heartbeat, false to deactivate it
 */
public synchronized void setActive(boolean active){
  if (active) {
    if (heartbeatExecutor == null || heartbeatExecutor.isShutdown()) {
      heartbeatExecutor=Executors.newSingleThreadScheduledExecutor();
      heartbeatExecutor.scheduleWithFixedDelay(heartbeatRunnable,0,period,TimeUnit.SECONDS);
    }
  }
 else   if (heartbeatExecutor != null && !heartbeatExecutor.isShutdown()) {
    heartbeatExecutor.shutdownNow();
    heartbeatExecutor=null;
  }
}
Program: 94755
Project: 94755
Buggy source:
public DownloadImageTask(Context context,String appId,ImageView bmImage,Map<String,Bitmap> cachedMap){
  this.bmImage=bmImage;
  this.appId=appId;
  this.cachedMap=cachedMap;
  final File rootDir=new File(context.getExternalFilesDir(null),ROOT_DIR);
  if (!rootDir.exists() && !rootDir.mkdirs()) {
    throw new IllegalStateException("String_Node_Str");
  }
  this.appIconFile=new File(rootDir,appId);
}

Fixed version (ground truth):
public DownloadImageTask(Context context,String appId,ImageView bmImage,Map<String,Bitmap> cachedMap){
  this.bmImage=bmImage;
  this.appId=appId;
  this.cachedMap=cachedMap;
  final File rootDir=new File(context.getExternalFilesDir(null),ROOT_DIR);
  if (!rootDir.exists() && !rootDir.mkdirs()) {
    Timber.w("String_Node_Str");
  }
  this.appIconFile=new File(rootDir,appId);
}
Program: 94756
Project: 94756
Buggy source:
@Override public void open() throws IOException {
  Log.d(TAG,"String_Node_Str" + mDevice.getInterfaceCount());
  Log.d(TAG,"String_Node_Str");
  mControlInterface=mDevice.getInterface(0);
  Log.d(TAG,"String_Node_Str" + mControlInterface);
  if (!mConnection.claimInterface(mControlInterface,true)) {
    throw new IOException("String_Node_Str");
  }
  mControlEndpoint=mControlInterface.getEndpoint(0);
  Log.d(TAG,"String_Node_Str" + mControlEndpoint.getDirection());
  Log.d(TAG,"String_Node_Str");
  mDataInterface=mDevice.getInterface(1);
  Log.d(TAG,"String_Node_Str" + mDataInterface);
  if (!mConnection.claimInterface(mDataInterface,true)) {
    throw new IOException("String_Node_Str");
  }
  mReadEndpoint=mDataInterface.getEndpoint(1);
  Log.d(TAG,"String_Node_Str" + mReadEndpoint.getDirection());
  mWriteEndpoint=mDataInterface.getEndpoint(0);
  Log.d(TAG,"String_Node_Str" + mWriteEndpoint.getDirection());
}

Fixed version (ground truth):
@Override public void open() throws IOException {
  final int interfaceCount=mDevice.getInterfaceCount();
  Log.d(TAG,"String_Node_Str" + interfaceCount);
  if (interfaceCount == 0) {
    throw new IOException("String_Node_Str");
  }
  Log.d(TAG,"String_Node_Str");
  mControlInterface=mDevice.getInterface(0);
  Log.d(TAG,"String_Node_Str" + mControlInterface);
  if (!mConnection.claimInterface(mControlInterface,true)) {
    throw new IOException("String_Node_Str");
  }
  final int controlEndpointCount=mControlInterface.getEndpointCount();
  if (controlEndpointCount == 0) {
    throw new IOException("String_Node_Str");
  }
  mControlEndpoint=mControlInterface.getEndpoint(0);
  Log.d(TAG,"String_Node_Str" + mControlEndpoint.getDirection());
  Log.d(TAG,"String_Node_Str");
  mDataInterface=mDevice.getInterface(1);
  Log.d(TAG,"String_Node_Str" + mDataInterface);
  if (!mConnection.claimInterface(mDataInterface,true)) {
    throw new IOException("String_Node_Str");
  }
  final int dataEndpointCount=mDataInterface.getEndpointCount();
  if (dataEndpointCount < 2) {
    throw new IOException("String_Node_Str");
  }
  mReadEndpoint=mDataInterface.getEndpoint(1);
  Log.d(TAG,"String_Node_Str" + mReadEndpoint.getDirection());
  mWriteEndpoint=mDataInterface.getEndpoint(0);
  Log.d(TAG,"String_Node_Str" + mWriteEndpoint.getDirection());
}
Program: 94757
Project: 94757
Buggy source:
@Override public void run(){
  Timber.d("String_Node_Str",compliant ? "String_Node_Str" : "String_Node_Str");
  try {
    final boolean currentCompliance=!sshLink.execute("String_Node_Str").trim().equals("String_Node_Str");
    if (currentCompliance != compliant) {
      final String response;
      if (compliant) {
        response=sshLink.execute("String_Node_Str");
      }
 else {
        response=sshLink.execute("String_Node_Str");
      }
      if (response.trim().equals("String_Node_Str")) {
        restartHostapdService();
        Timber.d("String_Node_Str");
        isEUTxPowerCompliant.set(compliant);
        postSuccessEvent(listener);
      }
 else {
        Timber.d("String_Node_Str",response);
        postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
      }
    }
  }
 catch (  IOException e) {
    Timber.e(e,"String_Node_Str");
    postTimeoutEvent(listener);
  }
}

Fixed version (ground truth):
@Override public void run(){
  Timber.d("String_Node_Str",compliant ? "String_Node_Str" : "String_Node_Str");
  try {
    final boolean currentCompliance=!sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str").trim().equals("String_Node_Str");
    if (currentCompliance != compliant) {
      final String response;
      if (compliant) {
        response=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str");
      }
 else {
        response=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str");
      }
      if (response.trim().equals("String_Node_Str")) {
        restartController();
        Timber.d("String_Node_Str");
        isEUTxPowerCompliant.set(compliant);
        postSuccessEvent(listener);
      }
 else {
        Timber.d("String_Node_Str",response);
        postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
      }
    }
  }
 catch (  IOException e) {
    Timber.e(e,"String_Node_Str");
    postTimeoutEvent(listener);
  }
}
Program: 94758
Project: 94758
Buggy source:
public boolean updateSololinkWifi(CharSequence wifiSsid,CharSequence password){
  Timber.d(String.format(Locale.US,"String_Node_Str",wifiSsid,password));
  try {
    String ssidUpdateResult=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str" + wifiSsid);
    String passwordUpdateResult=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str" + password);
    restartHostapdService();
    return true;
  }
 catch (  IOException e) {
    Timber.e(e,"String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
public boolean updateSololinkWifi(CharSequence wifiSsid,CharSequence password){
  Timber.d(String.format(Locale.US,"String_Node_Str",wifiSsid,password));
  try {
    String ssidUpdateResult=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str" + wifiSsid);
    String passwordUpdateResult=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str" + password);
    restartController();
    return true;
  }
 catch (  IOException e) {
    Timber.e(e,"String_Node_Str");
    return false;
  }
}
Program: 94759
Project: 94759
Buggy source:
public void updateControllerMode(@SoloControllerMode.ControllerMode final int mode,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      Timber.d("String_Node_Str",mode);
      try {
        final boolean supportControllerMode=doesSupportControllerMode();
        final String command=supportControllerMode ? "String_Node_Str" : "String_Node_Str";
        final String response;
switch (mode) {
case SoloControllerMode.MODE_1:
          response=sshLink.execute(String.format(Locale.US,command,mode));
        postSuccessEvent(listener);
      break;
case SoloControllerMode.MODE_2:
    response=sshLink.execute(String.format(Locale.US,command,mode));
  postSuccessEvent(listener);
break;
default :
response="String_Node_Str";
postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
break;
}
Timber.d("String_Node_Str",response);
if (supportControllerMode) {
setControllerMode(mode);
}
}
 catch (IOException e) {
Timber.e(e,"String_Node_Str");
postTimeoutEvent(listener);
}
}
}
);
}

Fixed version (ground truth):
public void updateControllerMode(@SoloControllerMode.ControllerMode final int mode,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      Timber.d("String_Node_Str",mode);
      try {
        final boolean supportControllerMode=doesSupportControllerMode();
        final String command=supportControllerMode ? SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str" : "String_Node_Str";
        final String response;
switch (mode) {
case SoloControllerMode.MODE_1:
          response=sshLink.execute(String.format(Locale.US,command,mode));
        postSuccessEvent(listener);
      break;
case SoloControllerMode.MODE_2:
    response=sshLink.execute(String.format(Locale.US,command,mode));
  postSuccessEvent(listener);
break;
default :
response="String_Node_Str";
postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
break;
}
Timber.d("String_Node_Str",response);
if (supportControllerMode) {
setControllerMode(mode);
}
}
 catch (IOException e) {
Timber.e(e,"String_Node_Str");
postTimeoutEvent(listener);
}
}
}
);
}
Program: 94760
Project: 94760
Buggy source:
public void setEUTxPowerCompliance(final boolean compliant,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      Timber.d("String_Node_Str",compliant ? "String_Node_Str" : "String_Node_Str");
      try {
        final boolean currentCompliance=!sshLink.execute("String_Node_Str").trim().equals("String_Node_Str");
        if (currentCompliance != compliant) {
          final String response;
          if (compliant) {
            response=sshLink.execute("String_Node_Str");
          }
 else {
            response=sshLink.execute("String_Node_Str");
          }
          if (response.trim().equals("String_Node_Str")) {
            restartHostapdService();
            Timber.d("String_Node_Str");
            isEUTxPowerCompliant.set(compliant);
            postSuccessEvent(listener);
          }
 else {
            Timber.d("String_Node_Str",response);
            postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
          }
        }
      }
 catch (      IOException e) {
        Timber.e(e,"String_Node_Str");
        postTimeoutEvent(listener);
      }
    }
  }
);
}

Fixed version (ground truth):
public void setEUTxPowerCompliance(final boolean compliant,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      Timber.d("String_Node_Str",compliant ? "String_Node_Str" : "String_Node_Str");
      try {
        final boolean currentCompliance=!sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str").trim().equals("String_Node_Str");
        if (currentCompliance != compliant) {
          final String response;
          if (compliant) {
            response=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str");
          }
 else {
            response=sshLink.execute(SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str");
          }
          if (response.trim().equals("String_Node_Str")) {
            restartController();
            Timber.d("String_Node_Str");
            isEUTxPowerCompliant.set(compliant);
            postSuccessEvent(listener);
          }
 else {
            Timber.d("String_Node_Str",response);
            postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
          }
        }
      }
 catch (      IOException e) {
        Timber.e(e,"String_Node_Str");
        postTimeoutEvent(listener);
      }
    }
  }
);
}
Program: 94761
Project: 94761
Buggy source:
public void updateControllerUnit(@SoloControllerUnits.ControllerUnit final String unit,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      final boolean supportControllerMode=doesSupportControllerMode();
      if (!supportControllerMode) {
        postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
        return;
      }
      Timber.d("String_Node_Str",unit);
      try {
        final String command="String_Node_Str";
        final String response=sshLink.execute(String.format(Locale.US,command,unit));
        Timber.d("String_Node_Str",response);
        postSuccessEvent(listener);
        setControllerUnit(unit);
      }
 catch (      IOException e) {
        Timber.e(e,"String_Node_Str");
        postTimeoutEvent(listener);
      }
    }
  }
);
}

Fixed version (ground truth):
public void updateControllerUnit(@SoloControllerUnits.ControllerUnit final String unit,final ICommandListener listener){
  postAsyncTask(new Runnable(){
    @Override public void run(){
      final boolean supportControllerMode=doesSupportControllerMode();
      if (!supportControllerMode) {
        postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
        return;
      }
      Timber.d("String_Node_Str",unit);
      try {
        final String command=SOLOLINK_SSID_CONFIG_PATH + "String_Node_Str";
        final String response=sshLink.execute(String.format(Locale.US,command,unit));
        Timber.d("String_Node_Str",response);
        postSuccessEvent(listener);
        setControllerUnit(unit);
      }
 catch (      IOException e) {
        Timber.e(e,"String_Node_Str");
        postTimeoutEvent(listener);
      }
    }
  }
);
}