nus-yam/ex-repair huggingface dataset:
Program: 162033
Project: 162033
Buggy source:
public Player(LevelHandler level,int x,int y,InputHandler input,String userName,int shirtCol,int faceCol){
  super(level,"String_Node_Str",x,y,speed,collisionBoders);
  this.input=input;
  this.userName=userName;
  this.faceCol=faceCol;
  this.shirtCol=shirtCol;
  this.colour=Colours.get(-1,111,shirtCol,faceCol);
  fireRate=Small.FIRE_RATE;
  nameOffset=(userName.length() / 2) * fontCharSize - ((userName.length() & 1) == 0 ? fontCharSize / 2 : 0);
}

Fixed version (ground truth):
public Player(LevelHandler level,int x,int y,InputHandler input,String userName,int shirtCol,int faceCol){
  super(level,"String_Node_Str",x,y,speed,collisionBoders);
  this.input=input;
  this.userName=userName;
  this.faceCol=faceCol;
  this.shirtCol=shirtCol;
  this.colour=Colours.get(-1,111,shirtCol,faceCol);
  fireRate=Small.FIRE_RATE;
}
Program: 162034
Project: 162034
Buggy source:
public String getSanitisedUsername(){
  if (this.getUsername() == null || this.userName.isEmpty()) {
    setUsername(guestPlayerName);
    return guestPlayerName;
  }
 else   return this.getUsername();
}

Fixed version (ground truth):
public String getSanitisedUsername(){
  if (this.getUsername() == null || this.userName.isEmpty()) {
    setUsername(guestPlayerName);
    int offsetUnit=((userName.length() & 1) == 0 ? fontCharSize / 2 : 0);
    nameOffset=(userName.length() / 2) * fontCharSize - offsetUnit;
    return guestPlayerName;
  }
 else   return this.getUsername();
}
Program: 162035
Project: 162035
Buggy source:
public String getSanitisedUsername(){
  if (this.getUsername() == null || this.userName.isEmpty()) {
    setUsername(guestPlayerName);
    int offsetUnit=((userName.length() & 1) == 0 ? fontCharSize / 2 : 0);
    nameOffset=(userName.length() / 2) * fontCharSize - offsetUnit;
    return guestPlayerName;
  }
 else   return this.getUsername();
}

Fixed version (ground truth):
public String getSanitisedUsername(){
  if (this.getUsername() == null || this.userName.isEmpty()) {
    setUsername(guestPlayerName);
    int offsetUnit=((userName.length() & 1) == 0 ? fontCharSize / 2 : 0);
    nameOffset=(userName.length() / 2) * fontCharSize - offsetUnit;
    return guestPlayerName;
  }
 else   if (nameOffset == 0) {
    int offsetUnit=((userName.length() & 1) == 0 ? fontCharSize / 2 : 0);
    nameOffset=(userName.length() / 2) * fontCharSize - offsetUnit;
  }
  return this.getUsername();
}
Program: 162040
Project: 162040
Buggy source:
public void untoggle(boolean toggle){
  this.untoggle=toggle;
}

Fixed version (ground truth):
public void untoggle(boolean toggle){
  this.ignoreInput=toggle;
}
Program: 162041
Project: 162041
Buggy source:
public void tick(){
  double xa=0;
  double ya=0;
  if (input != null) {
    if (input.getUp().isPressed()) {
      ya-=speed;
    }
    if (input.getDown().isPressed()) {
      ya+=speed;
    }
    if (input.getLeft().isPressed()) {
      xa-=speed;
    }
    if (input.getRight().isPressed()) {
      xa+=speed;
    }
  }
  if (xa != 0 || ya != 0) {
    move(xa,ya);
    isMoving=true;
    Packet02Move packet=new Packet02Move(this.getUsername(),(int)this.getX(),(int)this.getY(),this.numSteps,this.isMoving,this.movingDir);
    Game.getGame();
    packet.writeData(Game.getSocketClient());
  }
 else {
    isMoving=false;
  }
  setSwim(new Swim(level,(int)getX(),(int)getY()));
  swimType=getSwim().swimming(isSwimming,isMagma,isMuddy);
  isSwimming=swimType[0];
  isMagma=swimType[1];
  isMuddy=swimType[2];
  if (level.getTile((int)this.getX() >> 3,(int)this.getY() >> 3).getId() == 11) {
    changeLevels=true;
  }
  tickCount++;
}

