nus-yam/ex-repair huggingface dataset:
Program: 100931
Project: 100931
Buggy source:
@Override public void onStart(){
  super.onStart();
  String description=archiveMeta.getDescription().trim();
  if (description.length() > 0) {
    mDescription.setTextColor(getResources().getColor(R.color.snowhite));
    mDescription.setText(description);
  }
 else {
    mDescription.setTextColor(getResources().getColor(R.color.gray));
    mDescription.setText(getString(R.string.no_description));
  }
  mDescription.setOnClickListener(this);
  addArchiveMetaTimeFragment();
  addArchiveMetaFragment();
  actionBar.setTitle(getString(R.string.title_detail));
  actionBar.removeAllActions();
  actionBar.addAction(new ActionBar.Action(){
    @Override public int getDrawable(){
      return R.drawable.ic_menu_share;
    }
    @Override public void performAction(    View view){
      shareToSina();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  String description=archiveMeta.getDescription().trim();
  if (description.length() > 0) {
    mDescription.setTextColor(getResources().getColor(R.color.snowhite));
    mDescription.setText(description);
  }
 else {
    mDescription.setTextColor(getResources().getColor(R.color.gray));
    mDescription.setText(getString(R.string.no_description));
  }
  mDescription.setOnClickListener(this);
  addArchiveMetaTimeFragment();
  addArchiveMetaFragment();
  actionBar.setTitle(getString(R.string.title_detail));
  actionBar.removeAllActions();
  actionBar.addAction(new ActionBar.Action(){
    @Override public int getDrawable(){
      return R.drawable.ic_menu_view;
    }
    @Override public void performAction(    View view){
      Intent intent=new Intent(context,SpeedCharts.class);
      intent.putExtra(Records.INTENT_ARCHIVE_FILE_NAME,archiveFileName);
      startActivity(intent);
    }
  }
);
  actionBar.addAction(new ActionBar.Action(){
    @Override public int getDrawable(){
      return R.drawable.ic_menu_share;
    }
    @Override public void performAction(    View view){
      shareToSina();
    }
  }
);
}
Program: 100932
Project: 100932
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  layoutView=inflater.inflate(R.layout.archive_meta_items,container,false);
  mDistance=(TextView)layoutView.findViewById(R.id.item_distance);
  mAvgSpeed=(TextView)layoutView.findViewById(R.id.item_avg_speed);
  mMaxSpeed=(TextView)layoutView.findViewById(R.id.item_max_speed);
  mRecords=(TextView)layoutView.findViewById(R.id.item_records);
  mAvgSpeed.setOnClickListener(this);
  mMaxSpeed.setOnClickListener(this);
  return layoutView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  layoutView=inflater.inflate(R.layout.archive_meta_items,container,false);
  mDistance=(TextView)layoutView.findViewById(R.id.item_distance);
  mAvgSpeed=(TextView)layoutView.findViewById(R.id.item_avg_speed);
  mMaxSpeed=(TextView)layoutView.findViewById(R.id.item_max_speed);
  mRecords=(TextView)layoutView.findViewById(R.id.item_records);
  return layoutView;
}
Program: 100933
Project: 100933
Buggy source:
private void updateView(){
  Cursor result=null;
  try {
    result=db.getReadableDatabase().rawQuery("String_Node_Str",null);
  }
 catch (  SQLiteException e) {
    Log.e(TAG,e.getMessage());
  }
  if (result.getCount() <= 0) {
    return;
  }
  double latitude, longitude, speed, bearing, altitude, accuracy;
  String timeStamp;
  result.moveToFirst();
  latitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  longitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  speed=result.getDouble(result.getColumnIndex("String_Node_Str"));
  bearing=result.getDouble(result.getColumnIndex("String_Node_Str"));
  altitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  accuracy=result.getDouble(result.getColumnIndex("String_Node_Str"));
  timeStamp=result.getString(result.getColumnIndex("String_Node_Str"));
  timeStamp=new java.text.SimpleDateFormat("String_Node_Str").format(new java.util.Date(Long.parseLong(timeStamp)));
  String resultString=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",db.getValvedCount(),latitude,longitude,speed,bearing,altitude,accuracy,timeStamp);
  resultString+=String.format("String_Node_Str",new java.text.SimpleDateFormat("String_Node_Str").format(new Date()));
  TextView t=(TextView)findViewById(R.id.status);
  t.setText(resultString);
}

Fixed version (ground truth):
private void updateView(){
  Cursor result=null;
  try {
    result=db.getReadableDatabase().rawQuery("String_Node_Str",null);
  }
 catch (  SQLiteException e) {
    Log.e(TAG,e.getMessage());
  }
  if (result.getCount() <= 0) {
    return;
  }
  double latitude, longitude, speed, bearing, altitude, accuracy;
  String timeStamp;
  result.moveToFirst();
  latitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  longitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  speed=result.getDouble(result.getColumnIndex("String_Node_Str"));
  if (maxSpeed < speed) {
    maxSpeed=speed;
  }
  bearing=result.getDouble(result.getColumnIndex("String_Node_Str"));
  altitude=result.getDouble(result.getColumnIndex("String_Node_Str"));
  accuracy=result.getDouble(result.getColumnIndex("String_Node_Str"));
  timeStamp=result.getString(result.getColumnIndex("String_Node_Str"));
  timeStamp=new java.text.SimpleDateFormat("String_Node_Str").format(new java.util.Date(Long.parseLong(timeStamp)));
  String resultString=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",db.getValvedCount(),latitude,longitude,speed,maxSpeed,bearing,altitude,accuracy,timeStamp);
  resultString+=String.format("String_Node_Str",new java.text.SimpleDateFormat("String_Node_Str").format(new Date()));
  TextView t=(TextView)findViewById(R.id.status);
  t.setText(resultString);
}
Program: 100934
Project: 100934
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  locManager.removeUpdates(locListener);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  locManager.removeUpdates(loc);
}
Program: 100935
Project: 100935
Buggy source:
/** 
 * 绑定 GPS，获得地理位置等信息
 */
public void bindLocationListener(){
  locManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  locListener=new LocationListener(this.getApplicationContext());
  Log.e(TAG,"String_Node_Str");
  locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locListener);
}

