nus-yam/ex-repair huggingface dataset:
Program: 95246
Project: 95246
Buggy source:
private void build() throws Exception {
  GridBuilder gridBuilder=new GridBuilder(polygon,surveyData,new Coord2D(0,0));
  polygon.checkIfValid();
  grid=gridBuilder.generate();
}

Fixed version (ground truth):
public void build() throws Exception {
  GridBuilder gridBuilder=new GridBuilder(polygon,surveyData,new Coord2D(0,0));
  polygon.checkIfValid();
  grid=gridBuilder.generate();
}
Program: 95248
Project: 95248
Buggy source:
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    myDrone.events.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
    MavLinkModes.setGuidedMode(myDrone,coord.getY(),coord.getX(),altitude.valueInMeters());
  }
}

Fixed version (ground truth):
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    myDrone.events.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
    MavLinkModes.setGuidedMode(myDrone,coord.getLat(),coord.getLng(),altitude.valueInMeters());
  }
}
Program: 95249
Project: 95249
Buggy source:
public void setHome(msg_mission_item msg){
  this.coordinate=new Coord2D(msg.x,msg.y);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}

Fixed version (ground truth):
public void setHome(msg_mission_item msg){
  this.coordinate=new Coord2D(msg.y,msg.x);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}
Program: 95250
Project: 95250
Buggy source:
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.x=(float)coordinate.getX();
  mavMsg.y=(float)coordinate.getY();
  mavMsg.z=(float)coordinate.getAltitude().valueInMeters();
  return list;
}

Fixed version (ground truth):
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.x=(float)coordinate.getLat();
  mavMsg.y=(float)coordinate.getLng();
  mavMsg.z=(float)coordinate.getAltitude().valueInMeters();
  return list;
}
Program: 95251
Project: 95251
Buggy source:
@Override public void unpackMAVMessage(msg_mission_item mavMsg){
  Altitude alt=new Altitude(mavMsg.z);
  setCoordinate(new Coord3D(mavMsg.x,mavMsg.y,alt));
}

Fixed version (ground truth):
@Override public void unpackMAVMessage(msg_mission_item mavMsg){
  Altitude alt=new Altitude(mavMsg.z);
  setCoordinate(new Coord3D(mavMsg.y,mavMsg.x,alt));
}
Program: 95252
Project: 95252
Buggy source:
public void testPackMissionItem(){
  Mission mission=new Mission(null);
  Waypoint item=new Waypoint(mission,new Coord3D(0.1,1,new Altitude(2)));
  msg_mission_item mavMsg=item.packMissionItem().get(0);
  assertEquals(1,mavMsg.autocontinue);
  assertEquals(1,mavMsg.target_component);
  assertEquals(1,mavMsg.target_system);
  assertEquals(MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT,mavMsg.frame);
  assertEquals(0.1f,mavMsg.x);
  assertEquals(1f,mavMsg.y);
  assertEquals(2f,mavMsg.z);
}

Fixed version (ground truth):
public void testPackMissionItem(){
  Mission mission=new Mission(null);
  Waypoint item=new Waypoint(mission,new Coord3D(0.1,1,new Altitude(2)));
  msg_mission_item mavMsg=item.packMissionItem().get(0);
  assertEquals(1,mavMsg.autocontinue);
  assertEquals(1,mavMsg.target_component);
  assertEquals(1,mavMsg.target_system);
  assertEquals(MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT,mavMsg.frame);
  assertEquals(1f,mavMsg.x);
  assertEquals(0.1f,mavMsg.y);
  assertEquals(2f,mavMsg.z);
}
Program: 95253
Project: 95253
Buggy source:
public Coord2D getMiddle(){
  return (new Coord2D((ne_1quadrant.getX() + sw_3quadrant.getX()) / 2,(ne_1quadrant.getY() + sw_3quadrant.getY()) / 2));
}

Fixed version (ground truth):
public Coord2D getMiddle(){
  return (new Coord2D((ne_1quadrant.getLat() + sw_3quadrant.getLat()) / 2,(ne_1quadrant.getLng() + sw_3quadrant.getLng()) / 2));
}
Program: 95254
Project: 95254
Buggy source:
/** 
 * Extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html
 * @param origin Point of origin
 * @param bearing bearing to navigate
 * @param distance distance to be added
 * @return New point with the added distance
 */
public static Coord2D newCoordFromBearingAndDistance(Coord2D origin,double bearing,double distance){
  double lat=origin.getY();
  double lon=origin.getX();
  double lat1=Math.toRadians(lat);
  double lon1=Math.toRadians(lon);
  double brng=Math.toRadians(bearing);
  double dr=distance / RADIUS_OF_EARTH;
  double lat2=Math.asin(Math.sin(lat1) * Math.cos(dr) + Math.cos(lat1) * Math.sin(dr) * Math.cos(brng));
  double lon2=lon1 + Math.atan2(Math.sin(brng) * Math.sin(dr) * Math.cos(lat1),Math.cos(dr) - Math.sin(lat1) * Math.sin(lat2));
  return (new Coord2D(Math.toDegrees(lon2),Math.toDegrees(lat2)));
}

Fixed version (ground truth):
/** 
 * Extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html
 * @param origin Point of origin
 * @param bearing bearing to navigate
 * @param distance distance to be added
 * @return New point with the added distance
 */
public static Coord2D newCoordFromBearingAndDistance(Coord2D origin,double bearing,double distance){
  double lat=origin.getLat();
  double lon=origin.getLng();
  double lat1=Math.toRadians(lat);
  double lon1=Math.toRadians(lon);
  double brng=Math.toRadians(bearing);
  double dr=distance / RADIUS_OF_EARTH;
  double lat2=Math.asin(Math.sin(lat1) * Math.cos(dr) + Math.cos(lat1) * Math.sin(dr) * Math.cos(brng));
  double lon2=lon1 + Math.atan2(Math.sin(brng) * Math.sin(dr) * Math.cos(lat1),Math.cos(dr) - Math.sin(lat1) * Math.sin(lat2));
  return (new Coord2D(Math.toDegrees(lat2),Math.toDegrees(lon2)));
}
Program: 95255
Project: 95255
Buggy source:
/** 
 * Calculates the arc between two points http://en.wikipedia.org/wiki/Haversine_formula
 * @return the arc in degrees
 */
