nus-yam/ex-repair huggingface dataset:
Program: 95128
Project: 95128
Buggy source:
@Override public boolean onEditorAction(TextView v,int actionId,KeyEvent event){
  if (actionId == EditorInfo.IME_ACTION_DONE) {
    hideSoftInput();
    final CharSequence input=v.getText();
    if (input != null) {
      final int update=Integer.parseInt(input.toString());
      final int updateIndex=mSpinnerWheel.getViewAdapter().getItemIndex(update);
      if (updateIndex == -1) {
        Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
      }
 else {
        setCurrentItem(updateIndex,true);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onEditorAction(TextView v,int actionId,KeyEvent event){
  if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_NULL) {
    hideSoftInput();
    final CharSequence input=v.getText();
    if (input != null) {
      final int update=Integer.parseInt(input.toString());
      final int updateIndex=mSpinnerWheel.getViewAdapter().getItemIndex(update);
      if (updateIndex == -1) {
        Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
      }
 else {
        setCurrentItem(updateIndex,true);
      }
    }
    return true;
  }
  return false;
}
Program: 95131
Project: 95131
Buggy source:
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  updateMapPadding();
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  updateMapLocationButtons(mAppPrefs.getAutoPanMode());
  updateMapPadding();
}
Program: 95132
Project: 95132
Buggy source:
private void updateMapLocationButtons(AutoPanMode mode){
  mGoToMyLocation.setActivated(false);
  mGoToDroneLocation.setActivated(false);
  mapFragment.setAutoPanMode(mode);
switch (mode) {
case DRONE:
    mGoToDroneLocation.setActivated(true);
  break;
case USER:
mGoToMyLocation.setActivated(true);
break;
default :
break;
}
}

Fixed version (ground truth):
private void updateMapLocationButtons(AutoPanMode mode){
  mGoToMyLocation.setActivated(false);
  mGoToDroneLocation.setActivated(false);
  if (mapFragment != null) {
    mapFragment.setAutoPanMode(mode);
  }
switch (mode) {
case DRONE:
    mGoToDroneLocation.setActivated(true);
  break;
case USER:
mGoToMyLocation.setActivated(true);
break;
default :
break;
}
}
Program: 95133
Project: 95133
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(getResource(),container,false);
  final MissionProxy missionProxy=((DroidPlannerApp)getActivity().getApplication()).missionProxy;
  itemRender=missionProxy.selection.getSelected().get(0);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final MissionProxy missionProxy=((DroidPlannerApp)getActivity().getApplication()).missionProxy;
  final List<MissionItemProxy> selections=missionProxy.selection.getSelected();
  if (selections.isEmpty()) {
    return null;
  }
  itemRender=selections.get(0);
  return inflater.inflate(getResource(),container,false);
}
Program: 95134
Project: 95134
Buggy source:
@Override protected void openAndroidConnection() throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  ftDev=ftD2xx.openByIndex(mContext,0);
  if (ftDev == null) {
    throw new IOException("String_Node_Str");
  }
  Log.d("String_Node_Str","String_Node_Str" + baud_rate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(baud_rate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void openAndroidConnection() throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  try {
    ftDev=ftD2xx.openByIndex(mContext,0);
  }
 catch (  NullPointerException e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    if (ftDev == null) {
      throw new IOException("String_Node_Str");
    }
  }
  Log.d("String_Node_Str","String_Node_Str" + baud_rate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(baud_rate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
}
Program: 95136
Project: 95136
Buggy source:
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  updateMapPadding();
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  updateMapLocationButtons(mAppPrefs.getAutoPanMode());
  updateMapPadding();
}
Program: 95137
Project: 95137
Buggy source:
private void updateMapLocationButtons(AutoPanMode mode){
  mGoToMyLocation.setActivated(false);
  mGoToDroneLocation.setActivated(false);
  mapFragment.setAutoPanMode(mode);
switch (mode) {
case DRONE:
    mGoToDroneLocation.setActivated(true);
  break;
case USER:
mGoToMyLocation.setActivated(true);
break;
default :
break;
}
}

Fixed version (ground truth):
private void updateMapLocationButtons(AutoPanMode mode){
  mGoToMyLocation.setActivated(false);
  mGoToDroneLocation.setActivated(false);
  if (mapFragment != null) {
    mapFragment.setAutoPanMode(mode);
  }
switch (mode) {
case DRONE:
    mGoToDroneLocation.setActivated(true);
  break;
case USER:
mGoToMyLocation.setActivated(true);
break;
default :
break;
}
}
Program: 95138
Project: 95138
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (SettingsFragment.ACTION_UPDATED_STATUS_PERIOD.equals(action)) {
    statusInterval=mAppPrefs.getSpokenStatusInterval();
    handler.removeCallbacks(watchdogCallback);
    if (statusInterval != 0) {
      handler.postDelayed(watchdogCallback,statusInterval * 1000);
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (SettingsFragment.ACTION_UPDATED_STATUS_PERIOD.equals(action)) {
    scheduleWatchdog();
  }
}
Program: 95140
Project: 95140
Buggy source:
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      ttsLanguage=tts.getDefaultLanguage();
    }
 else {
      ttsLanguage=tts.getLanguage();
    }
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
if (tts != null) {
LocalBroadcastManager.getInstance(context).registerReceiver(mSpeechIntervalUpdateReceiver,new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}

Fixed version (ground truth):
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      ttsLanguage=tts.getDefaultLanguage();
    }
 else {
      ttsLanguage=tts.getLanguage();
    }
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
if (tts != null) {
tts.setOnUtteranceCompletedListener(mSpeechCompleteListener);
LocalBroadcastManager.getInstance(context).registerReceiver(mSpeechIntervalUpdateReceiver,new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}
Program: 95141
Project: 95141
Buggy source:
private void speakPeriodic(Drone drone){
  final SparseBooleanArray speechPrefs=mAppPrefs.getPeriodicSpeechPrefs();
  final StringBuilder message=new StringBuilder();
  if (speechPrefs.get(R.string.pref_tts_periodic_bat_volt_key)) {
    message.append("String_Node_Str" + drone.getBattery().getBattVolt() + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_alt_key)) {
    message.append("String_Node_Str" + (int)(drone.getAltitude().getAltitude()) + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_airspeed_key)) {
    message.append("String_Node_Str" + (int)(drone.getSpeed().getAirSpeed().valueInMetersPerSecond()) + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_rssi_key)) {
    message.append("String_Node_Str" + (int)drone.getRadio().getRssi() + "String_Node_Str");
  }
  speak(message.toString());
}

Fixed version (ground truth):
private void speakPeriodic(Drone drone){
  if (mIsPeriodicStatusStarted.compareAndSet(false,true)) {
    final SparseBooleanArray speechPrefs=mAppPrefs.getPeriodicSpeechPrefs();
    mMessageBuilder.setLength(0);
    if (speechPrefs.get(R.string.pref_tts_periodic_bat_volt_key)) {
      mMessageBuilder.append(String.format("String_Node_Str",drone.getBattery().getBattVolt()));
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_alt_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)(drone.getAltitude().getAltitude()) + "String_Node_Str");
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_airspeed_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)(drone.getSpeed().getAirSpeed().valueInMetersPerSecond()) + "String_Node_Str");
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_rssi_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)drone.getRadio().getRssi() + "String_Node_Str");
    }
    speak(mMessageBuilder.toString(),true,PERIODIC_STATUS_UTTERANCE_ID);
  }
}
Program: 95142
Project: 95142
Buggy source:
private void speak(String string){
  if (tts != null) {
    if (shouldEnableTTS()) {
      tts.speak(string,TextToSpeech.QUEUE_FLUSH,null);
    }
  }
}