Fixed version (ground truth):
/** 
 * 绑定 GPS，获得地理位置等信息
 */
public void bindLocationListener(){
  locManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  loc=new Location(this.getApplicationContext());
  Log.e(TAG,"String_Node_Str");
  locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,loc);
}
Program: 100936
Project: 100936
Buggy source:
public Database(Context context){
  this.context=context;
  helper=new OpenHelper(this.context,context.getString(R.string.app_database_name));
}

Fixed version (ground truth):
public Database(Context context){
  this.context=context;
  this.helper=new OpenHelper(context,getDatabasePath());
}
Program: 100937
Project: 100937
Buggy source:
public long getValvedCount(){
  long count=0;
  Cursor result=null;
  try {
    result=getReadableDatabase().rawQuery("String_Node_Str",null);
    result.moveToFirst();
    count=result.getLong(result.getColumnIndex("String_Node_Str"));
  }
 catch (  SQLiteException e) {
  }
  return count;
}

Fixed version (ground truth):
public long getValvedCount(){
  return getValvedCount(getReadableDatabase());
}
Program: 100938
Project: 100938
Buggy source:
public void close(){
  helper.close();
}

Fixed version (ground truth):
public void close(){
  if (helper != null) {
    helper.close();
  }
}
Program: 100939
Project: 100939
Buggy source:
@Override public void onLocationChanged(android.location.Location loc){
  ContentValues values=new ContentValues();
  DecimalFormat formatter=new DecimalFormat("String_Node_Str");
  String tmpLongitude=formatter.format(loc.getLongitude());
  String tmpLatitude=formatter.format(loc.getLatitude());
  if (tmpLatitude.equals(latitude) && tmpLongitude.equals(longitude)) {
    Log.i(TAG,String.format("String_Node_Str",loc.getLatitude(),loc.getLongitude()));
    return;
  }
  latitude=tmpLatitude;
  longitude=tmpLongitude;
  values.put("String_Node_Str",loc.getLatitude());
  values.put("String_Node_Str",loc.getLongitude());
  values.put("String_Node_Str",loc.getSpeed());
  values.put("String_Node_Str",loc.getBearing());
  values.put("String_Node_Str",loc.getAltitude());
  values.put("String_Node_Str",loc.getAccuracy());
  values.put("String_Node_Str",loc.getTime());
  try {
    db.insert("String_Node_Str",null,values);
    Log.v(TAG,String.format("String_Node_Str",latitude,longitude));
  }
 catch (  SQLException e) {
    Log.e(TAG,e.getMessage());
  }
  lastLocationRecord=loc;
}

Fixed version (ground truth):
@Override public void onLocationChanged(android.location.Location loc){
  ContentValues values=new ContentValues();
  DecimalFormat formatter=new DecimalFormat("String_Node_Str");
  String tmpLongitude=formatter.format(loc.getLongitude());
  String tmpLatitude=formatter.format(loc.getLatitude());
  if (tmpLatitude.equals(latitude) && tmpLongitude.equals(longitude)) {
    Log.v(TAG,String.format("String_Node_Str",loc.getLatitude(),loc.getLongitude()));
    return;
  }
  latitude=tmpLatitude;
  longitude=tmpLongitude;
  values.put("String_Node_Str",loc.getLatitude());
  values.put("String_Node_Str",loc.getLongitude());
  values.put("String_Node_Str",loc.getSpeed());
  values.put("String_Node_Str",loc.getBearing());
  values.put("String_Node_Str",loc.getAltitude());
  values.put("String_Node_Str",loc.getAccuracy());
  values.put("String_Node_Str",loc.getTime());
  try {
    db.insert("String_Node_Str",null,values);
    Log.v(TAG,String.format("String_Node_Str",latitude,longitude));
  }
 catch (  SQLException e) {
    Log.e(TAG,e.getMessage());
  }
  lastLocationRecord=loc;
}
Program: 100940
Project: 100940
Buggy source:
@Override public Response toResponse(Throwable exception){
  String name=exception.getClass().getName();
  if (name.equals("String_Node_Str")) {
    try {
      return (Response)exception.getClass().getMethod("String_Node_Str").invoke(exception);
    }
 catch (    Exception e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    }
  }
  Map<String,String> error=new HashMap<String,String>();
  error.put("String_Node_Str",exception.toString());
  return Response.status(Status.BAD_REQUEST).entity(error).build();
}

Fixed version (ground truth):
@Override public Response toResponse(Throwable exception){
  String name=exception.getClass().getName();
  if (name.equals("String_Node_Str")) {
    try {
      return (Response)exception.getClass().getMethod("String_Node_Str").invoke(exception);
    }
 catch (    Exception e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    }
  }
  exception.printStackTrace();
  Error error=new Error(exception.toString());
  return Response.status(Status.BAD_REQUEST).entity(error).build();
}
Program: 100941
Project: 100941
Buggy source:
public ConsoleState(TIAState tia,PIAState pia,RAMState ram,M6502State cpu,Cartridge cartridge,VideoStandard videoStandard){
  this.tiaState=tia;
  this.piaState=pia;
  this.ramState=ram;
  this.cpuState=cpu;
  this.cartridge=cartridge.clone();
  this.videoStandard=videoStandard;
}