Fixed version (ground truth):
public void tick(){
  double xa=0;
  double ya=0;
  if (input != null) {
    if (input.getUp().isPressed() && input.isIgnoreInput() == false) {
      ya-=speed;
    }
    if (input.getDown().isPressed() && input.isIgnoreInput() == false) {
      ya+=speed;
    }
    if (input.getLeft().isPressed() && input.isIgnoreInput() == false) {
      xa-=speed;
    }
    if (input.getRight().isPressed() && input.isIgnoreInput() == false) {
      xa+=speed;
    }
  }
  if (xa != 0 || ya != 0) {
    move(xa,ya);
    isMoving=true;
    Packet02Move packet=new Packet02Move(this.getUsername(),(int)this.getX(),(int)this.getY(),this.numSteps,this.isMoving,this.movingDir);
    Game.getGame();
    packet.writeData(Game.getSocketClient());
  }
 else {
    isMoving=false;
  }
  setSwim(new Swim(level,(int)getX(),(int)getY()));
  swimType=getSwim().swimming(isSwimming,isMagma,isMuddy);
  isSwimming=swimType[0];
  isMagma=swimType[1];
  isMuddy=swimType[2];
  if (level.getTile((int)this.getX() >> 3,(int)this.getY() >> 3).getId() == 11) {
    changeLevels=true;
  }
  tickCount++;
}
Program: 162043
Project: 162043
Buggy source:
public boolean hasCollided(double xa,double ya){
  int xMin=0;
  int xMax=7;
  int yMin=3;
  int yMax=7;
  for (int x=xMin; x < xMax; x++) {
    if (isSolid((int)xa,(int)ya,x,yMin)) {
      return true;
    }
  }
  for (int x=xMin; x < xMax; x++) {
    if (isSolid((int)xa,(int)ya,x,yMax)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid((int)xa,(int)ya,xMin,y)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid((int)xa,(int)ya,xMax,y)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasCollided(double xa,double ya){
  int xMin=-2;
  int xMax=8;
  int yMin=0;
  int yMax=7;
  for (int x=xMin; x < xMax; x++) {
    if (isSolid((int)xa,(int)ya,x,yMin)) {
      return true;
    }
  }
  for (int x=xMin; x < xMax; x++) {
    if (isSolid((int)xa,(int)ya,x,yMax)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid((int)xa,(int)ya,xMin,y)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid((int)xa,(int)ya,xMax,y)) {
      return true;
    }
  }
  return false;
}
Program: 162044
Project: 162044
Buggy source:
protected void aStarMovementAI(int x,int y,int px,int py,double xa,double ya,double speed,Mob mob,List<Node> path,int time){
  xa=0;
  ya=0;
  Vector2i start=new Vector2i(x >> 3,y >> 3);
  Vector2i goal=new Vector2i(px >> 3,py >> 3);
  path=level.findPath(start,goal);
  if (path != null) {
    if (path.size() > 0) {
      Vector2i vector=path.get(path.size() - 1).tile;
      if (x < vector.getX() << 3)       xa++;
      if (x > vector.getX() << 3)       xa--;
      if (y < vector.getY() << 3)       ya++;
      if (y > vector.getY() << 3)       ya--;
    }
  }
  moveMob(xa,ya,mob);
}

Fixed version (ground truth):
protected void aStarMovementAI(int x,int y,int px,int py,double xa,double ya,double speed,Mob mob,List<Node> path,int time){
  xa=0;
  ya=0;
  Vector2i start=new Vector2i(x >> 3,y >> 3);
  Vector2i goal=new Vector2i(px >> 3,py >> 3);
  path=level.findPath(start,goal);
  if (path != null) {
    if (path.size() > 0) {
      Vector2i vector=path.get(path.size() - 1).tile;
      if (x < vector.getX() << 3)       xa=+speed;
      if (x > vector.getX() << 3)       xa=-speed;
      if (y < vector.getY() << 3)       ya=+speed;
      if (y > vector.getY() << 3)       ya=-speed;
      moveMob(xa,ya,mob);
    }
  }
}
Program: 162045
Project: 162045
Buggy source:
public void tick(){
  List<Player> players=level.getPlayers(this,10);
  if (players.size() > 0) {
    followMovementAI(getX(),getY(),Game.getPlayer().getX(),Game.getPlayer().getY(),xa,ya,this);
  }
  setSwim(new Swim(level,getX(),getY()));
  swimType=getSwim().swimming(isSwimming,isMagma,isMuddy);
  isSwimming=swimType[0];
  isMagma=swimType[1];
  isMuddy=swimType[2];
  tickCount++;
}

Fixed version (ground truth):
public void tick(){
  List<Player> players=level.getPlayers(this,10);
  if (players.size() > 0) {
    followMovementAI(getX(),getY(),Game.getPlayer().getX(),Game.getPlayer().getY(),xa,ya,this);
  }
 else {
    isMoving=false;
  }
  setSwim(new Swim(level,getX(),getY()));
  swimType=getSwim().swimming(isSwimming,isMagma,isMuddy);
  isSwimming=swimType[0];
  isMagma=swimType[1];
  isMuddy=swimType[2];
  tickCount++;
}
Program: 162047
Project: 162047
Buggy source:
public void move(int xa,int ya){
  if (xa != 0 && ya != 0) {
    move(xa,0);
    move(0,ya);
    numSteps--;
    return;
  }
  numSteps++;
  if (!hasCollided(xa,ya)) {
    if (ya < 0) {
      movingDir=0;
    }
    if (ya > 0) {
      movingDir=1;
    }
    if (xa < 0) {
      movingDir=2;
    }
    if (xa > 0) {
      movingDir=3;
    }
    setX(getX() + xa * (int)speed);
    setY(getY() + ya * (int)speed);
  }
}

Fixed version (ground truth):
public void move(int xa,int ya){
  if (xa != 0 && ya != 0) {
    move(xa,0);
    move(0,ya);
    numSteps--;
    return;
  }
  numSteps++;
  if (ya < 0) {
    movingDir=0;
  }
  if (ya > 0) {
    movingDir=1;
  }
  if (xa < 0) {
    movingDir=2;
  }
  if (xa > 0) {
    movingDir=3;
  }
  if (!hasCollided(xa,ya)) {
    setX(getX() + xa * (int)speed);
    setY(getY() + ya * (int)speed);
  }
}
Program: 162048
Project: 162048
Buggy source:
public abstract boolean hasCollided(int xa,int ya);

Fixed version (ground truth):
public boolean hasCollided(int xa,int ya){
  int xMin=0;
  int xMax=7;
  int yMin=3;
  int yMax=7;
  for (int x=xMin; x < xMax; x++) {
    if (isSolid(xa,ya,x,yMin)) {
      return true;
    }
  }
  for (int x=xMin; x < xMax; x++) {
    if (isSolid(xa,ya,x,yMax)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid(xa,ya,xMin,y)) {
      return true;
    }
  }
  for (int y=yMin; y < yMax; y++) {
    if (isSolid(xa,ya,xMax,y)) {
      return true;
    }
  }
  return false;
}
Program: 162050
Project: 162050
Buggy source:
private void handleLogin(Packet00Login packet,InetAddress address,int port){
  System.out.println("String_Node_Str" + address.getHostAddress() + "String_Node_Str"+ port+ "String_Node_Str"+ packet.getUsername()+ "String_Node_Str");
  PlayerMP player=new PlayerMP(game.level,packet.getX(),packet.getY(),packet.getUsername(),address,port);
  game.level.addEntity(player);
}

Fixed version (ground truth):
private void handleLogin(Packet00Login packet,InetAddress address,int port){
  System.out.println("String_Node_Str" + address.getHostAddress() + "String_Node_Str"+ port+ "String_Node_Str"+ packet.getUsername()+ "String_Node_Str");
  PlayerMP player=new PlayerMP(game.getLevel(),packet.getX(),packet.getY(),packet.getUsername(),address,port);
  game.getLevel().addEntity(player);
}
Program: 162051
Project: 162051
Buggy source:
private void handleMove(Packet02Move packet){
}

Fixed version (ground truth):
private void handleMove(Packet02Move packet){
  this.game.getLevel().movePlayer(packet.getUsername(),packet.getX(),packet.getY());
}
Program: 162052
Project: 162052
Buggy source:
@Override public byte[] getData(){
  return ("String_Node_Str" + this.username + "String_Node_Str"+ this.x+ "String_Node_Str"+ this.y).getBytes();
}

Fixed version (ground truth):
@Override public byte[] getData(){
  return ("String_Node_Str" + this.username + "String_Node_Str"+ getX()+ "String_Node_Str"+ getY()).getBytes();
}
Program: 162053
Project: 162053
Buggy source:
@Override public byte[] getData(){
  return ("String_Node_Str" + this.username + "String_Node_Str"+ this.x+ "String_Node_Str"+ this.y).getBytes();
}

Fixed version (ground truth):
@Override public byte[] getData(){
  return ("String_Node_Str" + this.username + "String_Node_Str"+ getX()+ "String_Node_Str"+ getY()).getBytes();
}
Program: 162055
Project: 162055
Buggy source:
public void onReceive(Context context,Intent intent){
  CV.logv("String_Node_Str");
  if (CV.getPrefAutoOnoff(context)) {
    CV.logv("String_Node_Str");
    Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
    i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_TOGGLE);
    i.putExtra(CV.SERVICETYPE,CV.SERVICETYPE_SETTING);
    context.startService(i);
  }
 else   if (CV.getPrefChargingOn(context) && CV.isPlugged(context)) {
    Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
    i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_TURNON);
    i.putExtra(CV.SERVICETYPE,CV.SERVICETYPE_CHARGING);
    context.startService(i);
  }
}

Fixed version (ground truth):
public void onReceive(Context context,Intent intent){
  CV.logv("String_Node_Str");
  if (CV.getPrefAutoOnoff(context)) {
    CV.logv("String_Node_Str");
    Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
    i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_TOGGLE);
    i.putExtra(CV.SERVICETYPE,CV.SERVICETYPE_SETTING);
    context.startService(i);
    if (CV.getPrefSleeping(context)) {
      Intent j=new Intent(CV.SERVICE_INTENT_ACTION);
      j.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_SET_SCHEDULE);
      context.startService(j);
    }
  }
 else   if (CV.getPrefChargingOn(context) && CV.isPlugged(context)) {
    Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
    i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_TURNON);
    i.putExtra(CV.SERVICETYPE,CV.SERVICETYPE_CHARGING);
    context.startService(i);
  }
}
Program: 162056
Project: 162056
Buggy source:
private void setSchedule(){
  cancelSchedule();
  int hour=TimePreference.getHour(CV.getPrefSleepStart(this));
  int minute=TimePreference.getMinute(CV.getPrefSleepStart(this));
  Calendar calendar=Calendar.getInstance();
  calendar.set(Calendar.HOUR_OF_DAY,hour);
  calendar.set(Calendar.MINUTE,minute);
  calendar.set(Calendar.SECOND,0);
  Intent intent=new Intent(this,SensorMonitorService.class);
  intent.setData(Uri.parse("String_Node_Str"));
  intent.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_MODE_SLEEP);
  intent.putExtra(CV.SLEEP_MODE_START,true);
  PendingIntent pi=PendingIntent.getService(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  getAlarmManager().setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),AlarmManager.INTERVAL_DAY,pi);
  hour=TimePreference.getHour(CV.getPrefSleepStop(this));
  minute=TimePreference.getMinute(CV.getPrefSleepStop(this));
  calendar.set(Calendar.HOUR_OF_DAY,hour);
  calendar.set(Calendar.MINUTE,minute);
  intent=new Intent(this,SensorMonitorService.class);
  intent.setData(Uri.parse("String_Node_Str"));
  intent.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_MODE_SLEEP);
  intent.putExtra(CV.SLEEP_MODE_START,false);
  pi=PendingIntent.getService(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  getAlarmManager().setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),AlarmManager.INTERVAL_DAY,pi);
}