Fixed version (ground truth):
private void speak(String string,boolean append,String utteranceId){
  if (tts != null) {
    if (shouldEnableTTS()) {
      final int queueType=append ? TextToSpeech.QUEUE_ADD : TextToSpeech.QUEUE_FLUSH;
      mTtsParams.clear();
      if (utteranceId != null) {
        mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,utteranceId);
      }
      tts.speak(string,queueType,mTtsParams);
    }
  }
}
Program: 95143
Project: 95143
Buggy source:
@Override protected void openAndroidConnection() throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  ftDev=ftD2xx.openByIndex(mContext,0);
  if (ftDev == null) {
    throw new IOException("String_Node_Str");
  }
  Log.d("String_Node_Str","String_Node_Str" + baud_rate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(baud_rate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void openAndroidConnection() throws IOException {
  D2xxManager ftD2xx=null;
  try {
    ftD2xx=D2xxManager.getInstance(mContext);
  }
 catch (  D2xxManager.D2xxException ex) {
    mLogger.logErr(TAG,ex);
  }
  if (ftD2xx == null) {
    throw new IOException("String_Node_Str");
  }
  int DevCount=ftD2xx.createDeviceInfoList(mContext);
  if (DevCount < 1) {
    throw new IOException("String_Node_Str");
  }
  try {
    ftDev=ftD2xx.openByIndex(mContext,0);
  }
 catch (  NullPointerException e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    if (ftDev == null) {
      throw new IOException("String_Node_Str");
    }
  }
  Log.d("String_Node_Str","String_Node_Str" + baud_rate);
  ftDev.setBitMode((byte)0,D2xxManager.FT_BITMODE_RESET);
  ftDev.setBaudRate(baud_rate);
  ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8,D2xxManager.FT_STOP_BITS_1,D2xxManager.FT_PARITY_NONE);
  ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE,(byte)0x00,(byte)0x00);
  ftDev.setLatencyTimer(LATENCY_TIMER);
  ftDev.purge((byte)(D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
  if (!ftDev.isOpen()) {
    throw new IOException();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
}
Program: 95144
Project: 95144
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (SettingsFragment.ACTION_UPDATED_STATUS_PERIOD.equals(action)) {
    statusInterval=mAppPrefs.getSpokenStatusInterval();
    handler.removeCallbacks(watchdogCallback);
    if (statusInterval != 0) {
      handler.postDelayed(watchdogCallback,statusInterval * 1000);
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (SettingsFragment.ACTION_UPDATED_STATUS_PERIOD.equals(action)) {
    scheduleWatchdog();
  }
}
Program: 95146
Project: 95146
Buggy source:
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      ttsLanguage=tts.getDefaultLanguage();
    }
 else {
      ttsLanguage=tts.getLanguage();
    }
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
if (tts != null) {
LocalBroadcastManager.getInstance(context).registerReceiver(mSpeechIntervalUpdateReceiver,new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}

Fixed version (ground truth):
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      ttsLanguage=tts.getDefaultLanguage();
    }
 else {
      ttsLanguage=tts.getLanguage();
    }
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
if (tts != null) {
tts.setOnUtteranceCompletedListener(mSpeechCompleteListener);
LocalBroadcastManager.getInstance(context).registerReceiver(mSpeechIntervalUpdateReceiver,new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}
Program: 95147
Project: 95147
Buggy source:
private void speakPeriodic(Drone drone){
  final SparseBooleanArray speechPrefs=mAppPrefs.getPeriodicSpeechPrefs();
  final StringBuilder message=new StringBuilder();
  if (speechPrefs.get(R.string.pref_tts_periodic_bat_volt_key)) {
    message.append("String_Node_Str" + drone.getBattery().getBattVolt() + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_alt_key)) {
    message.append("String_Node_Str" + (int)(drone.getAltitude().getAltitude()) + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_airspeed_key)) {
    message.append("String_Node_Str" + (int)(drone.getSpeed().getAirSpeed().valueInMetersPerSecond()) + "String_Node_Str");
  }
  if (speechPrefs.get(R.string.pref_tts_periodic_rssi_key)) {
    message.append("String_Node_Str" + (int)drone.getRadio().getRssi() + "String_Node_Str");
  }
  speak(message.toString());
}

Fixed version (ground truth):
private void speakPeriodic(Drone drone){
  if (mIsPeriodicStatusStarted.compareAndSet(false,true)) {
    final SparseBooleanArray speechPrefs=mAppPrefs.getPeriodicSpeechPrefs();
    mMessageBuilder.setLength(0);
    if (speechPrefs.get(R.string.pref_tts_periodic_bat_volt_key)) {
      mMessageBuilder.append(String.format("String_Node_Str",drone.getBattery().getBattVolt()));
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_alt_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)(drone.getAltitude().getAltitude()) + "String_Node_Str");
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_airspeed_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)(drone.getSpeed().getAirSpeed().valueInMetersPerSecond()) + "String_Node_Str");
    }
    if (speechPrefs.get(R.string.pref_tts_periodic_rssi_key)) {
      mMessageBuilder.append("String_Node_Str" + (int)drone.getRadio().getRssi() + "String_Node_Str");
    }
    speak(mMessageBuilder.toString(),true,PERIODIC_STATUS_UTTERANCE_ID);
  }
}
Program: 95148
Project: 95148
Buggy source:
private void speak(String string){
  if (tts != null) {
    if (shouldEnableTTS()) {
      tts.speak(string,TextToSpeech.QUEUE_FLUSH,null);
    }
  }
}