Fixed version (ground truth):
public ConsoleState(TIAState tia,PIAState pia,RAMState ram,M6502State cpu,Cartridge cartridge,VideoStandard videoStandard){
  this.tiaState=tia;
  this.piaState=pia;
  this.ramState=ram;
  this.cpuState=cpu;
  this.cartridge=cartridge != null ? cartridge.clone() : null;
  this.videoStandard=videoStandard;
}
Program: 100942
Project: 100942
Buggy source:
public List<ControlChange> getChangesToSend(){
  List<ControlChange> changesToSend;
synchronized (queuedChanges) {
    if (queuedChanges.isEmpty())     changesToSend=emptyChanges;
 else {
      changesToSend=new ArrayList<ControlChange>(queuedChanges);
      queuedChanges.clear();
    }
  }
  return changesToSend;
}

Fixed version (ground truth):
public List<ControlChange> getChangesToSend(){
  List<ControlChange> changesToSend;
synchronized (queuedChanges) {
    if (queuedChanges.isEmpty())     return null;
 else {
      changesToSend=new ArrayList<ControlChange>(queuedChanges);
      queuedChanges.clear();
      return changesToSend;
    }
  }
}
Program: 100943
Project: 100943
Buggy source:
@Override public void controlStateChanged(Control control,boolean state){
synchronized (queuedChanges) {
    queuedChanges.add(new ControlChange(control,state));
  }
}

Fixed version (ground truth):
@Override public void controlStateChanged(Control control,int position){
synchronized (queuedChanges) {
    queuedChanges.add(new ControlChangeForPaddle(control,position));
  }
}
Program: 100944
Project: 100944
Buggy source:
public void serverControlChanges(List<ControlChange> changes){
  for (  ControlChange change : changes)   super.controlStateChanged(change.control,change.state);
}

Fixed version (ground truth):
public void serverControlChanges(List<ControlChange> changes){
  for (  ControlChange change : changes)   if (change instanceof ControlChangeForPaddle)   super.controlStateChanged(change.control,((ControlChangeForPaddle)change).position);
 else   super.controlStateChanged(change.control,change.state);
}
Program: 100945
Project: 100945
Buggy source:
public void receiveClientControlChanges(List<ControlChange> clientControlChages){
  for (  ControlChange change : clientControlChages)   controlsSocket.controlStateChanged(change.control,change.state);
}

Fixed version (ground truth):
public void receiveClientControlChanges(List<ControlChange> clientControlChages){
  for (  ControlChange change : clientControlChages)   if (change instanceof ControlChangeForPaddle)   controlsSocket.controlStateChanged(change.control,((ControlChangeForPaddle)change).position);
 else   controlsSocket.controlStateChanged(change.control,change.state);
}
Program: 100946
Project: 100946
Buggy source:
@Override public void controlStateChanged(Control control,boolean state){
  if (control == Control.FAST_SPEED || control.isStateControl()) {
    super.controlStateChanged(control,state);
    return;
  }
synchronized (queuedChanges) {
    queuedChanges.add(new ControlChange(control,state));
  }
}

Fixed version (ground truth):
@Override public void controlStateChanged(Control control,int position){
synchronized (queuedChanges) {
    queuedChanges.add(new ControlChangeForPaddle(control,position));
  }
}
Program: 100947
Project: 100947
Buggy source:
@Override public synchronized void clockPulse(){
  List<ControlChange> controlChanges=((ServerConsoleControlsSocketAdapter)controlsSocket).commitAndGetChangesToSend();
  if (powerOn)   tia.clockPulse();
  if (remoteTransmitter != null && remoteTransmitter.isClientConnected()) {
    ServerUpdate update=new ServerUpdate();
    if (!controlChanges.isEmpty())     update.controlChanges=controlChanges;
    update.isClockPulse=powerOn;
    remoteTransmitter.sendUpdate(update);
  }
}

Fixed version (ground truth):
@Override public synchronized void clockPulse(){
  List<ControlChange> controlChanges=((ServerConsoleControlsSocketAdapter)controlsSocket).commitAndGetChangesToSend();
  if (powerOn)   tia.clockPulse();
  if (remoteTransmitter != null && remoteTransmitter.isClientConnected()) {
    ServerUpdate update=new ServerUpdate();
    update.controlChanges=controlChanges;
    update.isClockPulse=powerOn;
    remoteTransmitter.sendUpdate(update);
  }
}
Program: 100948
Project: 100948
Buggy source:
private List<ControlChange> commitAndGetChangesToSend(){
  List<ControlChange> changesToSend;
synchronized (queuedChanges) {
    if (queuedChanges.isEmpty())     changesToSend=emptyChanges;
 else {
      changesToSend=new ArrayList<ControlChange>(queuedChanges);
      queuedChanges.clear();
    }
  }
  for (  ControlChange change : changesToSend)   super.controlStateChanged(change.control,change.state);
  return changesToSend;
}