static double getArcInRadians(Coord2D from,Coord2D to){
  double latitudeArc=Math.toRadians(from.getY() - to.getY());
  double longitudeArc=Math.toRadians(from.getX() - to.getX());
  double latitudeH=Math.sin(latitudeArc * 0.5);
  latitudeH*=latitudeH;
  double lontitudeH=Math.sin(longitudeArc * 0.5);
  lontitudeH*=lontitudeH;
  double tmp=Math.cos(Math.toRadians(from.getY())) * Math.cos(Math.toRadians(to.getY()));
  return Math.toDegrees(2.0 * Math.asin(Math.sqrt(latitudeH + tmp * lontitudeH)));
}

Fixed version (ground truth):
/** 
 * Calculates the arc between two points http://en.wikipedia.org/wiki/Haversine_formula
 * @return the arc in degrees
 */
static double getArcInRadians(Coord2D from,Coord2D to){
  double latitudeArc=Math.toRadians(from.getLat() - to.getLat());
  double longitudeArc=Math.toRadians(from.getLng() - to.getLng());
  double latitudeH=Math.sin(latitudeArc * 0.5);
  latitudeH*=latitudeH;
  double lontitudeH=Math.sin(longitudeArc * 0.5);
  lontitudeH*=lontitudeH;
  double tmp=Math.cos(Math.toRadians(from.getLat())) * Math.cos(Math.toRadians(to.getLat()));
  return Math.toDegrees(2.0 * Math.asin(Math.sqrt(latitudeH + tmp * lontitudeH)));
}
Program: 95257
Project: 95257
Buggy source:
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    myDrone.events.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
    MavLinkModes.setGuidedMode(myDrone,coord.getY(),coord.getX(),altitude.valueInMeters());
  }
}

Fixed version (ground truth):
private void sendGuidedPoint(){
  if (state == GuidedStates.ACTIVE) {
    myDrone.events.notifyDroneEvent(DroneEventsType.GUIDEDPOINT);
    MavLinkModes.setGuidedMode(myDrone,coord.getLat(),coord.getLng(),altitude.valueInMeters());
  }
}
Program: 95258
Project: 95258
Buggy source:
public void setHome(msg_mission_item msg){
  this.coordinate=new Coord2D(msg.x,msg.y);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}

Fixed version (ground truth):
public void setHome(msg_mission_item msg){
  this.coordinate=new Coord2D(msg.y,msg.x);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}
Program: 95259
Project: 95259
Buggy source:
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.x=(float)coordinate.getX();
  mavMsg.y=(float)coordinate.getY();
  mavMsg.z=(float)coordinate.getAltitude().valueInMeters();
  return list;
}

Fixed version (ground truth):
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.x=(float)coordinate.getLat();
  mavMsg.y=(float)coordinate.getLng();
  mavMsg.z=(float)coordinate.getAltitude().valueInMeters();
  return list;
}
Program: 95260
Project: 95260
Buggy source:
@Override public void unpackMAVMessage(msg_mission_item mavMsg){
  Altitude alt=new Altitude(mavMsg.z);
  setCoordinate(new Coord3D(mavMsg.x,mavMsg.y,alt));
}

Fixed version (ground truth):
@Override public void unpackMAVMessage(msg_mission_item mavMsg){
  Altitude alt=new Altitude(mavMsg.z);
  setCoordinate(new Coord3D(mavMsg.y,mavMsg.x,alt));
}
Program: 95261
Project: 95261
Buggy source:
public void testPackMissionItem(){
  Mission mission=new Mission(null);
  Waypoint item=new Waypoint(mission,new Coord3D(0.1,1,new Altitude(2)));
  msg_mission_item mavMsg=item.packMissionItem().get(0);
  assertEquals(1,mavMsg.autocontinue);
  assertEquals(1,mavMsg.target_component);
  assertEquals(1,mavMsg.target_system);
  assertEquals(MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT,mavMsg.frame);
  assertEquals(0.1f,mavMsg.x);
  assertEquals(1f,mavMsg.y);
  assertEquals(2f,mavMsg.z);
}

Fixed version (ground truth):
public void testPackMissionItem(){
  Mission mission=new Mission(null);
  Waypoint item=new Waypoint(mission,new Coord3D(0.1,1,new Altitude(2)));
  msg_mission_item mavMsg=item.packMissionItem().get(0);
  assertEquals(1,mavMsg.autocontinue);
  assertEquals(1,mavMsg.target_component);
  assertEquals(1,mavMsg.target_system);
  assertEquals(MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT,mavMsg.frame);
  assertEquals(1f,mavMsg.x);
  assertEquals(0.1f,mavMsg.y);
  assertEquals(2f,mavMsg.z);
}
Program: 95262
Project: 95262
Buggy source:
public static List<Coord2D> simplify(List<Coord2D> list,double tolerance){
  int index=0;
  double dmax=0;
  double squareTolerance=tolerance * tolerance;
  int lastIndex=list.size() - 1;
  for (int i=1; i < list.size() - 1; i++) {
    double d=PointTools.pointToLineDistance(list.get(0),list.get(lastIndex),list.get(i));
    if (d > dmax) {
      index=i;
      dmax=d;
    }
  }
  List<Coord2D> ResultList=new ArrayList<Coord2D>();
  if (dmax > squareTolerance) {
    List<Coord2D> recResults1=simplify(list.subList(0,index + 1),tolerance);
    List<Coord2D> recResults2=simplify(list.subList(index,lastIndex + 1),tolerance);
    recResults1.remove(recResults1.size() - 1);
    ResultList.addAll(recResults1);
    ResultList.addAll(recResults2);
  }
 else {
    ResultList.add(list.get(0));
    ResultList.add(list.get(lastIndex));
  }
  return ResultList;
}