Fixed version (ground truth):
private void speak(String string,boolean append,String utteranceId){
  if (tts != null) {
    if (shouldEnableTTS()) {
      final int queueType=append ? TextToSpeech.QUEUE_ADD : TextToSpeech.QUEUE_FLUSH;
      mTtsParams.clear();
      if (utteranceId != null) {
        mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,utteranceId);
      }
      tts.speak(string,queueType,mTtsParams);
    }
  }
}
Program: 95149
Project: 95149
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MISSION_UPDATE:
    update();
  break;
case GPS:
mMapFragment.updateMarker(graphicDrone);
mMapFragment.updateDroneLeashPath(guided);
if (drone.getGps().isPositionValid()) {
mMapFragment.addFlightPathPoint(drone.getGps().getPosition());
}
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided);
mMapFragment.updateDroneLeashPath(guided);
break;
case HEARTBEAT_RESTORED:
case HEARTBEAT_FIRST:
graphicDrone.setConnectionAlive(true);
mMapFragment.updateMarker(graphicDrone);
break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
graphicDrone.setConnectionAlive(false);
mMapFragment.updateMarker(graphicDrone);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MISSION_UPDATE:
    update();
  break;
case GPS:
mMapFragment.updateMarker(graphicDrone);
mMapFragment.updateDroneLeashPath(guided);
if (drone.getGps().isPositionValid()) {
mMapFragment.addFlightPathPoint(drone.getGps().getPosition());
}
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided);
mMapFragment.updateDroneLeashPath(guided);
break;
case HEARTBEAT_RESTORED:
case HEARTBEAT_FIRST:
mMapFragment.updateMarker(graphicDrone);
break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
mMapFragment.updateMarker(graphicDrone);
break;
default :
break;
}
}
Program: 95150
Project: 95150
Buggy source:
@Override public Bitmap getIcon(Resources res){
  if (isConnectionAlive) {
    return BitmapFactory.decodeResource(res,R.drawable.quad);
  }
  return BitmapFactory.decodeResource(res,R.drawable.quad_disconnect);
}

Fixed version (ground truth):
@Override public Bitmap getIcon(Resources res){
  if (drone.isConnectionAlive()) {
    return BitmapFactory.decodeResource(res,R.drawable.quad);
  }
  return BitmapFactory.decodeResource(res,R.drawable.quad_disconnect);
}
Program: 95151
Project: 95151
Buggy source:
/** 
 * Toggle the current state of the MAVlink connection. Starting and closing the as needed. May throw a onConnect or onDisconnect callback
 */
private void connectMAVConnection(){
  String connectionType=mAppPrefs.getMavLinkConnectionType();
  Utils.ConnectionType connType=Utils.ConnectionType.valueOf(connectionType);
  if (mavConnection == null || mavConnection.getConnectionType() != connType.getConnectionType()) {
    mavConnection=connType.getConnection(this);
  }
  if (mavConnection.getConnectionStatus() == MavLinkConnection.MAVLINK_DISCONNECTED) {
    mavConnection.connect();
  }
  GAUtils.sendEvent(new HitBuilders.EventBuilder().setCategory(GAUtils.Category.MAVLINK_CONNECTION.toString()).setAction("String_Node_Str" + connectionType));
}

Fixed version (ground truth):
/** 
 * Toggle the current state of the MAVlink connection. Starting and closing the as needed. May throw a onConnect or onDisconnect callback
 */