Fixed version (ground truth):
private void setSchedule(){
  Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
  i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_SET_SCHEDULE);
  startService(i);
}
Program: 162057
Project: 162057
Buggy source:
private void cancelSchedule(){
  Intent intent=new Intent(this,SensorMonitorService.class);
  intent.setData(Uri.parse("String_Node_Str"));
  PendingIntent pi=PendingIntent.getService(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  getAlarmManager().cancel(pi);
  intent.setData(Uri.parse("String_Node_Str"));
  pi=PendingIntent.getService(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  getAlarmManager().cancel(pi);
}

Fixed version (ground truth):
private void cancelSchedule(){
  Intent i=new Intent(CV.SERVICE_INTENT_ACTION);
  i.putExtra(CV.SERVICEACTION,CV.SERVICEACTION_CANCEL_SCHEDULE);
  startService(i);
}
Program: 162059
Project: 162059
Buggy source:
@SuppressLint("String_Node_Str") @Override public final void onSensorChanged(SensorEvent event){
  int type=event.sensor.getType();
  if (type == Sensor.TYPE_PROXIMITY) {
    float lux=event.values[0];
    CV.logv("String_Node_Str",lux);
    if (isActiveAdmin()) {
      if (handler.hasMessages(CALLBACK_EXISTS)) {
        CV.logv("String_Node_Str");
        resetHandler();
        return;
      }
      if (lux == 0f) {
        if (mPowerManager.isScreenOn()) {
          if (CV.getPrefDisableInLandscape(this) && isOrientationLandscape()) {
            return;
          }
 else {
            long timeout=(long)CV.getPrefTimeoutLock(this);
            if (timeout == 0)             TurnOff();
 else             handler.postDelayed(runnableTurnOff,timeout);
          }
        }
      }
 else {
        if (!mPowerManager.isScreenOn()) {
          long timeout=(long)CV.getPrefTimeoutUnlock(this);
          if (timeout == 0)           TurnOn();
 else           handler.postDelayed(runnableTurnOn,timeout);
        }
      }
    }
  }
 else   if (type == Sensor.TYPE_LIGHT) {
    float lux=event.values[0];
    CV.logv("String_Node_Str",lux);
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public final void onSensorChanged(SensorEvent event){
  int type=event.sensor.getType();
  if (type == Sensor.TYPE_PROXIMITY) {
    float lux=event.values[0];
    CV.logv("String_Node_Str",lux);
    if (isActiveAdmin()) {
      if (handler.hasMessages(CALLBACK_EXISTS)) {
        CV.logv("String_Node_Str");
        resetHandler();
        return;
      }
      if (lux == 0f) {
        if (mPowerManager.isScreenOn()) {
          if (CV.getPrefDisableInLandscape(this) && isOrientationLandscape()) {
            return;
          }
 else {
            long timeout=(long)CV.getPrefTimeoutLock(this);
            if (timeout == 0)             turnOff();
 else             handler.postDelayed(runnableTurnOff,timeout);
          }
        }
      }
 else {
        if (!mPowerManager.isScreenOn()) {
          long timeout=(long)CV.getPrefTimeoutUnlock(this);
          if (timeout == 0)           turnOn();
 else           handler.postDelayed(runnableTurnOn,timeout);
        }
      }
    }
  }
 else   if (type == Sensor.TYPE_LIGHT) {
    float lux=event.values[0];
    CV.logv("String_Node_Str",lux);
  }
}
Program: 162060
Project: 162060
Buggy source:
public void run(){
  try {
    Thread.sleep(1000);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  screenLock.release();
}

Fixed version (ground truth):
@Override public void run(){
  CV.logi("String_Node_Str");
  turnOn();
  resetHandler();
}
Program: 162061
Project: 162061
Buggy source:
private void updatePrefState(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  CheckBoxPreference cbpLandscape=(CheckBoxPreference)findPreference(CV.PREF_DISABLE_IN_LANDSCAPE);
  SwitchPreference spCharging=(SwitchPreference)findPreference(CV.PREF_CHARGING_ON);
  SwitchPreference spAuto=(SwitchPreference)findPreference(CV.PREF_AUTO_ON);
  if (sp.getBoolean(CV.PREF_AUTO_ON,false)) {
    spCharging.setEnabled(false);
    cbpLandscape.setEnabled(true);
  }
 else {
    spCharging.setEnabled(true);
  }
  if (sp.getBoolean(CV.PREF_CHARGING_ON,false)) {
    spAuto.setEnabled(false);
    cbpLandscape.setEnabled(true);
  }
 else {
    spAuto.setEnabled(true);
  }
  if (sp.getBoolean(CV.PREF_AUTO_ON,false) == false && sp.getBoolean(CV.PREF_CHARGING_ON,false) == false) {
    cbpLandscape.setEnabled(false);
  }
}

Fixed version (ground truth):
private void updatePrefState(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  SwitchPreference spCharging=(SwitchPreference)findPreference(CV.PREF_CHARGING_ON);
  SwitchPreference spAuto=(SwitchPreference)findPreference(CV.PREF_AUTO_ON);
  if (sp.getBoolean(CV.PREF_AUTO_ON,false)) {
    spAuto.setEnabled(false);
    spCharging.setEnabled(false);
  }
 else {
    spCharging.setEnabled(true);
  }
  if (sp.getBoolean(CV.PREF_CHARGING_ON,false)) {
    spCharging.setEnabled(true);
    spAuto.setEnabled(false);
  }
 else {
    spAuto.setEnabled(true);
  }
}
Program: 162062
Project: 162062
Buggy source:
private void togglePreference(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  boolean IsAutoOn=sp.getBoolean(CV.PREF_AUTO_ON,false);
  Editor editor=sp.edit();
  editor.putBoolean(CV.PREF_AUTO_ON,!IsAutoOn);
  editor.commit();
}

Fixed version (ground truth):
private void togglePreference(){
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  boolean IsAutoOn=sp.getBoolean(CV.PREF_AUTO_ON,false);
  Editor editor=sp.edit();
  editor.putBoolean(CV.PREF_AUTO_ON,!IsAutoOn);
  if (!IsAutoOn)   editor.putBoolean(CV.PREF_CHARGING_ON,false);
  editor.commit();
}
Program: 162063
Project: 162063
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  CV.logi("String_Node_Str");
  if (intent == null) {
    CV.logi("String_Node_Str");
    if (CV.getPrefAutoOnoff(this) == false) {
      unregisterSensor();
    }
 else {
      registerSensor();
    }
    return START_STICKY;
  }
  int action=intent.getIntExtra(CV.SERVICEACTION,-1);
switch (action) {
case CV.SERVICEACTION_TOGGLE:
{
      CV.logi("String_Node_Str");
      if (!intent.getStringExtra(CV.SERVICETYPE).equals(CV.SERVICETYPE_SETTING)) {
        togglePreference();
      }
      updateWidgetCharging(false);
      if (CV.getPrefAutoOnoff(this) == false) {
        unregisterSensor();
      }
 else {
        registerSensor();
      }
      break;
    }
case CV.SERVICEACTION_TURNON:
{
    CV.logi("String_Node_Str");
    if (!isRegistered()) {
      registerSensor();
      updateWidgetCharging(CV.isPlugged(this));
    }
    break;
  }
case CV.SERVICEACTION_TURNOFF:
{
  CV.logi("String_Node_Str");
  if (isRegistered())   unregisterSensor();
  if (!CV.getPrefAutoOnoff(this))   updateWidgetCharging(false);
  break;
}
case CV.SERVICEACTION_UPDATE_DISABLE_IN_LANDSCAPE:
{
if (mIsRegistered) {
  if (CV.getPrefDisableInLandscape(this) == true)   registerOrientationChange();
 else   unregisterOrientationChange();
}
break;
}
default :
CV.logi("String_Node_Str");
}
return START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  CV.logi("String_Node_Str");
  if (intent == null) {
    CV.logi("String_Node_Str");
    if (CV.getPrefAutoOnoff(this) == false) {
      unregisterSensor();
    }
 else {
      registerSensor();
    }
    return START_STICKY;
  }
  int action=intent.getIntExtra(CV.SERVICEACTION,-1);
switch (action) {
case CV.SERVICEACTION_TOGGLE:
{
      CV.logi("String_Node_Str");
      if (!intent.getStringExtra(CV.SERVICETYPE).equals(CV.SERVICETYPE_SETTING)) {
        if (CV.isPlugged(this) && CV.getPrefChargingOn(this)) {
          SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
          Editor editor=sp.edit();
          editor.putBoolean(CV.PREF_CHARGING_ON,false);
          editor.commit();
        }
 else {
          togglePreference();
        }
      }
      updateWidgetCharging(false);
      if (CV.getPrefAutoOnoff(this) == false) {
        unregisterSensor();
      }
 else {
        registerSensor();
      }
      break;
    }
case CV.SERVICEACTION_TURNON:
{
    CV.logi("String_Node_Str");
    if (!isRegistered()) {
      registerSensor();
      updateWidgetCharging(CV.isPlugged(this));
    }
    break;
  }
case CV.SERVICEACTION_TURNOFF:
{
  CV.logi("String_Node_Str");
  if (isRegistered())   unregisterSensor();
  if (!CV.getPrefAutoOnoff(this))   updateWidgetCharging(false);
  break;
}
case CV.SERVICEACTION_UPDATE_DISABLE_IN_LANDSCAPE:
{
if (mIsRegistered) {
  if (CV.getPrefDisableInLandscape(this) == true)   registerOrientationChange();
 else   unregisterOrientationChange();
}
break;
}
default :
CV.logi("String_Node_Str");
}
return START_STICKY;
}
Program: 162064
Project: 162064
Buggy source:
public static boolean isPlugged(Context context){
  Intent intentBat=context.registerReceiver(null,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  return (intentBat.getIntExtra(BatteryManager.EXTRA_PLUGGED,-1) > 0);
}

Fixed version (ground truth):
public static boolean isPlugged(Context context){
  Intent intentBat=context.getApplicationContext().registerReceiver(null,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  return (intentBat.getIntExtra(BatteryManager.EXTRA_PLUGGED,-1) > 0);
}
Program: 162065
Project: 162065
Buggy source:
public void load(final Listener listener,final SnapshotService.Callback callback){
  SnapshotService snapshotService=new SnapshotService(rpc);
  snapshotService.load(id,demuxer.getAccessToken(),sessionId,true,new SnapshotService.Callback(){
    @Override public void onSuccess(    JsonValue snapshot,    String sid,    int revision){
      bridge=listener;
      callback.onSuccess(snapshot,sessionId,revision);
      demuxer.register(id,bridge,(ReceiveOpChannelImpl<?>)receiveChannel);
      channel.connect(revision,sessionId);
      PollChannel.get().connect();
    }
  }
);
}

Fixed version (ground truth):
public void load(final Listener listener,final SnapshotService.Callback callback){
  SnapshotService snapshotService=new SnapshotService(rpc);
  snapshotService.load(id,demuxer.getAccessToken(),sessionId,true,new SnapshotService.Callback(){
    @Override public void onSuccess(    JsonValue snapshot,    String sid,    int revision){
      bridge=listener;
      demuxer.register(id,bridge,(ReceiveOpChannelImpl<?>)receiveChannel);
      callback.onSuccess(snapshot,sessionId,revision);
      channel.connect(revision,sessionId);
      PollChannel.get().connect();
    }
  }
);
}
Program: 162066
Project: 162066
Buggy source:
@Override public void onSuccess(JsonValue snapshot,String sid,int revision){
  bridge=listener;
  callback.onSuccess(snapshot,sessionId,revision);
  demuxer.register(id,bridge,(ReceiveOpChannelImpl<?>)receiveChannel);
  channel.connect(revision,sessionId);
  PollChannel.get().connect();
}

Fixed version (ground truth):
@Override public void onSuccess(JsonValue snapshot,String sid,int revision){
  bridge=listener;
  demuxer.register(id,bridge,(ReceiveOpChannelImpl<?>)receiveChannel);
  callback.onSuccess(snapshot,sessionId,revision);
  channel.connect(revision,sessionId);
  PollChannel.get().connect();
}
Program: 162068
Project: 162068
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_agency,container,false);
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  agencyListView=(ListView)rootView.findViewById(R.id.lvAgencyList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  agencyListView.setVisibility(View.INVISIBLE);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,null,AGENCY);
  client.agencies().observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateAgencyListView,e -> {
    handleServiceErrors(getActivity(),AGENCY,e,progressBar);
  }
);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_agency,container,false);
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  agencyListView=(ListView)rootView.findViewById(R.id.lvAgencyList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  agencyListView.setVisibility(View.INVISIBLE);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,null,AGENCY);
  agenciesSub=client.agencies().observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateAgencyListView,e -> {
    handleServiceErrors(getActivity(),AGENCY,e,progressBar);
  }
);
  return rootView;
}
Program: 162069
Project: 162069
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_route,container,false);
  Bundle args=getArguments();
  if (args != null && args.containsKey("String_Node_Str")) {
    atw=(ArrivalTimeWidget)args.getSerializable("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  routeListView=(ListView)rootView.findViewById(R.id.lvRouteList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,atw.getAgencyID(),ROUTE);
  client.routes(atw.getAgencyID()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateRoutesListView,e -> handleServiceErrors(getActivity(),ROUTE,e,progressBar));
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_route,container,false);
  Bundle args=getArguments();
  if (args != null && args.containsKey("String_Node_Str")) {
    atw=(ArrivalTimeWidget)args.getSerializable("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  routeListView=(ListView)rootView.findViewById(R.id.lvRouteList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,atw.getAgencyID(),ROUTE);
  routesSub=client.routes(atw.getAgencyID()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateRoutesListView,e -> handleServiceErrors(getActivity(),ROUTE,e,progressBar));
  return rootView;
}
Program: 162070
Project: 162070
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_stop,container,false);
  Bundle args=getArguments();
  if (args != null && args.containsKey("String_Node_Str")) {
    atw=(ArrivalTimeWidget)args.getSerializable("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  stopListView=(ListView)rootView.findViewById(R.id.lvStopList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,atw.getAgencyID(),STOP);
  client.stops(atw.getAgencyID()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateStopsListView,e -> handleServiceErrors(getActivity(),STOP,e,progressBar));
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View rootView=inflater.inflate(R.layout.fragment_add_stop,container,false);
  Bundle args=getArguments();
  if (args != null && args.containsKey("String_Node_Str")) {
    atw=(ArrivalTimeWidget)args.getSerializable("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  setHasOptionsMenu(true);
  getActivity().setTitle("String_Node_Str");
  stopListView=(ListView)rootView.findViewById(R.id.lvStopList);
  progressBar=(ProgressBar)getActivity().findViewById(R.id.pbLoading);
  progressBar.setVisibility(View.VISIBLE);
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,TRANSLOC_API_KEY,atw.getAgencyID(),STOP);
  stopsSub=client.stops(atw.getAgencyID()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::populateStopsListView,e -> handleServiceErrors(getActivity(),STOP,e,progressBar));
  return rootView;
}
Program: 162071
Project: 162071
Buggy source:
@Override public void onFragmentInteraction(String id){
  Toast.makeText(getApplicationContext(),id,Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
@Override public void onFragmentInteraction(ArrivalTimeWidget atw){
  Log.d(TAG,"String_Node_Str");
  TransLocClient client=ServiceGenerator.createService(TransLocClient.class,Utils.BASE_URL,getString(R.string.mashape_key),atw.getAgencyID(),ARRIVAL);
  client.arrivalEstimates(atw.getAgencyID(),atw.getRouteID(),atw.getStopID()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::createWidget,e -> Log.e(TAG,"String_Node_Str",e));
}
Program: 162072
Project: 162072
Buggy source:
@Override public void onFragmentInteraction(String id){
  Toast.makeText(getApplicationContext(),"String_Node_Str" + id,Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
@Override public void onFragmentInteraction(ArrivalTimeWidget widget){
  Toast.makeText(getApplicationContext(),"String_Node_Str" + widget.toString(),Toast.LENGTH_LONG).show();
}
Program: 162073
Project: 162073
Buggy source:
@Override public void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  if (null != mListener) {
    ArrivalTimeWidget widget=(ArrivalTimeWidget)l.getItemAtPosition(position);
    if (widget == null)     throw new IllegalStateException();
 else {
      Log.d(TAG,widget.toString());
      mListener.onFragmentInteraction(widget.getArrivalTimesUrl());
    }
  }
}

Fixed version (ground truth):
@Override public void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  if (null != mListener) {
    ArrivalTimeWidget widget=(ArrivalTimeWidget)l.getItemAtPosition(position);
    if (widget == null)     throw new IllegalStateException();
 else {
      Log.d(TAG,widget.toString());
      mListener.onFragmentInteraction(widget);
    }
  }
}
Program: 162074
Project: 162074
Buggy source:
public void onFragmentInteraction(String id);

Fixed version (ground truth):
public void onFragmentInteraction(ArrivalTimeWidget widget);
Program: 162075
Project: 162075
Buggy source:
public T read(JsonReader in) throws IOException {
  JsonElement jsonElement=elementAdapter.read(in);
  if (jsonElement.isJsonObject()) {
    JsonObject jsonObject=jsonElement.getAsJsonObject();
    if (jsonObject.has("String_Node_Str") && (jsonObject.get("String_Node_Str").isJsonArray()) || jsonObject.get("String_Node_Str").isJsonArray()) {
switch (dataType) {
case AGENCY:
        Log.d(TAG,"String_Node_Str");
      jsonElement=jsonObject.get("String_Node_Str");
    break;
case ROUTE:
  Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonObject("String_Node_Str").getAsJsonArray(agencyId);
break;
case STOP:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.get("String_Node_Str");
break;
case ARRIVAL:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonArray("String_Node_Str").getAsJsonObject().getAsJsonArray("String_Node_Str");
break;
}
}
}
return delegate.fromJsonTree(jsonElement);
}

Fixed version (ground truth):
public T read(JsonReader in) throws IOException {
  JsonElement jsonElement=elementAdapter.read(in);
  if (jsonElement.isJsonObject()) {
    JsonObject jsonObject=jsonElement.getAsJsonObject();
    if (jsonObject.has("String_Node_Str") && (jsonObject.get("String_Node_Str").isJsonArray()) || jsonObject.get("String_Node_Str").isJsonArray()) {
switch (dataType) {
case AGENCY:
        Log.d(TAG,"String_Node_Str");
      jsonElement=jsonObject.get("String_Node_Str");
    break;
case ROUTE:
  Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonObject("String_Node_Str").getAsJsonArray(agencyId);
break;
case STOP:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.get("String_Node_Str");
break;
case ARRIVAL:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonArray("String_Node_Str").get(0).getAsJsonObject().getAsJsonArray("String_Node_Str");
break;
}
}
 else {
Log.e(TAG,"String_Node_Str");
}
}
return delegate.fromJsonTree(jsonElement);
}
Program: 162076
Project: 162076
Buggy source:
public <T>TypeAdapter<T> create(Gson gson,final TypeToken<T> type){
  final TypeAdapter<T> delegate=gson.getDelegateAdapter(this,type);
  final TypeAdapter<JsonElement> elementAdapter=gson.getAdapter(JsonElement.class);
  return new TypeAdapter<T>(){
    public void write(    JsonWriter out,    T value) throws IOException {
      delegate.write(out,value);
    }
    public T read(    JsonReader in) throws IOException {
      JsonElement jsonElement=elementAdapter.read(in);
      if (jsonElement.isJsonObject()) {
        JsonObject jsonObject=jsonElement.getAsJsonObject();
        if (jsonObject.has("String_Node_Str") && (jsonObject.get("String_Node_Str").isJsonArray()) || jsonObject.get("String_Node_Str").isJsonArray()) {
switch (dataType) {
case AGENCY:
            Log.d(TAG,"String_Node_Str");
          jsonElement=jsonObject.get("String_Node_Str");
        break;
case ROUTE:
      Log.d(TAG,"String_Node_Str");
    jsonElement=jsonObject.getAsJsonObject("String_Node_Str").getAsJsonArray(agencyId);
  break;
case STOP:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.get("String_Node_Str");
break;
case ARRIVAL:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonArray("String_Node_Str").getAsJsonObject().getAsJsonArray("String_Node_Str");
break;
}
}
}
return delegate.fromJsonTree(jsonElement);
}
}
.nullSafe();
}

Fixed version (ground truth):
public <T>TypeAdapter<T> create(Gson gson,final TypeToken<T> type){
  final TypeAdapter<T> delegate=gson.getDelegateAdapter(this,type);
  final TypeAdapter<JsonElement> elementAdapter=gson.getAdapter(JsonElement.class);
  return new TypeAdapter<T>(){
    public void write(    JsonWriter out,    T value) throws IOException {
      delegate.write(out,value);
    }
    public T read(    JsonReader in) throws IOException {
      JsonElement jsonElement=elementAdapter.read(in);
      if (jsonElement.isJsonObject()) {
        JsonObject jsonObject=jsonElement.getAsJsonObject();
        if (jsonObject.has("String_Node_Str") && (jsonObject.get("String_Node_Str").isJsonArray()) || jsonObject.get("String_Node_Str").isJsonArray()) {
switch (dataType) {
case AGENCY:
            Log.d(TAG,"String_Node_Str");
          jsonElement=jsonObject.get("String_Node_Str");
        break;
case ROUTE:
      Log.d(TAG,"String_Node_Str");
    jsonElement=jsonObject.getAsJsonObject("String_Node_Str").getAsJsonArray(agencyId);
  break;
case STOP:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.get("String_Node_Str");
break;
case ARRIVAL:
Log.d(TAG,"String_Node_Str");
jsonElement=jsonObject.getAsJsonArray("String_Node_Str").get(0).getAsJsonObject().getAsJsonArray("String_Node_Str");
break;
}
}
 else {
Log.e(TAG,"String_Node_Str");
}
}
return delegate.fromJsonTree(jsonElement);
}
}
.nullSafe();
}
Program: 162078
Project: 162078
Buggy source:
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  Log.v("String_Node_Str","String_Node_Str");
  dialog.dismiss();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  dialog.dismiss();
}
Program: 162079
Project: 162079
Buggy source:
@Override protected void onPause(){
  super.onPause();
  if (dialog != null)   dialog.dismiss();
  dialog=null;
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
}
Program: 162080
Project: 162080
Buggy source:
@Override protected void onResume(){
  super.onResume();
  int textColor=settings.getInt("String_Node_Str",-1);
  int backgroundColor=settings.getInt("String_Node_Str",1996554497);
  editor.putInt("String_Node_Str" + mAppWidgetId,textColor).commit();
  editor.putInt("String_Node_Str" + mAppWidgetId,backgroundColor).commit();
  Log.v(TAG,Integer.toString(settings.getInt("String_Node_Str" + mAppWidgetId,-2)));
  Log.v(TAG,Integer.toString(settings.getInt("String_Node_Str" + mAppWidgetId,-2)));
  rlPreview.setBackgroundColor(backgroundColor);
  tvStopPreview.setTextColor(textColor);
  tvRoutePreview.setTextColor(textColor);
  tvRemainingTimePreview.setTextColor(textColor);
  tvMinsPreview.setTextColor(textColor);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  int textColor=settings.getInt("String_Node_Str",-1);
  int backgroundColor=settings.getInt("String_Node_Str",1996554497);
  editor.putInt("String_Node_Str" + mAppWidgetId,textColor).commit();
  editor.putInt("String_Node_Str" + mAppWidgetId,backgroundColor).commit();
  rlPreview.setBackgroundColor(backgroundColor);
  tvStopPreview.setTextColor(textColor);
  tvRoutePreview.setTextColor(textColor);
  tvRemainingTimePreview.setTextColor(textColor);
  tvMinsPreview.setTextColor(textColor);
}
Program: 162081
Project: 162081
Buggy source:
private void doErrorMiscHandling(){
  bMakeWidget.setEnabled(false);
  if (dialog != null) {
    dialog.dismiss();
    dialog=null;
  }
}

Fixed version (ground truth):
private void doErrorMiscHandling(){
  bMakeWidget.setEnabled(false);
}
Program: 162083
Project: 162083
Buggy source:
private void doReset(){
  new PopulateAgenciesTask().execute();
}

Fixed version (ground truth):
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}
Program: 162085
Project: 162085
Buggy source:
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  Log.v("String_Node_Str","String_Node_Str");
  dialog.dismiss();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  dialog.dismiss();
}
Program: 162086
Project: 162086
Buggy source:
@Override protected void onPause(){
  super.onPause();
  if (dialog != null)   dialog.dismiss();
  dialog=null;
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
}
Program: 162087
Project: 162087
Buggy source:
@Override protected void onResume(){
  super.onResume();
  int textColor=settings.getInt("String_Node_Str",-1);
  int backgroundColor=settings.getInt("String_Node_Str",1996554497);
  editor.putInt("String_Node_Str" + mAppWidgetId,textColor).commit();
  editor.putInt("String_Node_Str" + mAppWidgetId,backgroundColor).commit();
  Log.v(TAG,Integer.toString(settings.getInt("String_Node_Str" + mAppWidgetId,-2)));
  Log.v(TAG,Integer.toString(settings.getInt("String_Node_Str" + mAppWidgetId,-2)));
  rlPreview.setBackgroundColor(backgroundColor);
  tvStopPreview.setTextColor(textColor);
  tvRoutePreview.setTextColor(textColor);
  tvRemainingTimePreview.setTextColor(textColor);
  tvMinsPreview.setTextColor(textColor);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  int textColor=settings.getInt("String_Node_Str",-1);
  int backgroundColor=settings.getInt("String_Node_Str",1996554497);
  editor.putInt("String_Node_Str" + mAppWidgetId,textColor).commit();
  editor.putInt("String_Node_Str" + mAppWidgetId,backgroundColor).commit();
  rlPreview.setBackgroundColor(backgroundColor);
  tvStopPreview.setTextColor(textColor);
  tvRoutePreview.setTextColor(textColor);
  tvRemainingTimePreview.setTextColor(textColor);
  tvMinsPreview.setTextColor(textColor);
}
Program: 162088
Project: 162088
Buggy source:
private void doErrorMiscHandling(){
  bMakeWidget.setEnabled(false);
  if (dialog != null) {
    dialog.dismiss();
    dialog=null;
  }
}

Fixed version (ground truth):
private void doErrorMiscHandling(){
  bMakeWidget.setEnabled(false);
}
Program: 162089
Project: 162089
Buggy source:
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  dialog.dismiss();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  Log.v("String_Node_Str","String_Node_Str");
  dialog.dismiss();
}
Program: 162090
Project: 162090
Buggy source:
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}