Fixed version (ground truth):
public static List<Coord2D> simplify(List<Coord2D> list,double tolerance){
  int index=0;
  double dmax=0;
  int lastIndex=list.size() - 1;
  for (int i=1; i < lastIndex; i++) {
    double d=PointTools.pointToLineDistance(list.get(0),list.get(lastIndex),list.get(i));
    if (d > dmax) {
      index=i;
      dmax=d;
    }
  }
  List<Coord2D> ResultList=new ArrayList<Coord2D>();
  if (dmax > tolerance) {
    List<Coord2D> recResults1=simplify(list.subList(0,index + 1),tolerance);
    List<Coord2D> recResults2=simplify(list.subList(index,lastIndex + 1),tolerance);
    recResults1.remove(recResults1.size() - 1);
    ResultList.addAll(recResults1);
    ResultList.addAll(recResults2);
  }
 else {
    ResultList.add(list.get(0));
    ResultList.add(list.get(lastIndex));
  }
  return ResultList;
}
Program: 95263
Project: 95263
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  final LatLng position=DroneHelper.CoordToLatLang(drone.GPS.getPosition());
switch (event) {
case GPS:
    mMapFragment.updateDroneLeashPath(guided);
  mMapFragment.addFlightPathPoint(position);
case MISSION_UPDATE:
update();
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided,true);
mMapFragment.updateDroneLeashPath(guided);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  final LatLng position=DroneHelper.CoordToLatLang(drone.GPS.getPosition());
switch (event) {
case MISSION_UPDATE:
    update();
  break;
case GPS:
mMapFragment.updateMarker(graphicDrone,false);
mMapFragment.updateDroneLeashPath(guided);
mMapFragment.addFlightPathPoint(position);
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided,true);
mMapFragment.updateDroneLeashPath(guided);
break;
default :
break;
}
}
Program: 95264
Project: 95264
Buggy source:
public void update(){
  mMapFragment.cleanMarkers();
  if (home.isValid()) {
    mMapFragment.updateMarker(home,false);
  }
  mMapFragment.updateMarker(graphicDrone,false);
  mMapFragment.updateMarkers(missionRender.getMarkers(),isMissionDraggable());
  mMapFragment.updateMissionPath(missionRender.getPathPoints());
}

Fixed version (ground truth):
public void update(){
  mMapFragment.cleanMarkers();
  if (home.isValid()) {
    mMapFragment.updateMarker(home,false);
  }
  mMapFragment.updateMarkers(missionRender.getMarkers(),isMissionDraggable());
  mMapFragment.updateMissionPath(missionRender.getPathPoints());
}
Program: 95265
Project: 95265
Buggy source:
private void addItemDetail(MissionItemRender item){
  itemDetailFragment=item.getDetailFragment();
  if (mContainerItemDetail == null) {
    itemDetailFragment.show(fragmentManager,"String_Node_Str");
  }
 else {
    fragmentManager.beginTransaction().add(R.id.containerItemDetail,itemDetailFragment).commit();
  }
}

Fixed version (ground truth):
private void addItemDetail(MissionItemRender item){
  itemDetailFragment=item.getDetailFragment();
  if (itemDetailFragment == null)   return;
  if (mContainerItemDetail == null) {
    itemDetailFragment.show(fragmentManager,"String_Node_Str");
  }
 else {
    fragmentManager.beginTransaction().replace(R.id.containerItemDetail,itemDetailFragment).commit();
  }
}
Program: 95266
Project: 95266
Buggy source:
@Override public void onWaypointTypeChanged(MissionItemRender newItem,MissionItemRender oldItem){
  missionRender.replace(oldItem,newItem);
  showItemDetail(newItem);
}