private void connectMAVConnection(){
  String connectionType=mAppPrefs.getMavLinkConnectionType();
  Utils.ConnectionType connType=Utils.ConnectionType.valueOf(connectionType);
  if (mavConnection == null || mavConnection.getConnectionType() != connType.getConnectionType()) {
    mavConnection=connType.getConnection(this);
    mavConnection.addMavLinkConnectionListener(LOG_TAG,this);
  }
  if (mavConnection.getConnectionStatus() == MavLinkConnection.MAVLINK_DISCONNECTED) {
    mavConnection.connect();
  }
  GAUtils.sendEvent(new HitBuilders.EventBuilder().setCategory(GAUtils.Category.MAVLINK_CONNECTION.toString()).setAction("String_Node_Str" + connectionType));
}
Program: 95152
Project: 95152
Buggy source:
/** 
 * Adds a listener to the mavlink connection.
 * @param listener
 */
public void addMavLinkConnectionListener(MavLinkConnectionListener listener){
  mListeners.add(listener);
}

Fixed version (ground truth):
/** 
 * Adds a listener to the mavlink connection.
 * @param listener
 * @param tag Listener tag
 */
public void addMavLinkConnectionListener(String tag,MavLinkConnectionListener listener){
  mListeners.put(tag,listener);
}
Program: 95153
Project: 95153
Buggy source:
/** 
 * Utility method to notify the mavlink listeners about communication errors.
 * @param errMsg
 */
private void reportComError(String errMsg){
  for (  MavLinkConnectionListener listener : mListeners) {
    listener.onComError(errMsg);
  }
}

Fixed version (ground truth):
/** 
 * Utility method to notify the mavlink listeners about communication errors.
 * @param errMsg
 */
private void reportComError(String errMsg){
  if (mListeners.isEmpty())   return;
  for (  MavLinkConnectionListener listener : mListeners.values()) {
    listener.onComError(errMsg);
  }
}
Program: 95154
Project: 95154
Buggy source:
/** 
 * Utility method to notify the mavlink listeners about a successful connection.
 */
private void reportConnect(){
  for (  MavLinkConnectionListener listener : mListeners) {
    listener.onConnect();
  }
}

Fixed version (ground truth):
/** 
 * Utility method to notify the mavlink listeners about a successful connection.
 */
private void reportConnect(){
  for (  MavLinkConnectionListener listener : mListeners.values()) {
    listener.onConnect();
  }
}
Program: 95155
Project: 95155
Buggy source:
/** 
 * Utility method to notify the mavlink listeners about received messages.
 * @param msg received mavlink message
 */
private void reportReceivedMessage(MAVLinkMessage msg){
  for (  MavLinkConnectionListener listener : mListeners) {
    listener.onReceiveMessage(msg);
  }
}

Fixed version (ground truth):
/** 
 * Utility method to notify the mavlink listeners about received messages.
 * @param msg received mavlink message
 */
private void reportReceivedMessage(MAVLinkMessage msg){
  if (mListeners.isEmpty())   return;
  for (  MavLinkConnectionListener listener : mListeners.values()) {
    listener.onReceiveMessage(msg);
  }
}
Program: 95156
Project: 95156
Buggy source:
/** 
 * Utility method to notify the mavlink listeners about a connection disconnect.
 */
private void reportDisconnect(){
  for (  MavLinkConnectionListener listener : mListeners) {
    listener.onDisconnect();
  }
}

Fixed version (ground truth):
/** 
 * Utility method to notify the mavlink listeners about a connection disconnect.
 */
private void reportDisconnect(){
  if (mListeners.isEmpty())   return;
  for (  MavLinkConnectionListener listener : mListeners.values()) {
    listener.onDisconnect();
  }
}
Program: 95157
Project: 95157
Buggy source:
/** 
 * Removes the specified listener.
 * @param listener
 */
public void removeMavLinkConnectionListener(MavLinkConnectionListener listener){
  mListeners.remove(listener);
}

Fixed version (ground truth):
/** 
 * Removes the specified listener.
 * @param tag Listener tag
 */
public void removeMavLinkConnectionListener(String tag){
  mListeners.remove(tag);
}
Program: 95158
Project: 95158
Buggy source:
private void getTCPStream() throws IOException {
  InetAddress serverAddr=InetAddress.getByName(serverIP);
  socket=new Socket(serverAddr,serverPort);
  mavOut=new BufferedOutputStream((socket.getOutputStream()));
  mavIn=new BufferedInputStream(socket.getInputStream());
}

Fixed version (ground truth):
private void getTCPStream() throws IOException {
  InetAddress serverAddr=InetAddress.getByName(serverIP);
  socket=new Socket();
  socket.connect(new InetSocketAddress(serverAddr,serverPort),5000);
  mavOut=new BufferedOutputStream((socket.getOutputStream()));
  mavIn=new BufferedInputStream(socket.getInputStream());
}
Program: 95159
Project: 95159
Buggy source:
public void run(){
  handler.removeCallbacks(watchdogCallback);
  speakPeriodic(drone);
  if (statusInterval != 0) {
    handler.postDelayed(watchdogCallback,statusInterval * 1000);
  }
}

Fixed version (ground truth):
public void run(){
  handler.removeCallbacks(watchdogCallback);
  if (drone != null && drone.getMavClient().isConnected()) {
    speakPeriodic(drone);
  }
  if (statusInterval != 0) {
    handler.postDelayed(watchdogCallback,statusInterval * 1000);
  }
}
Program: 95160
Project: 95160
Buggy source:
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MISSION_UPDATE:
    update();
  break;