Fixed version (ground truth):
private List<ControlChange> commitAndGetChangesToSend(){
  List<ControlChange> changesToSend;
synchronized (queuedChanges) {
    if (queuedChanges.isEmpty())     return null;
 else {
      changesToSend=new ArrayList<ControlChange>(queuedChanges);
      queuedChanges.clear();
    }
  }
  for (  ControlChange change : changesToSend)   if (change instanceof ControlChangeForPaddle)   super.controlStateChanged(change.control,((ControlChangeForPaddle)change).position);
 else   super.controlStateChanged(change.control,change.state);
  return changesToSend;
}
Program: 100949
Project: 100949
Buggy source:
@Override public void run(){
  ServerUpdate update;
  while (true) {
synchronized (updates) {
      while ((update=updates.poll()) == null) {
        try {
          updates.wait();
        }
 catch (        InterruptedException e) {
        }
      }
      updates.notifyAll();
    }
    try {
      if (receiver != null) {
        List<ControlChange> clientControlChages=receiver.receiveServerUpdate(update);
        console.receiveClientControlChanges(clientControlChages);
      }
    }
 catch (    RemoteException e) {
      e.printStackTrace();
      disconnectReceiver();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  ServerUpdate update;
  while (true) {
synchronized (updates) {
      while ((update=updates.poll()) == null) {
        try {
          updates.wait();
        }
 catch (        InterruptedException e) {
        }
      }
      updates.notifyAll();
    }
    try {
      if (receiver != null) {
        List<ControlChange> clientControlChages=receiver.receiveServerUpdate(update);
        if (clientControlChages != null)         console.receiveClientControlChanges(clientControlChages);
      }
    }
 catch (    RemoteException ex) {
      System.out.println("String_Node_Str" + ex);
      disconnectReceiver();
    }
  }
}
Program: 100950
Project: 100950
Buggy source:
public void listen(){
  try {
    Registry reg=LocateRegistry.createRegistry(SERVICE_PORT);
    reg.bind(SERVICE_NAME,this);
  }
 catch (  Exception e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
public void listen(){
  try {
    Registry reg=LocateRegistry.createRegistry(SERVICE_PORT);
    reg.bind(SERVICE_NAME,this);
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(null,"String_Node_Str" + ex,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 100951
Project: 100951
Buggy source:
public boolean askUserForConnection(String server){
  boolean connected=false;
  while (!connected) {
    while (server == null || server.isEmpty()) {
      server=JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
      if (server == null)       return false;
    }
    try {
      connect(server);
      connected=true;
    }
 catch (    Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(null,"String_Node_Str" + server,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      server=null;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean askUserForConnection(String server){
  boolean connected=false;
  while (!connected) {
    while (server == null || server.isEmpty()) {
      server=JOptionPane.showInputDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
      if (server == null)       return false;
    }
    try {
      connect(server);
      connected=true;
    }
 catch (    Exception ex) {
      JOptionPane.showMessageDialog(null,"String_Node_Str" + server + "String_Node_Str"+ ex,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      server=null;
    }
  }
  return true;
}
Program: 100952
Project: 100952
Buggy source:
@Override public void run(){
  ServerUpdate update;
  try {
    while (true) {
synchronized (updates) {
        while ((update=updates.poll()) == null) {
          try {
            updates.wait();
          }
 catch (          InterruptedException e) {
          }
        }
        updates.notifyAll();
      }
      if (outputStream != null) {
        outputStream.writeObject(update);
        outputStream.flush();
        socketOutputStream.flush();
        @SuppressWarnings("String_Node_Str") List<ControlChange> clientControlChanges=(List<ControlChange>)inputStream.readObject();
        console.receiveClientControlChanges(clientControlChanges);
      }
    }
  }
 catch (  IOException e) {
    disconnectReceiver();
  }
catch (  ClassNotFoundException e) {
    disconnectReceiver();
  }
}

Fixed version (ground truth):
@Override public void run(){
  ServerUpdate update;
  try {
    while (true) {
synchronized (updates) {
        while ((update=updates.poll()) == null) {
          try {
            updates.wait();
          }
 catch (          InterruptedException e) {
          }
        }
        updates.notifyAll();
      }
      if (outputStream != null) {
        outputStream.writeObject(update);
        outputStream.flush();
        socketOutputStream.flush();
        @SuppressWarnings("String_Node_Str") List<ControlChange> clientControlChanges=(List<ControlChange>)inputStream.readObject();
        if (clientControlChanges != null)         console.receiveClientControlChanges(clientControlChanges);
      }
    }
  }
 catch (  IOException e) {
    disconnectReceiver();
  }
catch (  ClassNotFoundException e) {
    disconnectReceiver();
  }
}
Program: 100953
Project: 100953
Buggy source:
public boolean listen(){
  try {
    ServerSocket serverSocket=new ServerSocket(SERVICE_PORT);
    connectReceiver(serverSocket.accept());
    serverSocket.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean listen(){
  try {
    ServerSocket serverSocket=new ServerSocket(SERVICE_PORT);
    connectReceiver(serverSocket.accept());
    serverSocket.close();
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(null,"String_Node_Str" + ex,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return false;
  }
  return true;
}
Program: 100954
Project: 100954
Buggy source:
private static Cartridge read(FileContents fileCont){
  InputStream stream=null;
  String fileName="String_Node_Str";
  try {
    fileName=fileCont.getName();
    stream=fileCont.getInputStream();
    System.out.println("String_Node_Str" + fileName);
    stream.close();
    return CartridgeLoader.load(stream,fileName);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + fileName);
    System.out.println(ex);
  }
 finally {
    if (stream != null)     try {
      stream.close();
    }
 catch (    IOException e) {
    }
  }
  return null;
}

Fixed version (ground truth):
private static Cartridge read(FileContents fileCont){
  InputStream stream=null;
  String fileName="String_Node_Str";
  try {
    fileName=fileCont.getName();
    stream=fileCont.getInputStream();
    System.out.println("String_Node_Str" + fileName);
    stream.close();
    return CartridgeLoader.load(stream,fileName);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + fileName + "String_Node_Str"+ ex);
  }
 finally {
    if (stream != null)     try {
      stream.close();
    }
 catch (    IOException e) {
    }
  }
  return null;
}
Program: 100955
Project: 100955
Buggy source:
public static Cartridge chooseFile(){
  try {
    FileOpenService fos=(FileOpenService)ServiceManager.lookup("String_Node_Str");
    FileContents fileCon=fos.openFileDialog("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
    return read(fileCon);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
public static Cartridge chooseFile(){
  try {
    FileOpenService fos=(FileOpenService)ServiceManager.lookup("String_Node_Str");
    FileContents fileCon=fos.openFileDialog("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
    return read(fileCon);
  }
 catch (  Exception ex) {
    System.out.println("String_Node_Str" + ex);
    return null;
  }
}
Program: 100956
Project: 100956
Buggy source:
private void paddlesUpdatePosition(){
  if (paddle0MovingLeft) {
    paddle0Position+=paddle0Speed;
    if (paddle0Position > 380)     paddle0Position=380;
    consoleControlsInput.controlStateChanged(Control.PADDLE0_POSITION,paddle0Position);
  }
  if (paddle0MovingRight) {
    paddle0Position-=paddle0Speed;
    if (paddle0Position < 0)     paddle0Position=0;
    consoleControlsInput.controlStateChanged(Control.PADDLE0_POSITION,paddle0Position);
  }
  if (paddle1MovingLeft) {
    paddle1Position+=paddle1Speed;
    if (paddle1Position > 380)     paddle1Position=380;
    consoleControlsInput.controlStateChanged(Control.PADDLE1_POSITION,paddle1Position);
  }
  if (paddle1MovingRight) {
    paddle1Position-=paddle1Speed;
    if (paddle1Position < 0)     paddle1Position=0;
    consoleControlsInput.controlStateChanged(Control.PADDLE1_POSITION,paddle1Position);
  }
}

Fixed version (ground truth):
private void paddlesUpdatePosition(){
  if (paddle0MovingRight) {
    if (!paddle0MovingLeft) {
      paddle0Position-=paddle0Speed;
      if (paddle0Position < 0)       paddle0Position=0;
      consoleControlsInput.controlStateChanged(Control.PADDLE0_POSITION,paddle0Position);
    }
  }
 else   if (paddle0MovingLeft) {
    paddle0Position+=paddle0Speed;
    if (paddle0Position > 380)     paddle0Position=380;
    consoleControlsInput.controlStateChanged(Control.PADDLE0_POSITION,paddle0Position);
  }
  if (paddle1MovingRight) {
    if (!paddle1MovingLeft) {
      paddle1Position-=paddle1Speed;
      if (paddle1Position < 0)       paddle1Position=0;
      consoleControlsInput.controlStateChanged(Control.PADDLE1_POSITION,paddle1Position);
    }
  }
 else   if (paddle1MovingLeft) {
    paddle1Position+=paddle1Speed;
    if (paddle1Position > 380)     paddle1Position=380;
    consoleControlsInput.controlStateChanged(Control.PADDLE1_POSITION,paddle1Position);
  }
}
Program: 100957
Project: 100957
Buggy source:
private void loadImages(){
  try {
    panelImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    retractButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    expandButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    closeButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    powerDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    colorDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    selectDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    resetDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    p0DiffDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    p1DiffDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void loadImages(){
  try {
    panelImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    retractButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    expandButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    closeButtonImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    powerDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    colorDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    selectDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    resetDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    p0DiffDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    p1DiffDownImage=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
  }
 catch (  IOException ex) {
    System.out.println("String_Node_Str" + ex);
  }
}
Program: 100958
Project: 100958
Buggy source:
@Override public Graphics2D canvasGraphics(){
  try {
    Graphics2D canvasGraphics=(Graphics2D)(bufferStrategy != null ? bufferStrategy.getDrawGraphics() : getGraphics());
    if (clearBackgoundFrames-- > 0) {
      canvasGraphics.setColor(Color.BLACK);
      canvasGraphics.clearRect(0,0,getWidth(),getHeight());
    }
    canvasGraphics.translate(canvasOriginX,canvasOriginY);
    return canvasGraphics;
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
@Override public Graphics2D canvasGraphics(){
  Graphics2D canvasGraphics=(Graphics2D)(bufferStrategy != null ? bufferStrategy.getDrawGraphics() : getGraphics());
  if (clearBackgoundFrames-- > 0) {
    canvasGraphics.setColor(Color.BLACK);
    canvasGraphics.clearRect(0,0,getWidth(),getHeight());
  }
  canvasGraphics.translate(canvasOriginX,canvasOriginY);
  return canvasGraphics;
}
Program: 100959
Project: 100959
Buggy source:
@Override public Graphics2D canvasGraphics(){
  try {
    Graphics2D graphics=(Graphics2D)(bufferStrategy != null ? bufferStrategy.getDrawGraphics() : canvas.getGraphics());
    return graphics;
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
@Override public Graphics2D canvasGraphics(){
  Graphics2D graphics=(Graphics2D)(bufferStrategy != null ? bufferStrategy.getDrawGraphics() : canvas.getGraphics());
  return graphics;
}
Program: 100960
Project: 100960
Buggy source:
private void loadImages(){
  try {
    topLeft=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomLeft=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    topRight=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomRight=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    top=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomLeftBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomRightBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    logoBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    favicon=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    icon64=GraphicsDeviceHelper.loadAsCompatibleTranslucentImage("String_Node_Str");
    icon32=GraphicsDeviceHelper.loadAsCompatibleTranslucentImage("String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void loadImages(){
  try {
    topLeft=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomLeft=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    topRight=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomRight=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    top=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomLeftBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomRightBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    bottomBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    logoBar=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    favicon=GraphicsDeviceHelper.loadAsCompatibleImage("String_Node_Str");
    icon64=GraphicsDeviceHelper.loadAsCompatibleTranslucentImage("String_Node_Str");
    icon32=GraphicsDeviceHelper.loadAsCompatibleTranslucentImage("String_Node_Str");
  }
 catch (  IOException ex) {
    System.out.println("String_Node_Str" + ex);
  }
}
Program: 100961
Project: 100961
Buggy source:
private void sendStateUpdate(){
  if (remoteTransmitter != null) {
    ServerUpdate update=new ServerUpdate();
    update.consoleState=saveState();
    remoteTransmitter.sendUpdate(update);
  }
}

Fixed version (ground truth):
private void sendStateUpdate(){
  if (remoteTransmitter != null && remoteTransmitter.isClientConnected()) {
    ServerUpdate update=new ServerUpdate();
    update.consoleState=saveState();
    remoteTransmitter.sendUpdate(update);
  }
}
Program: 100962
Project: 100962
Buggy source:
@Override public void run(){
  ServerUpdate update;
  try {
    while (true) {
synchronized (updates) {
        while ((update=updates.poll()) == null) {
          try {
            updates.wait();
          }
 catch (          InterruptedException e) {
          }
        }
        updates.notifyAll();
      }
      if (outputStream != null) {
        outputStream.writeObject(update);
        outputStream.flush();
        socketOutputStream.flush();
        @SuppressWarnings("String_Node_Str") List<ControlChange> clientControlChanges=(List<ControlChange>)inputStream.readObject();
        console.receiveClientControlChanges(clientControlChanges);
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
    disconnectReceiver();
  }
catch (  ClassNotFoundException e) {
    e.printStackTrace();
    disconnectReceiver();
  }
}

Fixed version (ground truth):
@Override public void run(){
  ServerUpdate update;
  try {
    while (true) {
synchronized (updates) {
        while ((update=updates.poll()) == null) {
          try {
            updates.wait();
          }
 catch (          InterruptedException e) {
          }
        }
        updates.notifyAll();
      }
      if (outputStream != null) {
        outputStream.writeObject(update);
        outputStream.flush();
        socketOutputStream.flush();
        @SuppressWarnings("String_Node_Str") List<ControlChange> clientControlChanges=(List<ControlChange>)inputStream.readObject();
        console.receiveClientControlChanges(clientControlChanges);
      }
    }
  }
 catch (  IOException e) {
    disconnectReceiver();
  }
catch (  ClassNotFoundException e) {
    disconnectReceiver();
  }
}
Program: 100964
Project: 100964
Buggy source:
public void powerOn(){
  Arrays.fill(linePixels,HBLANK_COLOR);
  Arrays.fill(debugPixels,0);
  groundLatchesAtPowerOn();
  observableChange();
  powerOn=true;
}

Fixed version (ground truth):
public void powerOn(){
  Arrays.fill(linePixels,HBLANK_COLOR);
  Arrays.fill(debugPixels,0);
  initLatchesAtPowerOn();
  observableChange();
  powerOn=true;
}
Program: 100965
Project: 100965
Buggy source:
protected CartridgeBanked(Boolean superChip,int extraRAMSize){
  super();
  this.extraRAMSize=extraRAMSize;
  if (superChip == null) {
    superChipMode=false;
    superChipAutoDetect=true;
  }
 else {
    superChipMode=superChip;
    superChipAutoDetect=false;
  }
  extraRAM=superChip != false ? new byte[this.extraRAMSize] : null;
}

Fixed version (ground truth):
protected CartridgeBanked(Boolean superChip,int extraRAMSize){
  super();
  this.extraRAMSize=extraRAMSize;
  if (superChip == null) {
    superChipMode=false;
    superChipAutoDetect=true;
  }
 else {
    superChipMode=superChip;
    superChipAutoDetect=false;
  }
  extraRAM=(superChip == null || superChip) ? new byte[this.extraRAMSize] : null;
}
Program: 100966
Project: 100966
Buggy source:
private void paintLogo(){
synchronized (refreshMonitor) {
    Graphics2D canvasGraphics=canvasGraphics();
    if (canvasGraphics == null)     return;
    canvasGraphics.setColor(Color.BLACK);
    int w=canvas.canvasEffectiveSize().width;
    int h=canvas.canvasEffectiveSize().height;
    canvasGraphics.fillRect(0,0,w,h);
    canvasGraphics.drawImage(logoIcon,(w - logoIcon.getWidth(null)) / 2,(h - logoIcon.getHeight(null)) / 2,null);
    paintOSD(canvasGraphics);
    canvasFinish(canvasGraphics);
  }
}

Fixed version (ground truth):
private void paintLogo(){
synchronized (refreshMonitor) {
    Graphics2D canvasGraphics=canvasGraphics();
    if (canvasGraphics == null)     return;
    int w=canvas.canvasEffectiveSize().width;
    int h=canvas.canvasEffectiveSize().height;
    canvasGraphics.setBackground(Color.BLACK);
    canvasGraphics.clearRect(0,0,w,h);
    canvasGraphics.drawImage(logoIcon,(w - logoIcon.getWidth(null)) / 2,(h - logoIcon.getHeight(null)) / 2,null);
    paintOSD(canvasGraphics);
    canvasFinish(canvasGraphics);
  }
}
Program: 100967
Project: 100967
Buggy source:
private Graphics2D canvasGraphics(){
  if (canvas == null)   return null;
  Graphics2D canvasGraphics=canvas.canvasGraphics();
  if (canvasGraphics != null)   canvasGraphics.setRenderingHint(RenderingHints.KEY_RENDERING,qualityRendering ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_DEFAULT);
  return canvasGraphics;
}

Fixed version (ground truth):
private Graphics2D canvasGraphics(){
  if (canvas == null)   return null;
  Graphics2D canvasGraphics=canvas.canvasGraphics();
  canvasGraphics.setComposite(AlphaComposite.Src);
  if (canvasGraphics != null)   canvasGraphics.setRenderingHint(RenderingHints.KEY_RENDERING,qualityRendering ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_DEFAULT);
  return canvasGraphics;
}
Program: 100969
Project: 100969
Buggy source:
private void renderFrame(Graphics2D graphics,int canvasWidth,int canvasHeight){
  if (crtMode > 0 && crtMode != 3) {
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,CRT_RETENTION_ALPHA));
    graphics.drawImage(frameImage,0,0,canvasWidth,canvasHeight,0,0,displayWidth,displayHeight,null);
  }
  frameImage.getRaster().setDataElements(0,0,displayWidth,displayHeight,frontBuffer);
  graphics.drawImage(frameImage,0,0,canvasWidth,canvasHeight,0,0,displayWidth,displayHeight,null);
  if (crtMode > 0 && crtMode != 3)   graphics.setComposite(AlphaComposite.SrcOver);
}

Fixed version (ground truth):
private void renderFrame(Graphics2D graphics,int canvasWidth,int canvasHeight){
  if (crtMode > 0 && crtMode != 3) {
    graphics.setBackground(Color.BLACK);
    graphics.clearRect(0,0,canvasWidth,canvasHeight);
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,CRT_RETENTION_ALPHA));
    graphics.drawImage(frameImage,0,0,canvasWidth,canvasHeight,0,0,displayWidth,displayHeight,null);
  }
  frameImage.getRaster().setDataElements(0,0,displayWidth,displayHeight,frontBuffer);
  graphics.drawImage(frameImage,0,0,canvasWidth,canvasHeight,0,0,displayWidth,displayHeight,null);
}
Program: 100970
Project: 100970
Buggy source:
private void paintOSD(Graphics2D canvasGraphics){
  if (--osdFramesLeft < 0)   return;
  osdComponent.setText(osdMessage);
  Dimension s=osdComponent.getPreferredSize();
  SwingUtilities.paintComponent(canvasGraphics,osdComponent,canvas.canvasContainer(),(canvas.canvasEffectiveSize().width - s.width) - 12,12,s.width,s.height);
}

Fixed version (ground truth):
private void paintOSD(Graphics2D canvasGraphics){
  if (--osdFramesLeft < 0)   return;
  canvasGraphics.setComposite(AlphaComposite.SrcOver);
  osdComponent.setText(osdMessage);
  Dimension s=osdComponent.getPreferredSize();
  SwingUtilities.paintComponent(canvasGraphics,osdComponent,canvas.canvasContainer(),(canvas.canvasEffectiveSize().width - s.width) - 12,12,s.width,s.height);
}
Program: 100971
Project: 100971
Buggy source:
public BUS(TIA tia,PIA pia,RAM ram,Cartridge cart){
  this.cartridge=cart;
  this.ram=ram;
  this.tia=tia;
  this.pia=pia;
}

Fixed version (ground truth):
public BUS(TIA tia,PIA pia,RAM ram){
  this.ram=ram;
  this.tia=tia;
  this.pia=pia;
}
Program: 100972
Project: 100972
Buggy source:
public void forceVideoStandard(VideoStandard videoStandard){
  this.videoStandard=videoStandard;
}

Fixed version (ground truth):
public void forceVideoStandard(VideoStandard videoStandard){
  this.forcedVideoStandard=videoStandard;
}
Program: 100973
Project: 100973
Buggy source:
@Override public void writeByte(int address,byte b){
  int addr=maskAddress(address);
  if (addr <= 0x7f && (superChipMode || superChipAutoDetect)) {
    if (!superChipMode)     superChipMode=true;
    extraRAM[addr]=b;
  }
}

Fixed version (ground truth):
@Override public void writeByte(int address,byte b){
  int addr=maskAddress(address);
  if (addr <= 0x7f && (superChipMode || superChipAutoDetect)) {
    if (!superChipMode) {
      superChipMode=true;
      System.out.println("String_Node_Str");
    }
    extraRAM[addr]=b;
  }
}
Program: 100974
Project: 100974
Buggy source:
protected void mainComponentsCreate(Cartridge cartridge){
  cpu=new M6502();
  pia=new PIA(this);
  ram=new RAM();
  tia=new TIA(cpu,pia,cartridge.videoStandard());
  bus=new BUS(tia,pia,ram,cartridge);
  cpu.connectBus(bus);
}

Fixed version (ground truth):
protected void mainComponentsCreate(){
  cpu=new M6502();
  pia=new PIA(this);
  ram=new RAM();
  tia=new TIA(this,cpu,pia);
  bus=new BUS(tia,pia,ram);
  cpu.connectBus(bus);
}
Program: 100975
Project: 100975
Buggy source:
public void powerOff(){
  mainClockPause();
  tia.powerOff();
  bus.ram(ram=new RAM());
  powerOn=false;
  controlsSocket.controlsStatesRedefined();
}

Fixed version (ground truth):
public void powerOff(){
  mainClockPause();
  tia.powerOff();
  pia.powerOff();
  cpu.powerOff();
  ram.powerOff();
  powerOn=false;
  controlsSocket.controlsStatesRedefined();
}
Program: 100976
Project: 100976
Buggy source:
public Console(Cartridge cartridge){
  mainComponentsCreate(cartridge);
  socketsCreate();
  mainClockCreate();
  cartridge(cartridge);
}

Fixed version (ground truth):
public Console(Cartridge cartridge){
  mainComponentsCreate();
  socketsCreate();
  mainClockCreate();
  videoStandardAuto();
  cartridge(cartridge);
}
Program: 100977
Project: 100977
Buggy source:
public void powerOn(){
  if (powerOn)   powerOff();
  cpu.powerOn();
  pia.powerOn();
  tia.powerOn();
  powerOn=true;
  controlsSocket.controlsStatesRedefined();
  mainClockGo();
}

Fixed version (ground truth):
public void powerOn(){
  if (powerOn)   powerOff();
  ram.powerOn();
  cpu.powerOn();
  pia.powerOn();
  tia.powerOn();
  powerOn=true;
  controlsSocket.controlsStatesRedefined();
  mainClockGo();
}
Program: 100978
Project: 100978
Buggy source:
protected void cartridge(Cartridge cartridge){
  bus.cartridge(cartridge);
  tia.videoStandard(cartridge.videoStandard());
  mainClockAdjustToNormal();
}

Fixed version (ground truth):
protected void cartridge(Cartridge cartridge){
  bus.cartridge(cartridge);
  if (cartridge.forcedVideoStandard() != null)   videoStandardForced(cartridge.forcedVideoStandard());
}
Program: 100979
Project: 100979
Buggy source:
@Override public synchronized void clockPulse(){
  List<ControlChange> controlChanges=((ServerConsoleControlsSocketAdapter)controlsSocket).commitAndGetChangesToSend();
  if (powerOn)   tia.clockPulse();
  if (remoteTransmitter.isClientConnected()) {
    ServerUpdate update=new ServerUpdate();
    if (!controlChanges.isEmpty())     update.controlChanges=controlChanges;
    update.isClockPulse=powerOn;
    remoteTransmitter.sendUpdate(update);
  }
}

Fixed version (ground truth):
@Override public synchronized void clockPulse(){
  List<ControlChange> controlChanges=((ServerConsoleControlsSocketAdapter)controlsSocket).commitAndGetChangesToSend();
  if (powerOn)   tia.clockPulse();
  if (remoteTransmitter != null && remoteTransmitter.isClientConnected()) {
    ServerUpdate update=new ServerUpdate();
    if (!controlChanges.isEmpty())     update.controlChanges=controlChanges;
    update.isClockPulse=powerOn;
    remoteTransmitter.sendUpdate(update);
  }
}
Program: 100980
Project: 100980
Buggy source:
public void loadState(PIAState state){
  debug=state.debug;
  timerCount=state.timerCount;
  currentTimerInterval=state.currentTimerInterval;
  lastSetTimerInterval=state.lastSetTimerInterval;
  SWACNT=state.SWACNT;
  SWCHB=state.SWCHB;
  SWBCNT=state.SWBCNT;
  INTIM=state.INTIM;
  INSTAT=state.INSTAT;
  TIM1T=state.TIM1T;
  TIM8T=state.TIM8T;
  TIM64T=state.TIM64T;
  T1024T=state.T1024T;
}

Fixed version (ground truth):
public void loadState(PIAState state){
  timerCount=state.timerCount;
  currentTimerInterval=state.currentTimerInterval;
  lastSetTimerInterval=state.lastSetTimerInterval;
  SWACNT=state.SWACNT;
  SWCHB=state.SWCHB;
  SWBCNT=state.SWBCNT;
  INTIM=state.INTIM;
  INSTAT=state.INSTAT;
  TIM1T=state.TIM1T;
  TIM8T=state.TIM8T;
  TIM64T=state.TIM64T;
  T1024T=state.T1024T;
}
Program: 100981
Project: 100981
Buggy source:
public PIA(Console console){
  this.console=console;
  powerOn();
}

Fixed version (ground truth):
public PIA(Console console){
  this.console=console;
}
Program: 100982
Project: 100982
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (db.availableEntries()) {
    titleTextView.setText(this.getString(R.string.availableData));
    chartInit();
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          chartDraw();
        }
 catch (        Exception e) {
        }
      }
    }
).start();
  }
 else {
    titleTextView.setText(this.getString(R.string.notAvailableDataYet));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (db.availableEntries()) {
    titleTextView.setText(this.getString(R.string.availableData));
    chartInit();
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          chartDraw();
        }
 catch (        Exception e) {
        }
      }
    }
).start();
  }
 else {
    titleTextView.setText(this.getString(R.string.notAvailableDataYet));
    db.close();
  }
}
Program: 100983
Project: 100983
Buggy source:
@Override public int select0(int count){
}

Fixed version (ground truth):
@Override public int select0(int count){
  if (count > size0)   return -1;
  if (count <= 3) {
    if (count == 1)     return node1pos;
 else     if (count == 2)     return node2pos;
 else     if (count == 3)     return node3pos;
 else     return -1;
  }
  int idx=count / BITS0_COUNT_IN_EACH_INDEX;
  int start=0;
  int end=0;
  if (idx < indexCache0.size()) {
    start=indexCache0.get(idx);
    if (count % CACHE_WIDTH == 0)     return start;
    start/=CACHE_WIDTH;
    if (idx + 1 < indexCache0.size()) {
      end=indexCache0.get(idx + 1) / CACHE_WIDTH + 1;
    }
 else {
      end=countCache0Size(size);
    }
  }
 else   if (idx > 0) {
    start=indexCache0.get(idx - 1) / CACHE_WIDTH;
    end=Math.min(start + CACHE_WIDTH,countCache0Size(size));
  }
  long m=-1 * Unsafe.ARRAY_INT_INDEX_SCALE + Unsafe.ARRAY_INT_BASE_OFFSET;
  int d=0;
  long startOffset=start * Unsafe.ARRAY_INT_INDEX_SCALE + Unsafe.ARRAY_INT_BASE_OFFSET;
  long endOffset=end * Unsafe.ARRAY_INT_INDEX_SCALE + Unsafe.ARRAY_INT_BASE_OFFSET;
  if (startOffset != endOffset) {
    do {
      m=((startOffset + endOffset) / 2) & 0xfffffffffffffffcL;
      d=count - unsafe.getInt(countCache0,m);
      if (d < 0) {
        endOffset=m;
        continue;
      }
 else       if (d > 0) {
        if (startOffset != m)         startOffset=m;
 else         break;
      }
 else {
        break;
      }
    }
 while (endOffset - startOffset >= 4);
    if (d > 0) {
      count=d;
    }
 else {
      while (m >= Unsafe.ARRAY_INT_BASE_OFFSET && count <= unsafe.getInt(countCache0,m)) {
        m-=Unsafe.ARRAY_INT_INDEX_SCALE;
      }
      if (m >= Unsafe.ARRAY_INT_BASE_OFFSET)       count-=unsafe.getInt(countCache0,m);
    }
  }
  int n=bytes.length;
  for (int i=(((int)(m - Unsafe.ARRAY_INT_BASE_OFFSET) / Unsafe.ARRAY_INT_INDEX_SCALE) + 1) * CACHE_WIDTH / 8; i < n; i++) {
    int bits=bytes[i] & 0xff;
    int c=BITCOUNTS0[bits];
    if (count <= c) {
      return i * 8 + BITPOS0[bits][count - 1];
    }
    count-=c;
  }
  return -1;
}