Fixed version (ground truth):
@Override public void onWaypointTypeChanged(MissionItemRender newItem,MissionItemRender oldItem){
  missionRender.replace(oldItem,newItem);
}
Program: 95267
Project: 95267
Buggy source:
@Override public boolean onMarkerClick(Marker marker){
  MarkerSource source=markers.getSourceFromMarker(marker);
  if (source instanceof MissionItemRender) {
    editorListener.onItemClick((MissionItemRender)source);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean onMarkerClick(Marker marker){
  MarkerSource source=markers.getSourceFromMarker(marker);
  if (source instanceof MissionItemMarkerSource) {
    editorListener.onItemClick(((MissionItemMarkerSource)source).getMarkerOrigin());
    return true;
  }
 else {
    return false;
  }
}
Program: 95268
Project: 95268
Buggy source:
public MissionDetailFragment getDetailFragment(){
  final Bundle fragmentArgs=new Bundle();
  fragmentArgs.putSerializable(MissionDetailFragment.EXTRA_MISSION_ITEM_RENDER,this);
  MissionDetailFragment fragment=new MissionWaypointFragment();
  fragment.setArguments(fragmentArgs);
  return fragment;
}

Fixed version (ground truth):
public MissionDetailFragment getDetailFragment(){
  return MissionDetailFragment.newInstance(mMissionItem.getType());
}
Program: 95269
Project: 95269
Buggy source:
public MissionItemRender(MissionRender mission,MissionItem missionItem){
  mMission=mission;
  mMissionItem=missionItem;
}

Fixed version (ground truth):
public MissionItemRender(MissionRender mission,MissionItem missionItem){
  mMission=mission;
  mMissionItem=missionItem;
  mMarkerSource=MissionItemMarkerSource.newInstance(this);
}
Program: 95270
Project: 95270
Buggy source:
/** 
 * Updates a mission item render
 * @param oldItem mission item render to update
 * @param newItem new mission item render
 */
public void replace(MissionItemRender oldItem,MissionItemRender newItem){
  final int index=mMissionItems.indexOf(oldItem);
  if (selectionContains(oldItem)) {
    removeItemFromSelection(oldItem);
    addToSelection(newItem);
  }
  mMissionItems.remove(index);
  mMissionItems.add(index,newItem);
  mMission.replace(oldItem.getMissionItem(),newItem.getMissionItem());
}

Fixed version (ground truth):
/** 
 * Updates a mission item render
 * @param oldItem mission item render to update
 * @param newItem new mission item render
 */
public void replace(MissionItemRender oldItem,MissionItemRender newItem){
  final int index=mMissionItems.indexOf(oldItem);
  if (index == -1)   return;
  mMissionItems.remove(index);
  mMissionItems.add(index,newItem);
  mMission.replace(oldItem.getMissionItem(),newItem.getMissionItem());
  if (selectionContains(oldItem)) {
    removeItemFromSelection(oldItem);
    addToSelection(newItem);
  }
}
Program: 95271
Project: 95271
Buggy source:
/** 
 * @return the map markers corresponding to this mission's command set.
 */
public List<MarkerSource> getMarkers(){
  List<MarkerSource> markers=new ArrayList<MarkerSource>();
  for (  MissionItemRender itemRender : mMissionItems) {
    markers.add(itemRender);
  }
  return markers;
}

Fixed version (ground truth):
/** 
 * @return the map markers corresponding to this mission's command set.
 */
public List<MarkerSource> getMarkers(){
  List<MarkerSource> markers=new ArrayList<MarkerSource>();
  for (  MissionItemRender itemRender : mMissionItems) {
    MarkerSource markerSource=itemRender.getMarkerSource();
    if (markerSource != null)     markers.add(itemRender.getMarkerSource());
  }
  return markers;
}
Program: 95272
Project: 95272
Buggy source:
public AdapterMissionItems(Context context,int resource,MissionItemTypes[] objects){
  super(context,resource,objects);
}

Fixed version (ground truth):
public AdapterMissionItems(Context context,int resource,MissionItemType[] objects){
  super(context,resource,objects);
}
Program: 95273
Project: 95273
Buggy source:
@Override public void onItemSelected(AdapterView<?> arg0,View v,int position,long id){
  MissionItemTypes selected=commandAdapter.getItem(position);
  try {
    MissionItem newItem=selected.getNewItem(missionRender.getMission());
    if (!newItem.getClass().equals(getItem().getClass())) {
      Log.d("String_Node_Str","String_Node_Str");
      mListener.onWaypointTypeChanged(new MissionItemRender(missionRender,newItem),getItem());
    }
  }
 catch (  IllegalArgumentException e) {
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> arg0,View v,int position,long id){
  MissionItemType selected=commandAdapter.getItem(position);
  try {
    final MissionItem oldItem=itemRender.getMissionItem();
    if (oldItem.getType() != selected) {
      Log.d("String_Node_Str","String_Node_Str");
      MissionItem newItem=selected.getNewItem(oldItem);
      mListener.onWaypointTypeChanged(new MissionItemRender(itemRender.getMissionRender(),newItem),itemRender);
      dismiss();
    }
  }
 catch (  IllegalArgumentException e) {
  }
}
Program: 95274
Project: 95274
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setStyle(DialogFragment.STYLE_NO_TITLE,0);
  setRetainInstance(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setStyle(DialogFragment.STYLE_NO_TITLE,0);
}
Program: 95275
Project: 95275
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  missionRender=((DroidPlannerApp)getActivity().getApplication()).missionRender;
  mListener=(OnWayPointTypeChangeListener)activity;
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  mListener=(OnWayPointTypeChangeListener)activity;
}
Program: 95276
Project: 95276
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(getResource(),null);
  Bundle args=getArguments();
  if (args == null)   throw new IllegalStateException("String_Node_Str");
  itemRender=(MissionItemRender)args.getSerializable(EXTRA_MISSION_ITEM_RENDER);
  setupViews(view);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(getResource(),null);
  final MissionRender missionRender=((DroidPlannerApp)getActivity().getApplication()).missionRender;
  itemRender=missionRender.getSelected().get(0);
  setupViews(view);
  return view;
}
Program: 95277
Project: 95277
Buggy source:
protected void setupViews(View view){
  commandAdapter=new AdapterMissionItems(this.getActivity(),android.R.layout.simple_list_item_1,MissionItemTypes.values());
  typeSpinner=(SpinnerSelfSelect)view.findViewById(R.id.spinnerWaypointType);
  typeSpinner.setAdapter(commandAdapter);
  typeSpinner.setOnItemSelectedListener(this);
  final TextView waypointIndex=(TextView)view.findViewById(R.id.WaypointIndex);
  Integer temp=missionRender.getOrder(itemRender);
  waypointIndex.setText(temp.toString());
  final TextView distanceView=(TextView)view.findViewById(R.id.DistanceValue);
  final TextView distanceLabelView=(TextView)view.findViewById(R.id.DistanceLabel);
  try {
    distanceLabelView.setVisibility(View.VISIBLE);
    distanceView.setText(missionRender.getDistanceFromLastWaypoint(itemRender).toString());
  }
 catch (  NullPointerException e) {
  }
catch (  Exception e) {
  }
}

Fixed version (ground truth):
protected void setupViews(View view){
  final MissionRender missionRender=itemRender.getMissionRender();
  commandAdapter=new AdapterMissionItems(this.getActivity(),android.R.layout.simple_list_item_1,MissionItemType.values());
  typeSpinner=(SpinnerSelfSelect)view.findViewById(R.id.spinnerWaypointType);
  typeSpinner.setAdapter(commandAdapter);
  typeSpinner.setOnItemSelectedListener(this);
  final TextView waypointIndex=(TextView)view.findViewById(R.id.WaypointIndex);
  if (waypointIndex != null) {
    final int itemOrder=missionRender.getOrder(itemRender);
    waypointIndex.setText(String.valueOf(itemOrder));
  }
  final TextView distanceView=(TextView)view.findViewById(R.id.DistanceValue);
  final TextView distanceLabelView=(TextView)view.findViewById(R.id.DistanceLabel);
  try {
    distanceLabelView.setVisibility(View.VISIBLE);
    distanceView.setText(missionRender.getDistanceFromLastWaypoint(itemRender).toString());
  }
 catch (  NullPointerException e) {
  }
catch (  Exception e) {
  }
}
Program: 95278
Project: 95278
Buggy source:
private void addItemDetail(MissionItem item){
  itemDetailFragment=item.getDetailFragment();
  if (mContainerItemDetail == null) {
    itemDetailFragment.show(fragmentManager,"String_Node_Str");
  }
 else {
    fragmentManager.beginTransaction().add(R.id.containerItemDetail,itemDetailFragment).commit();
  }
}

Fixed version (ground truth):
private void addItemDetail(MissionItem item){
  if (item instanceof EditorMissionItem) {
    itemDetailFragment=((EditorMissionItem)item).getDetailFragment();
    if (mContainerItemDetail == null) {
      itemDetailFragment.show(fragmentManager,"String_Node_Str");
    }
 else {
      fragmentManager.beginTransaction().add(R.id.containerItemDetail,itemDetailFragment).commit();
    }
  }
}
Program: 95279
Project: 95279
Buggy source:
@Override public void onMapClick(LatLng point){
  mission.clearSelection();
  removeItemDetail();
  notifySelectionChanged();
switch (getTool()) {
case MARKER:
    mission.addWaypoint(point);
  break;
case DRAW:
break;
case POLY:
break;
case TRASH:
break;
case NONE:
break;
}
}

Fixed version (ground truth):
@Override public void onMapClick(LatLng point){
  mission.clearSelection();
  removeItemDetail();
  notifySelectionChanged();
switch (getTool()) {
case MARKER:
    mission.addWaypoint(DroneHelper.LatLngToCoord(point));
  break;
case DRAW:
break;
case POLY:
break;
case TRASH:
break;
case NONE:
break;
}
}
Program: 95280
Project: 95280
Buggy source:
/** 
 * Load/aggregate profile from resources and file (if available) File will override resource settings
 */
public static VehicleProfile load(Context context,String vehicleType){
  final String fileName=vehicleType + "String_Node_Str";
  final String path=VEHICLEPROFILE_PATH + File.separator + fileName;
  try {
    final VehicleProfile newProfile=new VehicleProfile();
    final AssetManager assetManager=context.getAssets();
    if (AssetUtil.exists(assetManager,VEHICLEPROFILE_PATH,fileName)) {
      final InputStream inputStream=assetManager.open(path);
      VehicleProfileReader.open(inputStream,newProfile);
    }
    final File file=new File(DirectoryPath.getDroidPlannerPath() + path);
    if (file.exists()) {
      final InputStream inputStream=new FileInputStream(file);
      VehicleProfileReader.open(inputStream,newProfile);
    }
    return newProfile;
  }
 catch (  Exception e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Load/aggregate profile from resources and file (if available) File will override resource settings
 */
public static VehicleProfile load(Context context,FirmwareType vehicleType){
  final String fileName=vehicleType + "String_Node_Str";
  final String path=VEHICLEPROFILE_PATH + File.separator + fileName;
  try {
    final VehicleProfile newProfile=new VehicleProfile();
    final AssetManager assetManager=context.getAssets();
    if (AssetUtil.exists(assetManager,VEHICLEPROFILE_PATH,fileName)) {
      final InputStream inputStream=assetManager.open(path);
      VehicleProfileReader.open(inputStream,newProfile);
    }
    final File file=new File(DirectoryPath.getDroidPlannerPath() + path);
    if (file.exists()) {
      final InputStream inputStream=new FileInputStream(file);
      VehicleProfileReader.open(inputStream,newProfile);
    }
    return newProfile;
  }
 catch (  Exception e) {
  }
  return null;
}
Program: 95281
Project: 95281
Buggy source:
private static void parse(XmlPullParser parser,VehicleProfile profile) throws XmlPullParserException, IOException {
  VehicleProfile.ViewProfileBuilder viewProfileBuilder=profile.getViewProfileBuilder();
  int eventType=parser.getEventType();
  while (eventType != XmlPullParser.END_DOCUMENT) {
    final String parserName=parser.getName();
switch (eventType) {
case XmlPullParser.START_TAG:
      if (parserName.equals(TAG_METADATATYPE)) {
        final String value=parser.getAttributeValue(null,ATTR_TYPE);
        if (value != null)         profile.setParameterMetadataType(value);
      }
 else       if (parserName.equals(TAG_DEFAULT)) {
        parseDefault(parser,profile.getDefault());
      }
 else       if (parserName.equals(TAG_VIEWPROFILE)) {
        if (viewProfileBuilder != null)         viewProfileBuilder.addViewProfile(newViewProfile(parser));
      }
 else       if (parserName.equals(TAG_DIALOGPROFILE)) {
        viewProfileBuilder=profile.addDialogProfile(newDialogProfile(parser));
      }
    break;
case XmlPullParser.END_TAG:
  if (parserName.equals(TAG_DIALOGPROFILE)) {
    viewProfileBuilder=profile.getViewProfileBuilder();
  }
break;
}
eventType=parser.next();
}
}

Fixed version (ground truth):
private static void parse(XmlPullParser parser,VehicleProfile profile) throws XmlPullParserException, IOException {
  int eventType=parser.getEventType();
  while (eventType != XmlPullParser.END_DOCUMENT) {
    final String parserName=parser.getName();
switch (eventType) {
case XmlPullParser.START_TAG:
      if (parserName.equals(TAG_METADATATYPE)) {
        final String value=parser.getAttributeValue(null,ATTR_TYPE);
        if (value != null)         profile.setParameterMetadataType(value);
      }
 else       if (parserName.equals(TAG_DEFAULT)) {
        parseDefault(parser,profile.getDefault());
      }
    break;
case XmlPullParser.END_TAG:
  break;
}
eventType=parser.next();
}
}
Program: 95282
Project: 95282
Buggy source:
@Override public String getVehicleType(){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  return prefs.getString("String_Node_Str",null);
}

Fixed version (ground truth):
@Override public FirmwareType getVehicleType(){
  final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  String str=prefs.getString("String_Node_Str",null);
  return FirmwareType.firmwareFromString(str);
}
Program: 95283
Project: 95283
Buggy source:
@Override public void onMovingWaypoint(SpatialCoordItemD source,LatLng latLng){
}

Fixed version (ground truth):
@Override public void onMovingWaypoint(SpatialCoordItem source,LatLng latLng){
}
Program: 95284
Project: 95284
Buggy source:
private void notifiyDisconnected(){
  watchdog.removeCallbacks(watchdogCallback);
}

Fixed version (ground truth):
private void notifiyDisconnected(){
  watchdog.removeCallbacks(watchdogCallback);
  heartbeatState=HeartbeatState.FIRST_HEARTBEAT;
}
Program: 95285
Project: 95285
Buggy source:
private void notifyConnected(){
  heartbeatState=HeartbeatState.FIRST_HEARTBEAT;
  restartWatchdog(HEARTBEAT_NORMAL_TIMEOUT);
}

Fixed version (ground truth):
private void notifyConnected(){
  restartWatchdog(HEARTBEAT_NORMAL_TIMEOUT);
}
Program: 95286
Project: 95286
Buggy source:
public Coord2D(double x,double y){
  set(x,y);
}

Fixed version (ground truth):
public Coord2D(Coord2D point){
  set(point);
}
Program: 95287
Project: 95287
Buggy source:
private void include(Coord2D point){
  if ((sw_3quadrant != null) | (ne_1quadrant != null)) {
    sw_3quadrant=ne_1quadrant=point;
  }
 else {
    if (point.getY() > ne_1quadrant.getY()) {
      ne_1quadrant.set(ne_1quadrant.getX(),point.getY());
    }
    if (point.getX() > ne_1quadrant.getX()) {
      ne_1quadrant.set(point.getX(),ne_1quadrant.getY());
    }
    if (point.getY() < ne_1quadrant.getY()) {
      sw_3quadrant.set(sw_3quadrant.getX(),point.getY());
    }
    if (point.getX() < sw_3quadrant.getX()) {
      sw_3quadrant.set(point.getX(),sw_3quadrant.getY());
    }
  }
}

Fixed version (ground truth):
public void include(Coord2D point){
  if ((sw_3quadrant == null) | (ne_1quadrant == null)) {
    ne_1quadrant=new Coord2D(point);
    sw_3quadrant=new Coord2D(point);
  }
 else {
    if (point.getY() > ne_1quadrant.getY()) {
      ne_1quadrant.set(ne_1quadrant.getX(),point.getY());
    }
    if (point.getX() > ne_1quadrant.getX()) {
      ne_1quadrant.set(point.getX(),ne_1quadrant.getY());
    }
    if (point.getY() < sw_3quadrant.getY()) {
      sw_3quadrant.set(sw_3quadrant.getX(),point.getY());
    }
    if (point.getX() < sw_3quadrant.getX()) {
      sw_3quadrant.set(point.getX(),sw_3quadrant.getY());
    }
  }
}
Program: 95288
Project: 95288
Buggy source:
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.command=MAV_CMD.MAV_CMD_NAV_LAND;
  mavMsg.frame=MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
  mavMsg.z=(float)returnAltitude.valueInMeters();
  return list;
}

Fixed version (ground truth):
@Override public List<msg_mission_item> packMissionItem(){
  List<msg_mission_item> list=super.packMissionItem();
  msg_mission_item mavMsg=list.get(0);
  mavMsg.command=MAV_CMD.MAV_CMD_NAV_RETURN_TO_LAUNCH;
  mavMsg.frame=MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
  mavMsg.z=(float)returnAltitude.valueInMeters();
  return list;
}
Program: 95289
Project: 95289
Buggy source:
public void set(double x,double y){
  this.x=x;
  this.y=y;
}

Fixed version (ground truth):
public void set(Coord2D coord){
  set(coord.x,coord.y);
}
Program: 95290
Project: 95290
Buggy source:
public Coord2D(double x2,double y){
  set(x2,y);
}

Fixed version (ground truth):
public Coord2D(double x,double y){
  set(x,y);
}
Program: 95291
Project: 95291
Buggy source:
public void addMissionUpdatesListner(OnDroneListner listner){
  myDrone.events.addDroneListener(listner);
}

Fixed version (ground truth):
public void addMissionUpdatesListner(OnDroneListener listner){
  myDrone.events.addDroneListener(listner);
}
Program: 95292
Project: 95292
Buggy source:
public void removeMissionUpdatesListner(OnDroneListner listener){
  myDrone.events.removeDroneListener(listener);
}

Fixed version (ground truth):
public void removeMissionUpdatesListner(OnDroneListener listener){
  myDrone.events.removeDroneListener(listener);
}
Program: 95294
Project: 95294
Buggy source:
public void update(){
  markers.clean();
  Home home=drone.home.getHome();
  if (home.isValid()) {
    markers.updateMarker(home,false,context);
  }
  markers.updateMarkers(mission.getMarkers(),true,context);
  missionPath.update(mission);
}

Fixed version (ground truth):
public void update(){
  markers.clean();
  Home home=drone.home.getHome();
  if (home.isValid()) {
    markers.updateMarker(home,false,context);
  }
  markers.updateMarkers(mission.getMarkers(),isMissionDraggable(),context);
  missionPath.update(mission);
}
Program: 95295
Project: 95295
Buggy source:
public void onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.bar_timer_reset:
    drone.state.resetFlightTimer();
  break;
case R.id.bar_home:
break;
case R.id.menu_send_mission:
drone.mission.sendMissionToAPM();
break;
case R.id.menu_load_mission:
drone.waypointMananger.getWaypoints();
break;
}
}