case GPS:
mMapFragment.updateMarker(graphicDrone);
mMapFragment.updateDroneLeashPath(guided);
if (drone.getGps().isPositionValid()) {
mMapFragment.addFlightPathPoint(drone.getGps().getPosition());
}
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided);
mMapFragment.updateDroneLeashPath(guided);
break;
case HEARTBEAT_RESTORED:
case HEARTBEAT_FIRST:
graphicDrone.setConnectionAlive(true);
mMapFragment.updateMarker(graphicDrone);
break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
graphicDrone.setConnectionAlive(false);
mMapFragment.updateMarker(graphicDrone);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneEventsType event,Drone drone){
switch (event) {
case MISSION_UPDATE:
    update();
  break;
case GPS:
mMapFragment.updateMarker(graphicDrone);
mMapFragment.updateDroneLeashPath(guided);
if (drone.getGps().isPositionValid()) {
mMapFragment.addFlightPathPoint(drone.getGps().getPosition());
}
break;
case GUIDEDPOINT:
mMapFragment.updateMarker(guided);
mMapFragment.updateDroneLeashPath(guided);
break;
case HEARTBEAT_RESTORED:
case HEARTBEAT_FIRST:
graphicDrone.setConnectionAlive(true);
if (graphicDrone.isValid()) {
mMapFragment.updateMarker(graphicDrone);
}
break;
case DISCONNECTED:
case HEARTBEAT_TIMEOUT:
graphicDrone.setConnectionAlive(false);
if (graphicDrone.isValid()) {
mMapFragment.updateMarker(graphicDrone);
}
break;
default :
break;
}
}
Program: 95161
Project: 95161
Buggy source:
@Override public void updateMarker(MarkerInfo markerInfo,boolean isDraggable){
  final LatLng position=DroneHelper.CoordToLatLang(markerInfo.getPosition());
  Marker marker=mMarkers.get(markerInfo);
  if (marker == null) {
    marker=mMap.addMarker(new MarkerOptions().position(position));
    mMarkers.put(markerInfo,marker);
  }
  final Bitmap markerIcon=markerInfo.getIcon(getResources());
  if (markerIcon != null) {
    marker.setIcon(BitmapDescriptorFactory.fromBitmap(markerIcon));
  }
  marker.setAlpha(markerInfo.getAlpha());
  marker.setAnchor(markerInfo.getAnchorU(),markerInfo.getAnchorV());
  marker.setInfoWindowAnchor(markerInfo.getInfoWindowAnchorU(),markerInfo.getInfoWindowAnchorV());
  marker.setPosition(position);
  marker.setRotation(markerInfo.getRotation());
  marker.setSnippet(markerInfo.getSnippet());
  marker.setTitle(markerInfo.getTitle());
  marker.setDraggable(isDraggable);
  marker.setFlat(markerInfo.isFlat());
  marker.setVisible(markerInfo.isVisible());
}

Fixed version (ground truth):
@Override public void updateMarker(MarkerInfo markerInfo,boolean isDraggable){
  final Coord2D coord=markerInfo.getPosition();
  if (coord == null) {
    return;
  }
  final LatLng position=DroneHelper.CoordToLatLang(coord);
  Marker marker=mMarkers.get(markerInfo);
  if (marker == null) {
    marker=mMap.addMarker(new MarkerOptions().position(position));
    mMarkers.put(markerInfo,marker);
  }
  final Bitmap markerIcon=markerInfo.getIcon(getResources());
  if (markerIcon != null) {
    marker.setIcon(BitmapDescriptorFactory.fromBitmap(markerIcon));
  }
  marker.setAlpha(markerInfo.getAlpha());
  marker.setAnchor(markerInfo.getAnchorU(),markerInfo.getAnchorV());
  marker.setInfoWindowAnchor(markerInfo.getInfoWindowAnchorU(),markerInfo.getInfoWindowAnchorV());
  marker.setPosition(position);
  marker.setRotation(markerInfo.getRotation());
  marker.setSnippet(markerInfo.getSnippet());
  marker.setTitle(markerInfo.getTitle());
  marker.setDraggable(isDraggable);
  marker.setFlat(markerInfo.isFlat());
  marker.setVisible(markerInfo.isVisible());
}
Program: 95162
Project: 95162
Buggy source:
@Override protected final void closeConnection() throws IOException {
  socket.close();
}

Fixed version (ground truth):
@Override protected final void closeConnection() throws IOException {
  if (socket != null)   socket.close();
}
Program: 95163
Project: 95163
Buggy source:
@Override protected final void closeConnection() throws IOException {
  socket.close();
}

Fixed version (ground truth):
@Override protected final void closeConnection() throws IOException {
  if (socket != null)   socket.close();
}
Program: 95164
Project: 95164
Buggy source:
private void setupPeriodicControls(){
  final PreferenceCategory periodicSpeechPrefs=(PreferenceCategory)findPreference(getActivity().getApplicationContext().getString(R.string.pref_tts_periodic_key));
  int val=Integer.parseInt(((ListPreference)periodicSpeechPrefs.getPreference(0)).getValue());
  for (int i=1; i < periodicSpeechPrefs.getPreferenceCount(); i++) {
    periodicSpeechPrefs.getPreference(i).setEnabled(val != 0);
  }
}