Fixed version (ground truth):
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
    bMakeWidget.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
    bMakeWidget.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}
Program: 162092
Project: 162092
Buggy source:
private void doReset(){
  new PopulateAgenciesTask().execute();
}

Fixed version (ground truth):
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}
Program: 162093
Project: 162093
Buggy source:
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  dialog.dismiss();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int pos){
  currentStopId=currentRouteStopList.get(pos).stopId;
  stopName=currentRouteStopList.get(pos).name;
  sSelectStop.setText(stopName);
  bMakeWidget.setEnabled(true);
  Log.v("String_Node_Str","String_Node_Str");
  dialog.dismiss();
}
Program: 162094
Project: 162094
Buggy source:
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}

Fixed version (ground truth):
private void doReset(int type){
  if (type <= 2) {
    sSelectStop.setText(R.string.select_stop);
    currentStopId=-1;
    stopName=null;
    sSelectStop.setEnabled(false);
    bMakeWidget.setEnabled(false);
  }
  if (type <= 1) {
    sSelectRoute.setText(R.string.select_route);
    currentRouteId=-1;
    routeShortName=null;
    routeLongName=null;
    sSelectRoute.setEnabled(false);
    bMakeWidget.setEnabled(false);
  }
  if (type == 0) {
    sSelectAgency.setText(R.string.select_agency);
    currentAgencyId=-1;
    bMakeWidget.setEnabled(false);
    new PopulateAgenciesTask().execute();
  }
}