Fixed version (ground truth):
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.bar_timer_reset:
    drone.state.resetFlightTimer();
  return true;
case R.id.bar_home:
return true;
case R.id.menu_send_mission:
drone.mission.sendMissionToAPM();
return true;
case R.id.menu_load_mission:
drone.waypointMananger.getWaypoints();
return true;
}
return false;
}
Program: 95296
Project: 95296
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  infoMenu.onOptionsItemSelected(item);
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (infoMenu.onOptionsItemSelected(item))   return true;
  return super.onOptionsItemSelected(item);
}
Program: 95297
Project: 95297
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.menu_help) {
    showHelpDialog();
  }
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_help:
    showHelpDialog();
  return true;
default :
return false;
}
}
Program: 95298
Project: 95298
Buggy source:
public void setHome(msg_mission_item msg){
  this.coordinate=new LatLng(msg.y,msg.x);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}

Fixed version (ground truth):
public void setHome(msg_mission_item msg){
  this.coordinate=new LatLng(msg.x,msg.y);
  this.altitude=new Altitude(msg.z);
  myDrone.events.notifyDroneEvent(DroneEventsType.HOME);
}
Program: 95299
Project: 95299
Buggy source:
private List<MissionItem> getSublistToRotateUp(){
  int from=itens.indexOf(selection.get(0));
  int to=from;
  while (selection.contains(itens.get(++to))) {
    if (itens.size() < to + 2)     return itens.subList(0,0);
  }
  return itens.subList(from,to + 1);
}