Fixed version (ground truth):
private void setupPeriodicControls(){
  final PreferenceCategory periodicSpeechPrefs=(PreferenceCategory)findPreference(getActivity().getApplicationContext().getString(R.string.pref_tts_periodic_key));
  ListPreference periodic=((ListPreference)periodicSpeechPrefs.getPreference(0));
  int val=Integer.parseInt(periodic.getValue());
  if (val != 0) {
    periodic.setSummary("String_Node_Str" + val + "String_Node_Str");
  }
 else {
    periodic.setSummary("String_Node_Str");
  }
  for (int i=1; i < periodicSpeechPrefs.getPreferenceCount(); i++) {
    periodicSpeechPrefs.getPreference(i).setEnabled(val != 0);
  }
}
Program: 95165
Project: 95165
Buggy source:
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  final Preference preference=findPreference(key);
  if (preference == null) {
    return;
  }
  if (mDefaultSummaryPrefs.contains(key)) {
    preference.setSummary(sharedPreferences.getString(key,"String_Node_Str"));
  }
  if (key.equals(getString(R.string.pref_max_flight_path_size_key))) {
    preference.setSummary(sharedPreferences.getString(key,"String_Node_Str") + "String_Node_Str" + getString(R.string.set_to_zero_to_disable));
  }
  DroidPlannerApp droidPlannerApp=(DroidPlannerApp)getActivity().getApplication();
  if (key.equals(getString(R.string.pref_vehicle_type_key))) {
    droidPlannerApp.getDrone().events.notifyDroneEvent(DroneEventsType.TYPE);
  }
  if (key.equals(getString(R.string.pref_rc_mode_key))) {
    if (sharedPreferences.getString(key,"String_Node_Str").equalsIgnoreCase("String_Node_Str")) {
      preference.setSummary(R.string.mode1_throttle_on_right_stick);
    }
 else {
      preference.setSummary(R.string.mode2_throttle_on_left_stick);
    }
  }
  if (key.equals(getString(R.string.pref_tts_periodic_period_key))) {
    droidPlannerApp.getDrone().events.notifyDroneEvent(DroneEventsType.PERIODIC_SPEECH);
    setupPeriodicControls();
    int val=Integer.parseInt(sharedPreferences.getString(getString(R.string.pref_tts_periodic_period_key),null));
    droidPlannerApp.mNotificationHandler.getTtsNotification().setupPeriodicSpeechOutput(val,droidPlannerApp.getDrone());
  }
}

Fixed version (ground truth):
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key){
  final Preference preference=findPreference(key);
  if (preference == null) {
    return;
  }
  if (mDefaultSummaryPrefs.contains(key)) {
    preference.setSummary(sharedPreferences.getString(key,"String_Node_Str"));
  }
  if (key.equals(getString(R.string.pref_max_flight_path_size_key))) {
    preference.setSummary(sharedPreferences.getString(key,"String_Node_Str") + "String_Node_Str" + getString(R.string.set_to_zero_to_disable));
  }
  DroidPlannerApp droidPlannerApp=(DroidPlannerApp)getActivity().getApplication();
  if (key.equals(getString(R.string.pref_vehicle_type_key))) {
    droidPlannerApp.getDrone().events.notifyDroneEvent(DroneEventsType.TYPE);
  }
  if (key.equals(getString(R.string.pref_rc_mode_key))) {
    if (sharedPreferences.getString(key,"String_Node_Str").equalsIgnoreCase("String_Node_Str")) {
      preference.setSummary(R.string.mode1_throttle_on_right_stick);
    }
 else {
      preference.setSummary(R.string.mode2_throttle_on_left_stick);
    }
  }
  if (key.equals(getString(R.string.pref_tts_periodic_period_key))) {
    setupPeriodicControls();
    int val=Integer.parseInt(sharedPreferences.getString(getString(R.string.pref_tts_periodic_period_key),null));
    if (droidPlannerApp.getDrone().MavClient.isConnected()) {
      droidPlannerApp.mNotificationHandler.getTtsNotification().setupPeriodicSpeechOutput(val,droidPlannerApp.getDrone());
    }
  }
}
Program: 95168
Project: 95168
Buggy source:
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  setDrone(drone);
  boolean updateExtra=true;
switch (event) {
case BATTERY:
    if (mBatteryInfo != null)     mBatteryInfo.updateItemView(mContext,mDrone);
  break;
case CONNECTED:
updateInfoBar();
updateExtra=false;
break;
case DISCONNECTED:
setDrone(null);
updateInfoBar();
updateExtra=false;
break;
case GPS_FIX:
case GPS_COUNT:
if (mGpsInfo != null) mGpsInfo.updateItemView(mContext,mDrone);
break;
case HOME:
if (mHomeInfo != null) mHomeInfo.updateItemView(mContext,mDrone);
break;
case RADIO:
if (mSignalInfo != null) mSignalInfo.updateItemView(mContext,mDrone);
break;
case STATE:
if (mFlightTimeInfo != null) mFlightTimeInfo.updateItemView(mContext,mDrone);
break;
case MODE:
case TYPE:
if (mFlightModesInfo != null) mFlightModesInfo.updateItemView(mContext,mDrone);
break;
default :
updateExtra=false;
break;
}
if (mPhoneExtraInfo != null && updateExtra) {
mPhoneExtraInfo.updateItemView(mContext,mDrone);
}
}

Fixed version (ground truth):
@Override public void onDroneEvent(DroneInterfaces.DroneEventsType event,Drone drone){
  setDrone(drone);
  boolean updateExtra=true;
switch (event) {
case BATTERY:
    if (mBatteryInfo != null)     mBatteryInfo.updateItemView(mContext,mDrone);
  break;
case CONNECTED:
updateInfoBar();
updateExtra=false;
break;
case DISCONNECTED:
setDrone(null);
updateInfoBar();
updateExtra=false;
break;
case GPS_FIX:
case GPS_COUNT:
if (mGpsInfo != null) mGpsInfo.updateItemView(mContext,mDrone);
break;
case GPS:
case HOME:
if (mHomeInfo != null) mHomeInfo.updateItemView(mContext,mDrone);
break;
case RADIO:
if (mSignalInfo != null) mSignalInfo.updateItemView(mContext,mDrone);
break;
case STATE:
if (mFlightTimeInfo != null) mFlightTimeInfo.updateItemView(mContext,mDrone);
break;
case MODE:
case TYPE:
if (mFlightModesInfo != null) mFlightModesInfo.updateItemView(mContext,mDrone);
break;
default :
updateExtra=false;
break;
}
if (mPhoneExtraInfo != null && updateExtra) {
mPhoneExtraInfo.updateItemView(mContext,mDrone);
}
}
Program: 95169
Project: 95169
Buggy source:
@Override public void onLongPressMap(MapView pMapView,ILatLng pPosition){
  if (mMapLongClickListener != null) {
    mMapLongClickListener.onMapLongClick(DroneHelper.ILatLngToCoord(pPosition));
  }
}

