Program: 94739
Project: 94739
Buggy source:
@Override public boolean executeAsyncAction(Action action,final ICommandListener listener){
  final String type=action.getType();
  Bundle data=action.getData();
switch (type) {
case MissionActions.ACTION_GENERATE_DRONIE:
    final float bearing=CommonApiUtils.generateDronie(drone);
  if (bearing != -1) {
    Bundle bundle=new Bundle(1);
    bundle.putFloat(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING,bearing);
    notifyDroneAttributeEvent(AttributeEvent.MISSION_DRONIE_CREATED,bundle);
  }
return true;
case FollowMeActions.ACTION_ENABLE_FOLLOW_ME:
data.setClassLoader(FollowType.class.getClassLoader());
FollowType followType=data.getParcelable(FollowMeActions.EXTRA_FOLLOW_TYPE);
CommonApiUtils.enableFollowMe(this,handler,followType,listener);
return true;
case FollowMeActions.ACTION_UPDATE_FOLLOW_PARAMS:
if (followMe != null) {
data.setClassLoader(LatLong.class.getClassLoader());
final FollowAlgorithm followAlgorithm=followMe.getFollowAlgorithm();
if (followAlgorithm != null) {
Map<String,Object> paramsMap=new HashMap<>();
Set<String> dataKeys=data.keySet();
for (String key : dataKeys) {
if (FollowType.EXTRA_FOLLOW_ROI_TARGET.equals(key)) {
LatLong target=data.getParcelable(key);
if (target != null) {
final Coord2D roiTarget;
if (target instanceof LatLongAlt) {
  roiTarget=new Coord3D(target.getLatitude(),target.getLongitude(),((LatLongAlt)target).getAltitude());
}
 else {
  roiTarget=new Coord2D(target.getLatitude(),target.getLongitude());
}
paramsMap.put(key,roiTarget);
}
}
 else paramsMap.put(key,data.get(key));
}
followAlgorithm.updateAlgorithmParams(paramsMap);
}
}
return true;
case FollowMeActions.ACTION_DISABLE_FOLLOW_ME:
CommonApiUtils.disableFollowMe(followMe);
return true;
case StateActions.ACTION_ENABLE_RETURN_TO_ME:
final boolean isEnabled=data.getBoolean(StateActions.EXTRA_IS_RETURN_TO_ME_ENABLED,false);
if (returnToMe != null) {
if (isEnabled) {
returnToMe.enable(listener);
}
 else {
returnToMe.disable();
}
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
case CapabilityActions.ACTION_CHECK_FEATURE_SUPPORT:
if (listener != null) {
final String featureId=data.getString(CapabilityActions.EXTRA_FEATURE_ID);
if (!TextUtils.isEmpty(featureId)) {
switch (featureId) {
case CapabilityApi.FeatureIds.SOLO_VIDEO_STREAMING:
case CapabilityApi.FeatureIds.COMPASS_CALIBRATION:
if (this.isCompanionComputerEnabled()) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
case CapabilityApi.FeatureIds.KILL_SWITCH:
if (CommonApiUtils.isKillSwitchSupported(drone)) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
default :
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
break;
}
}
}
return true;
default :
if (drone != null) {
return drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
return true;
}
}
}

Fixed version (ground truth):
@Override public boolean executeAsyncAction(Action action,final ICommandListener listener){
  final String type=action.getType();
  Bundle data=action.getData();
switch (type) {
case MissionActions.ACTION_GENERATE_DRONIE:
    final float bearing=CommonApiUtils.generateDronie(drone);
  if (bearing != -1) {
    Bundle bundle=new Bundle(1);
    bundle.putFloat(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING,bearing);
    notifyDroneAttributeEvent(AttributeEvent.MISSION_DRONIE_CREATED,bundle);
  }
return true;
case FollowMeActions.ACTION_ENABLE_FOLLOW_ME:
data.setClassLoader(FollowType.class.getClassLoader());
FollowType followType=data.getParcelable(FollowMeActions.EXTRA_FOLLOW_TYPE);
CommonApiUtils.enableFollowMe(this,handler,followType,listener);
return true;
case FollowMeActions.ACTION_UPDATE_FOLLOW_PARAMS:
if (followMe != null) {
data.setClassLoader(LatLong.class.getClassLoader());
final FollowAlgorithm followAlgorithm=followMe.getFollowAlgorithm();
if (followAlgorithm != null) {
Map<String,Object> paramsMap=new HashMap<>();
Set<String> dataKeys=data.keySet();
for (String key : dataKeys) {
paramsMap.put(key,data.get(key));
}
followAlgorithm.updateAlgorithmParams(paramsMap);
}
}
return true;
case FollowMeActions.ACTION_DISABLE_FOLLOW_ME:
CommonApiUtils.disableFollowMe(followMe);
return true;
case StateActions.ACTION_ENABLE_RETURN_TO_ME:
final boolean isEnabled=data.getBoolean(StateActions.EXTRA_IS_RETURN_TO_ME_ENABLED,false);
if (returnToMe != null) {
if (isEnabled) {
returnToMe.enable(listener);
}
 else {
returnToMe.disable();
}
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
}
return true;
case CapabilityActions.ACTION_CHECK_FEATURE_SUPPORT:
if (listener != null) {
final String featureId=data.getString(CapabilityActions.EXTRA_FEATURE_ID);
if (!TextUtils.isEmpty(featureId)) {
switch (featureId) {
case CapabilityApi.FeatureIds.SOLO_VIDEO_STREAMING:
case CapabilityApi.FeatureIds.COMPASS_CALIBRATION:
if (this.isCompanionComputerEnabled()) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
case CapabilityApi.FeatureIds.KILL_SWITCH:
if (CommonApiUtils.isKillSwitchSupported(drone)) {
CommonApiUtils.postSuccessEvent(listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
}
break;
default :
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_UNSUPPORTED,listener);
break;
}
}
}
return true;
default :
if (drone != null) {
return drone.executeAsyncAction(action,listener);
}
 else {
CommonApiUtils.postErrorEvent(CommandExecutionError.COMMAND_FAILED,listener);
return true;
}
}
}