Fixed version (ground truth):
private List<MissionItem> getSublistToRotateUp(){
  int from=itens.indexOf(selection.get(0));
  int to=from;
  do {
    if (itens.size() < to + 2)     return itens.subList(0,0);
  }
 while (selection.contains(itens.get(++to)));
  return itens.subList(from,to + 1);
}
Program: 95300
Project: 95300
Buggy source:
@Override public void onAttach(Activity activity){
  parent=(ConfigurationActivity)activity;
  super.onAttach(activity);
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  parent=(ConfigurationActivity)activity;
  parent.addOnPageChangeListener(this);
  super.onAttach(activity);
}
Program: 95301
Project: 95301
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_configuration);
  final ConfigurationPagerAdapter pagerAdapter=new ConfigurationPagerAdapter(getApplicationContext(),getFragmentManager());
  final ViewPager viewPager=(ViewPager)findViewById(R.id.configuration_pager);
  viewPager.setAdapter(pagerAdapter);
  final TabPageIndicator tabIndicator=(TabPageIndicator)findViewById(R.id.configuration_tab_strip);
  tabIndicator.setViewPager(viewPager);
  final ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  Intent intent=getIntent();
  String stringExtra=intent.getStringExtra(SCREEN_INTENT);
  if (SETTINGS.equalsIgnoreCase(stringExtra)) {
    viewPager.setCurrentItem(0);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_configuration);
  final ConfigurationPagerAdapter pagerAdapter=new ConfigurationPagerAdapter(getApplicationContext(),getFragmentManager());
  final ViewPager viewPager=(ViewPager)findViewById(R.id.configuration_pager);
  viewPager.setAdapter(pagerAdapter);
  final TabPageIndicator tabIndicator=(TabPageIndicator)findViewById(R.id.configuration_tab_strip);
  tabIndicator.setViewPager(viewPager);
  tabIndicator.setOnPageChangeListener(this);
  final ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  Intent intent=getIntent();
  String stringExtra=intent.getStringExtra(SCREEN_INTENT);
  if (SETTINGS.equalsIgnoreCase(stringExtra)) {
    viewPager.setCurrentItem(0);
  }
}
Program: 95302
Project: 95302
Buggy source:
public void setParamValueByName(String paramName,double value){
  for (  Parameter param : calParameterItems) {
    if (param.name.contentEquals(paramName)) {
      param.value=value;
      Log.d("String_Node_Str",param.name + "String_Node_Str" + String.valueOf(value));
      return;
    }
  }
}