Fixed version (ground truth):
@Override public void onLongPressMap(MapView pMapView,final ILatLng pPosition){
  if (mMapLongClickListener != null) {
    mMapLongClickListener.onMapLongClick(DroneHelper.ILatLngToCoord(pPosition));
  }
}
Program: 95170
Project: 95170
Buggy source:
@Override public void onTapMap(MapView pMapView,ILatLng pPosition){
  if (mMapClickListener != null) {
    mMapClickListener.onMapClick(DroneHelper.ILatLngToCoord(pPosition));
  }
}

Fixed version (ground truth):
@Override public void onTapMap(MapView pMapView,final ILatLng pPosition){
  if (mMapClickListener != null) {
    mMapClickListener.onMapClick(DroneHelper.ILatLngToCoord(pPosition));
  }
}
Program: 95171
Project: 95171
Buggy source:
private void setupMap(){
  final Context context=getActivity().getApplicationContext();
  mMapView.setMapViewListener(new MapViewListener(){
    @Override public void onShowMarker(    MapView pMapView,    Marker pMarker){
    }
    @Override public void onHidemarker(    MapView pMapView,    Marker pMarker){
    }
    @Override public void onTapMarker(    MapView pMapView,    Marker pMarker){
      if (mMarkerClickListener != null) {
        mMarkerClickListener.onMarkerClick(getMarkerInfo(pMarker));
      }
    }
    @Override public void onLongPressMarker(    MapView pMapView,    Marker pMarker){
    }
    @Override public void onTapMap(    MapView pMapView,    ILatLng pPosition){
      if (mMapClickListener != null) {
        mMapClickListener.onMapClick(DroneHelper.ILatLngToCoord(pPosition));
      }
    }
    @Override public void onLongPressMap(    MapView pMapView,    ILatLng pPosition){
      if (mMapLongClickListener != null) {
        mMapLongClickListener.onMapLongClick(DroneHelper.ILatLngToCoord(pPosition));
      }
    }
  }
);
}

Fixed version (ground truth):
private void setupMap(){
  mMapView.setMapViewListener(mMapViewListener);
  resetMarkersOverlay();
}
Program: 95172
Project: 95172
Buggy source:
@Override public void updateMarker(MarkerInfo markerInfo,boolean isDraggable){
  final LatLng position=DroneHelper.CoordToLatLng(markerInfo.getPosition());
  Marker marker=mMarkers.get(markerInfo);
  if (marker == null) {
    marker=new Marker(mMapView,markerInfo.getTitle(),markerInfo.getSnippet(),position);
    mMapView.addMarker(marker);
    mMarkers.put(markerInfo,marker);
  }
 else {
    marker.setTitle(markerInfo.getTitle());
    marker.setDescription(markerInfo.getSnippet());
    marker.setPoint(position);
  }
  final Resources res=getResources();
  final Bitmap markerIcon=markerInfo.getIcon(res);
  if (markerIcon != null) {
    marker.setIcon(new Icon(new BitmapDrawable(res,markerIcon)));
  }
  marker.setAnchor(new PointF(markerInfo.getAnchorU(),markerInfo.getAnchorV()));
}

Fixed version (ground truth):
@Override public void updateMarker(MarkerInfo markerInfo,boolean isDraggable){
  final LatLng position=DroneHelper.CoordToLatLng(markerInfo.getPosition());
  Marker marker=mMarkers.get(markerInfo);
  if (marker == null) {
    marker=new Marker(mMapView,markerInfo.getTitle(),markerInfo.getSnippet(),position);
    mMarkersOverlay.addItem(marker);
    mMarkers.put(markerInfo,marker);
  }
 else {
    marker.setTitle(markerInfo.getTitle());
    marker.setDescription(markerInfo.getSnippet());
    marker.setPoint(position);
  }
  final Resources res=getResources();
  final Bitmap markerIcon=markerInfo.getIcon(res);
  if (markerIcon != null) {
    marker.setIcon(new Icon(new BitmapDrawable(res,markerIcon)));
  }
  marker.setAnchor(new PointF(markerInfo.getAnchorU(),markerInfo.getAnchorV()));
  marker.invalidate();
  mMapView.invalidate();
}
Program: 95173
Project: 95173
Buggy source:
@Override public void saveCameraPosition(){
  SharedPreferences.Editor editor=mPrefs.prefs.edit();
  final ILatLng mapCenter=mMapView.getCenter();
  editor.putFloat(PREF_LAT,(float)mapCenter.getLatitude()).putFloat(PREF_LNG,(float)mapCenter.getLongitude()).putFloat(PREF_BEA,mMapView.getRotation()).putInt(PREF_ZOOM,(int)mMapView.getZoomLevel()).apply();
}