Fixed version (ground truth):
public void setParamValueByName(String paramName,double value){
  for (  Parameter param : calParameterItems) {
    if (param.name.contentEquals(paramName)) {
      param.value=value;
      return;
    }
  }
}
Program: 95303
Project: 95303
Buggy source:
@Override public void onStop(){
  drone.events.removeDroneListener(this);
  MavLinkStreamRates.setupStreamRatesFromPref((DroidPlannerApp)getActivity().getApplication());
  super.onStop();
}

Fixed version (ground truth):
@Override public void onStop(){
  drone.events.removeDroneListener(this);
  resetDataStreamingForRcSetup();
  super.onStop();
}
Program: 95304
Project: 95304
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_configuration);
  final ConfigurationPagerAdapter pagerAdapter=new ConfigurationPagerAdapter(getApplicationContext(),getFragmentManager());
  final ViewPager viewPager=(ViewPager)findViewById(R.id.configuration_pager);
  viewPager.setAdapter(pagerAdapter);
  final TabPageIndicator tabIndicator=(TabPageIndicator)findViewById(R.id.configuration_tab_strip);
  tabIndicator.setViewPager(viewPager);
  tabIndicator.setOnPageChangeListener(this);
  final ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  Intent intent=getIntent();
  String stringExtra=intent.getStringExtra(SCREEN_INTENT);
  if (SETTINGS.equalsIgnoreCase(stringExtra)) {
    viewPager.setCurrentItem(0);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_configuration);
  final ConfigurationPagerAdapter pagerAdapter=new ConfigurationPagerAdapter(getApplicationContext(),getFragmentManager());
  final ViewPager viewPager=(ViewPager)findViewById(R.id.configuration_pager);
  viewPager.setAdapter(pagerAdapter);
  this.viewPager=viewPager;
  final TabPageIndicator tabIndicator=(TabPageIndicator)findViewById(R.id.configuration_tab_strip);
  tabIndicator.setViewPager(viewPager);
  tabIndicator.setOnPageChangeListener(this);
  final ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  Intent intent=getIntent();
  String stringExtra=intent.getStringExtra(SCREEN_INTENT);
  if (SETTINGS.equalsIgnoreCase(stringExtra)) {
    viewPager.setCurrentItem(0);
  }
}
Program: 95305
Project: 95305
Buggy source:
@Override public void onPageScrollStateChanged(int arg0){
}

Fixed version (ground truth):
@Override public void onPageScrollStateChanged(int arg0){
  if (arg0 == ViewPager.SCROLL_STATE_IDLE) {
    onPageSelected(viewPager.getCurrentItem());
  }
}
Program: 95306
Project: 95306
Buggy source:
@Override public void onPause(){
  MavLinkStreamRates.setupStreamRatesFromPref((DroidPlannerApp)getActivity().getApplication());
  drone.events.removeDroneListener(this);
  super.onPause();
}

Fixed version (ground truth):
@Override public void onPause(){
  drone.events.removeDroneListener(this);
  super.onPause();
}
Program: 95307
Project: 95307
Buggy source:
@Override public void onResume(){
  drone.events.addDroneListener(this);
  setupDataStreamingForRcSetup();
  super.onResume();
}

Fixed version (ground truth):
@Override public void onResume(){
  drone.events.addDroneListener(this);
  super.onResume();
}
Program: 95308
Project: 95308
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case RC_IN:
    onNewInputRcData();
  break;
case RC_OUT:
break;
case PARAMETER:
rcParameters.processReceivedParam();
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case RC_IN:
    Log.d("String_Node_Str","String_Node_Str");
  onNewInputRcData();