Fixed version (ground truth):
@Override public void saveCameraPosition(){
  SharedPreferences.Editor editor=mPrefs.prefs.edit();
  final ILatLng mapCenter=mMapView.getCenter();
  editor.putFloat(PREF_LAT,(float)mapCenter.getLatitude()).putFloat(PREF_LNG,(float)mapCenter.getLongitude()).putFloat(PREF_BEA,mMapView.getRotation()).putFloat(PREF_ZOOM,mMapView.getZoomLevel()).apply();
}
Program: 95174
Project: 95174
Buggy source:
@Override public void cleanMarkers(){
  for (  Map.Entry<MarkerInfo,Marker> entry : mMarkers.entrySet()) {
    Marker marker=entry.getValue();
    mMapView.removeMarker(marker);
  }
  mMarkers.clear();
}

Fixed version (ground truth):
@Override public void cleanMarkers(){
  resetMarkersOverlay();
  mMarkers.clear();
  mMapView.invalidate();
}
Program: 95175
Project: 95175
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  final Activity activity=getActivity();
  mDrone=((DroidPlannerApp)activity.getApplication()).getDrone();
  mPrefs=new DroidPlannerPrefs(getActivity().getApplicationContext());
  mMapView=(MapView)view.findViewById(R.id.mapbox_mapview);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  final Activity activity=getActivity();
  mDrone=((DroidPlannerApp)activity.getApplication()).getDrone();
  mPrefs=new DroidPlannerPrefs(activity.getApplicationContext());
  mMapView=(MapView)view.findViewById(R.id.mapbox_mapview);
}
Program: 95176
Project: 95176
Buggy source:
@Override public void onTapMarker(MapView pMapView,Marker pMarker){
  if (mMarkerClickListener != null) {
    mMarkerClickListener.onMarkerClick(getMarkerInfo(pMarker));
  }
}

Fixed version (ground truth):
@Override public void onTapMarker(MapView pMapView,final Marker pMarker){
  if (mMarkerClickListener != null) {
    mMarkerClickListener.onMarkerClick(getMarkerInfo(pMarker));
  }
}
Program: 95177
Project: 95177
Buggy source:
@Override public void loadCameraPosition(){
  final float centerLat=mPrefs.prefs.getFloat(PREF_LAT,0);
  final float centerLng=mPrefs.prefs.getFloat(PREF_LNG,0);
  mMapView.setCenter(new LatLng(centerLat,centerLng));
  final int zoom=mPrefs.prefs.getInt(PREF_ZOOM,0);
  mMapView.setZoom(zoom);
  final float rotation=mPrefs.prefs.getFloat(PREF_BEA,0);
  mMapView.setRotation(rotation);
}

Fixed version (ground truth):
@Override public void loadCameraPosition(){
  final float centerLat=mPrefs.prefs.getFloat(PREF_LAT,0);
  final float centerLng=mPrefs.prefs.getFloat(PREF_LNG,0);
  mMapView.setCenter(new LatLng(centerLat,centerLng));
  final float zoom=mPrefs.prefs.getFloat(PREF_ZOOM,0);
  mMapView.setZoom(zoom);
  final float rotation=mPrefs.prefs.getFloat(PREF_BEA,0);
  mMapView.setRotation(rotation);
}
Program: 95178
Project: 95178
Buggy source:
private void addTab(CharSequence text,int index){
  final TabView tabView=new TabView(getContext());
  tabView.mIndex=index;
  tabView.setFocusable(true);
  tabView.setOnClickListener(mTabClickListener);
  tabView.setText(text);
  mTabLayout.addView(tabView,new LinearLayout.LayoutParams(0,FILL_PARENT,1));
}

Fixed version (ground truth):
private void addTab(CharSequence text,int index){
  final TabView tabView=new TabView(getContext());
  tabView.mIndex=index;
  tabView.setFocusable(true);
  tabView.setOnClickListener(mTabClickListener);
  tabView.setText(text);
  mTabLayout.addView(tabView,new LinearLayout.LayoutParams(0,ViewGroup.LayoutParams.MATCH_PARENT,1));
}
Program: 95179
Project: 95179
Buggy source:
public TabPageIndicator(Context context,AttributeSet attrs){
  super(context,attrs);
  setHorizontalScrollBarEnabled(false);
  mTabLayout=new LinearLayout(getContext());
  addView(mTabLayout,new ViewGroup.LayoutParams(WRAP_CONTENT,FILL_PARENT));
}

Fixed version (ground truth):
public TabPageIndicator(Context context,AttributeSet attrs){
  super(context,attrs);
  setHorizontalScrollBarEnabled(false);
  mTabLayout=new LinearLayout(getContext());
  addView(mTabLayout,new ViewGroup.LayoutParams(WRAP_CONTENT,ViewGroup.LayoutParams.MATCH_PARENT));
}
Program: 95180
Project: 95180
Buggy source:
@Override public void onInit(int status){
  tts.setLanguage(Locale.US);
}

Fixed version (ground truth):
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
      ttsLanguage=tts.getDefaultLanguage();
    }
 else {
      ttsLanguage=tts.getLanguage();
    }
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}
Program: 95181
Project: 95181
Buggy source:
@Override public void onInit(int status){
  tts.setLanguage(Locale.US);
}

Fixed version (ground truth):
@Override public void onInit(int status){
  if (status == TextToSpeech.SUCCESS) {
    Locale ttsLanguage=tts.getDefaultLanguage();
    if (ttsLanguage == null) {
      ttsLanguage=Locale.US;
    }
    int supportStatus=tts.setLanguage(ttsLanguage);
switch (supportStatus) {
case TextToSpeech.LANG_MISSING_DATA:
case TextToSpeech.LANG_NOT_SUPPORTED:
      tts.shutdown();
    tts=null;
  Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
break;
}
}
 else {
Log.e(TAG,"String_Node_Str");
Toast.makeText(context,"String_Node_Str" + "String_Node_Str",Toast.LENGTH_LONG).show();
}
}