break;
case RC_OUT:
break;
case PARAMETER:
rcParameters.processReceivedParam();
break;
default :
break;
}
}
Program: 95309
Project: 95309
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_editor);
  ActionBar actionBar=getActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  fragmentManager=getFragmentManager();
  planningMapFragment=((EditorMapFragment)fragmentManager.findFragmentById(R.id.mapFragment));
  gestureMapFragment=((GestureMapFragment)fragmentManager.findFragmentById(R.id.gestureMapFragment));
  editorToolsFragment=(EditorToolsFragment)fragmentManager.findFragmentById(R.id.editorToolsFragment);
  missionListFragment=(EditorListFragment)fragmentManager.findFragmentById(R.id.missionFragment1);
  infoView=(TextView)findViewById(R.id.editorInfoWindow);
  removeItemDetail();
  mission=drone.mission;
  gestureMapFragment.setOnPathFinishedListner(this);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_editor);
  ActionBar actionBar=getActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  fragmentManager=getFragmentManager();
  planningMapFragment=((EditorMapFragment)fragmentManager.findFragmentById(R.id.mapFragment));
  gestureMapFragment=((GestureMapFragment)fragmentManager.findFragmentById(R.id.gestureMapFragment));
  editorToolsFragment=(EditorToolsFragment)fragmentManager.findFragmentById(R.id.editorToolsFragment);
  missionListFragment=(EditorListFragment)fragmentManager.findFragmentById(R.id.missionFragment1);
  infoView=(TextView)findViewById(R.id.editorInfoWindow);
  removeItemDetail();
  mission=drone.mission;
  gestureMapFragment.setOnPathFinishedListner(this);
  planningMapFragment.update();
}
Program: 95310
Project: 95310
Buggy source:
public void changeSetupPanel(int step){
  calibStep=step;
switch (step) {
case 0:
    setupPanel=new FragmentSetupRCMenu();
  ((FragmentSetupRCMenu)setupPanel).rcSetupFragment=this;
break;
case 1:
setupPanel=new FragmentSetupRCMinMax();
((FragmentSetupRCMinMax)setupPanel).rcSetupFragment=this;
break;
case 2:
setupPanel=new FragmentSetupRCMiddle();
((FragmentSetupRCMiddle)setupPanel).rcSetupFragment=this;
break;
case 3:
setupPanel=new FragmentSetupRCCompleted();
((FragmentSetupRCCompleted)setupPanel).rcSetupFragment=this;
break;
case 5:
setupPanel=new FragmentSetupRCOptions();
((FragmentSetupRCOptions)setupPanel).rcSetupFragment=this;
break;
}
fragmentManager.beginTransaction().replace(R.id.fragment_setup_rc,setupPanel).commit();
if (btnCalibrate != null) {
if (step > 0) {
btnCalibrate.setText(R.string.rc_btn_cancel);
btnCalibrate.setVisibility(View.VISIBLE);
}
 else {
btnCalibrate.setVisibility(View.GONE);
}
}
}

Fixed version (ground truth):
public void changeSetupPanel(int step){
  calibStep=step;
switch (step) {
case 0:
    setupPanel=new FragmentSetupRCMenu();
  ((FragmentSetupRCMenu)setupPanel).rcSetupFragment=this;
break;
case 1:
setupPanel=new FragmentSetupRCMinMax();
((FragmentSetupRCMinMax)setupPanel).rcSetupFragment=this;
break;
case 2:
setupPanel=new FragmentSetupRCMiddle();
((FragmentSetupRCMiddle)setupPanel).rcSetupFragment=this;
break;
case 3:
setupPanel=new FragmentSetupRCCompleted();
((FragmentSetupRCCompleted)setupPanel).rcSetupFragment=this;
break;
case 4:
setupPanel=new FragmentSetupRCFailsafe();
((FragmentSetupRCFailsafe)setupPanel).rcSetupFragment=this;
break;
case 5:
setupPanel=new FragmentSetupRCOptions();
((FragmentSetupRCOptions)setupPanel).rcSetupFragment=this;
break;
}
fragmentManager.beginTransaction().replace(R.id.fragment_setup_rc,setupPanel).commit();
if (btnCalibrate != null) {
if (step > 0) {
btnCalibrate.setText(R.string.rc_btn_cancel);
btnCalibrate.setVisibility(View.VISIBLE);
}
 else {
btnCalibrate.setVisibility(View.GONE);
}
}
}
Program: 95311
Project: 95311
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  drone=((DroidPlannerApp)getActivity().getApplication()).drone;
  View view=inflater.inflate(R.layout.fragment_setup_rc,container,false);
  Fragment defPanel=fragmentManager.findFragmentById(R.id.fragment_setup_rc);
  if (defPanel == null) {
    defPanel=new FragmentSetupRCMenu();
    ((FragmentSetupRCMenu)defPanel).rcSetupFragment=this;
    fragmentManager.beginTransaction().add(R.id.fragment_setup_rc,defPanel).commit();
  }
  setupLocalViews(view);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  drone=((DroidPlannerApp)getActivity().getApplication()).drone;
  View view=inflater.inflate(R.layout.fragment_setup_rc,container,false);
  Fragment defPanel=fragmentManager.findFragmentById(R.id.fragment_setup_rc);
  if (defPanel == null) {
    defPanel=new FragmentSetupRCMenu();
    ((FragmentSetupRCMenu)defPanel).rcSetupFragment=this;
    fragmentManager.beginTransaction().add(R.id.fragment_setup_rc,defPanel).commit();
  }
 else {
    cancel();
  }
  setupLocalViews(view);
  return view;
}
Program: 95312
Project: 95312
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
}
Program: 95313
Project: 95313
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MISSION:
    if (itemDetailFragment != null) {
      if (!drone.mission.hasItem(itemDetailFragment.getItem())) {
        removeItemDetail();
      }
    }
  break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
  super.onDroneEvent(event,drone);
switch (event) {
case MISSION:
    if (itemDetailFragment != null) {
      if (!drone.mission.hasItem(itemDetailFragment.getItem())) {
        removeItemDetail();
      }
    }
  break;
default :
break;
}
}