nus-yam/ex-repair huggingface dataset:
Program: 95439
Project: 95439
Buggy source:
private void checkIntent(){
  Intent intent=getIntent();
  String action=intent.getAction();
  String type=intent.getType();
  if (Intent.ACTION_VIEW.equals(action) && type != null) {
    Toast.makeText(this,intent.getData().getPath(),Toast.LENGTH_LONG).show();
    KmlParser parser=(new KmlParser());
    boolean fileIsOpen=parser.openGCPFile(intent.getData().getPath());
    if (fileIsOpen) {
      putListToGcp(parser.gcpList);
    }
  }
}

Fixed version (ground truth):
private void checkIntent(){
  Intent intent=getIntent();
  String action=intent.getAction();
  String type=intent.getType();
  if (Intent.ACTION_VIEW.equals(action) && type != null) {
    Toast.makeText(this,intent.getData().getPath(),Toast.LENGTH_LONG).show();
    GcpReader parser=(new GcpReader());
    boolean fileIsOpen=parser.openGCPFile(intent.getData().getPath());
    if (fileIsOpen) {
      putListToGcp(parser.gcpList);
    }
  }
}
Program: 95440
Project: 95440
Buggy source:
@Override protected void onDataLoaded(FileReader reader){
  onGcpFileLoaded(((KmlParser)reader).gcpList);
}

Fixed version (ground truth):
@Override protected void onDataLoaded(FileReader reader){
  onGcpFileLoaded(((GcpReader)reader).gcpList);
}
Program: 95441
Project: 95441
Buggy source:
@Override protected FileReader createReader(){
  return new KmlParser();
}

Fixed version (ground truth):
@Override protected FileReader createReader(){
  return new GcpReader();
}
Program: 95442
Project: 95442
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap=getMap();
  drone=((SuperActivity)getActivity()).app.drone;
  droneMarker=new DroneMarker(this);
  addFlightPathToMap();
  addMissionPathToMap();
  getPreferences();
  drone.setMapListner(droneMarker);
  mMap.setOnMapLongClickListener(this);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap=getMap();
  drone=((SuperActivity)getActivity()).app.drone;
  droneMarker=new DroneMarker(this);
  homeMarker=new HomeMarker(this.mMap);
  guidedMarker=new GuidedMarker(mMap);
  addFlightPathToMap();
  addMissionPathToMap();
  getPreferences();
  drone.setMapListner(droneMarker);
  mMap.setOnMapLongClickListener(this);
  return view;
}
Program: 95443
Project: 95443
Buggy source:
/** 
 * Finds the line that has the start or tip closest to a point.
 * @param point Point to the distance will be minimized
 * @param list A list of lines to search
 * @return The closest Line
 */
static LineLatLng findClosestLine(LatLng point,List<LineLatLng> list){
  LineLatLng answer=list.get(0);
  double shortest=Double.MAX_VALUE;
  for (  LineLatLng line : list) {
    double ans1=getDistance(point,line.line.p1);
    double ans2=getDistance(point,line.line.p2);
    LatLng shorterpnt=ans1 < ans2 ? line.line.p1 : line.line.p2;
    if (shortest > getDistance(point,shorterpnt)) {
      answer=line;
      shortest=getDistance(point,shorterpnt);
    }
  }
  return answer;
}

Fixed version (ground truth):
/** 
 * Finds the line that has the start or tip closest to a point.
 * @param point Point to the distance will be minimized
 * @param list A list of lines to search
 * @return The closest Line
 */
static LineLatLng findClosestLine(LatLng point,List<LineLatLng> list){
  LineLatLng answer=list.get(0);
  double shortest=Double.MAX_VALUE;
  for (  LineLatLng line : list) {
    double ans1=getDistance(point,line.p1);
    double ans2=getDistance(point,line.p2);
    LatLng shorterpnt=ans1 < ans2 ? line.p1 : line.p2;
    if (shortest > getDistance(point,shorterpnt)) {
      answer=line;
      shortest=getDistance(point,shorterpnt);
    }
  }
  return answer;
}
Program: 95444
Project: 95444
Buggy source:
private boolean writeMission(){
  MissionWriter missionWriter=new MissionWriter(drone.home,waypoints);
  return missionWriter.saveWaypoints();
}

Fixed version (ground truth):
private boolean writeMission(){
  if (waypoints.size() > 1) {
    waypoint home=waypoints.get(0);
    waypoints.remove(0);
    MissionWriter missionWriter=new MissionWriter(home,waypoints);
    return missionWriter.saveWaypoints();
  }
 else {
    return false;
  }
}
Program: 95445
Project: 95445
Buggy source:
private void startRecordMe(){
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MIN_TIME_MS,MIN_DISTANCE_M,this);
  recordMeEnabled=true;
  saveWaypointsToFile();
}

Fixed version (ground truth):
private void startRecordMe(){
  Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MIN_TIME_MS,MIN_DISTANCE_M,this);
  recordMeEnabled=true;
}
Program: 95446
Project: 95446
Buggy source:
private void finishRecordMe(){
  locationManager.removeUpdates(this);
  recordMeEnabled=false;
  saveWaypointsToFile();
}

Fixed version (ground truth):
private void finishRecordMe(){
  locationManager.removeUpdates(this);
  recordMeEnabled=false;
  saveWaypointsToFile();
  waypoints.clear();
}
Program: 95447
Project: 95447
Buggy source:
@Override public void onDroneTypeChanged(){
  Log.d("String_Node_Str","String_Node_Str");
  fligthModeSpinner.updateModeSpinner(drone);
  flightMapFragment.droneMarker.updateDroneMarkers(flightMapFragment);
}

Fixed version (ground truth):
@Override public void onDroneTypeChanged(){
  Log.d("String_Node_Str","String_Node_Str");
  fligthModeSpinner.updateModeSpinner(drone);
  flightMapFragment.droneMarker.updateDroneMarkers();
}
Program: 95448
Project: 95448
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap=getMap();
  drone=((SuperActivity)getActivity()).app.drone;
  drone.setMapListner(this);
  droneMarker.buildBitmaps(this,drone.getType());
  addFlightPathToMap();
  addMissionPathToMap();
  getPreferences();
  mMap.setOnMapLongClickListener(this);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap=getMap();
  drone=((SuperActivity)getActivity()).app.drone;
  drone.setMapListner(droneMarker);
  droneMarker.buildBitmaps(this,drone.getType());
  addFlightPathToMap();
  addMissionPathToMap();
  getPreferences();
  mMap.setOnMapLongClickListener(this);
  return view;
}
Program: 95449
Project: 95449
Buggy source:
public void updatePosition(FlightMapFragment flightMapFragment,double yaw,LatLng coord){
  double correctHeading=(yaw - flightMapFragment.getMapRotation() + 360) % 360;
  int index=(int)(correctHeading / DRONE_MIN_ROTATION);
  try {
    droneMarker.setPosition(coord);
    droneMarker.setIcon(droneBitmaps[index]);
    if (!flightMapFragment.hasBeenZoomed) {
      flightMapFragment.hasBeenZoomed=true;
      flightMapFragment.mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coord,16));
    }
    if (flightMapFragment.isAutoPanEnabled) {
      flightMapFragment.mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(droneMarker.getPosition(),17));
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void updatePosition(double yaw,LatLng coord){
  double correctHeading=(yaw - flightMapFragment.getMapRotation() + 360) % 360;
  int index=(int)(correctHeading / DRONE_MIN_ROTATION);
  try {
    droneMarker.setPosition(coord);
    droneMarker.setIcon(droneBitmaps[index]);
    if (!flightMapFragment.hasBeenZoomed) {
      flightMapFragment.hasBeenZoomed=true;
      flightMapFragment.mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coord,16));
    }
    if (flightMapFragment.isAutoPanEnabled) {
      flightMapFragment.mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(droneMarker.getPosition(),17));
    }
  }
 catch (  Exception e) {
  }
}
Program: 95450
Project: 95450
Buggy source:
public void updateDroneMarkers(FlightMapFragment flightMapFragment){
  buildBitmaps(flightMapFragment,flightMapFragment.drone.getType());
  droneMarker=flightMapFragment.mMap.addMarker(new MarkerOptions().anchor((float)0.5,(float)0.5).position(new LatLng(0,0)).icon(droneBitmaps[0]).visible(false));
}

Fixed version (ground truth):
public void updateDroneMarkers(){
  buildBitmaps(flightMapFragment,flightMapFragment.drone.getType());
  droneMarker=flightMapFragment.mMap.addMarker(new MarkerOptions().anchor((float)0.5,(float)0.5).position(new LatLng(0,0)).icon(droneBitmaps[0]).visible(false));
}
Program: 95451
Project: 95451
Buggy source:
public void onDroneUpdate(FlightMapFragment flightMapFragment){
  updatePosition(flightMapFragment,flightMapFragment.drone.getYaw(),flightMapFragment.drone.getPosition());
  flightMapFragment.addFlithPathPoint(flightMapFragment.drone.getPosition());
}

Fixed version (ground truth):
public void onDroneUpdate(){
  updatePosition(flightMapFragment.drone.getYaw(),flightMapFragment.drone.getPosition());
  flightMapFragment.addFlithPathPoint(flightMapFragment.drone.getPosition());
}
Program: 95452
Project: 95452
Buggy source:
public Bitmap getBitmap(FlightMapFragment flightMapFragment,int type){
switch (type) {
case MAV_TYPE.MAV_TYPE_TRICOPTER:
case MAV_TYPE.MAV_TYPE_QUADROTOR:
case MAV_TYPE.MAV_TYPE_HEXAROTOR:
case MAV_TYPE.MAV_TYPE_OCTOROTOR:
case MAV_TYPE.MAV_TYPE_HELICOPTER:
    return BitmapFactory.decodeResource(flightMapFragment.getResources(),drawable.quad);
case MAV_TYPE.MAV_TYPE_FIXED_WING:
default :
  return BitmapFactory.decodeResource(flightMapFragment.getResources(),drawable.plane);
}
}

Fixed version (ground truth):
public Bitmap getBitmap(int type){
switch (type) {
case MAV_TYPE.MAV_TYPE_TRICOPTER:
case MAV_TYPE.MAV_TYPE_QUADROTOR:
case MAV_TYPE.MAV_TYPE_HEXAROTOR:
case MAV_TYPE.MAV_TYPE_OCTOROTOR:
case MAV_TYPE.MAV_TYPE_HELICOPTER:
    return BitmapFactory.decodeResource(flightMapFragment.getResources(),drawable.quad);
case MAV_TYPE.MAV_TYPE_FIXED_WING:
default :
  return BitmapFactory.decodeResource(flightMapFragment.getResources(),drawable.plane);
}
}
Program: 95453
Project: 95453
Buggy source:
public BitmapDescriptor generateIcon(FlightMapFragment flightMapFragment,float heading,int type){
  Bitmap planeBitmap=flightMapFragment.droneMarker.getBitmap(flightMapFragment,type);
  Matrix matrix=new Matrix();
  matrix.postRotate(heading - flightMapFragment.mMap.getCameraPosition().bearing);
  return BitmapDescriptorFactory.fromBitmap(Bitmap.createBitmap(planeBitmap,0,0,planeBitmap.getWidth(),planeBitmap.getHeight(),matrix,true));
}

Fixed version (ground truth):
public BitmapDescriptor generateIcon(float heading,int type){
  Bitmap planeBitmap=flightMapFragment.droneMarker.getBitmap(type);
  Matrix matrix=new Matrix();
  matrix.postRotate(heading - flightMapFragment.mMap.getCameraPosition().bearing);
  return BitmapDescriptorFactory.fromBitmap(Bitmap.createBitmap(planeBitmap,0,0,planeBitmap.getWidth(),planeBitmap.getHeight(),matrix,true));
}
Program: 95454
Project: 95454
Buggy source:
public void buildBitmaps(FlightMapFragment flightMapFragment,int type){
  int count=360 / DRONE_MIN_ROTATION;
  droneBitmaps=new BitmapDescriptor[count];
  for (int i=0; i < count; i++) {
    droneBitmaps[i]=flightMapFragment.droneMarker.generateIcon(flightMapFragment,i * DRONE_MIN_ROTATION,type);
  }
}

Fixed version (ground truth):
public void buildBitmaps(FlightMapFragment flightMapFragment,int type){
  int count=360 / DRONE_MIN_ROTATION;
  droneBitmaps=new BitmapDescriptor[count];
  for (int i=0; i < count; i++) {
    droneBitmaps[i]=flightMapFragment.droneMarker.generateIcon(i * DRONE_MIN_ROTATION,type);
  }
}
Program: 95455
Project: 95455
Buggy source:
private String[] splitLine(String line) throws Exception {
  String[] RowData=line.split("String_Node_Str");
  if (RowData.length != 2) {
    throw new Exception("String_Node_Str");
  }
  return RowData;
}

Fixed version (ground truth):
private String[] splitLine(String line) throws Exception {
  String[] RowData=line.split("String_Node_Str");
  if (RowData.length != 2) {
    throw new Exception("String_Node_Str");
  }
  RowData[0]=RowData[0].trim();
  return RowData;
}
Program: 95456
Project: 95456
Buggy source:
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_load_parameters:
    app.parameterMananger.getWaypoints();
  return true;
default :
return super.onMenuItemSelected(featureId,item);
}
}

Fixed version (ground truth):
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_load_parameters:
    app.parameterMananger.getAllParameters();
  return true;
default :
return super.onMenuItemSelected(featureId,item);
}
}
Program: 95457
Project: 95457
Buggy source:
private void setupMapUI(){
  GoogleMap mMap=getMap();
  mMap.setMyLocationEnabled(true);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
}

Fixed version (ground truth):
private void setupMapUI(){
  GoogleMap mMap=getMap();
  if (mMap != null) {
    mMap.setMyLocationEnabled(true);
    UiSettings mUiSettings=mMap.getUiSettings();
    mUiSettings.setMyLocationButtonEnabled(true);
    mUiSettings.setCompassEnabled(true);
    mUiSettings.setTiltGesturesEnabled(false);
  }
}
Program: 95458
Project: 95458
Buggy source:
public void sendMavPacket(MAVLinkPacket pack){
  Message msg=Message.obtain(null,MAVLinkService.MSG_SEND_DATA);
  Bundle data=new Bundle();
  data.putSerializable("String_Node_Str",pack);
  msg.setData(data);
  try {
    mService.send(msg);
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void sendMavPacket(MAVLinkPacket pack){
  Message msg=Message.obtain(null,MAVLinkService.MSG_SEND_DATA);
  Bundle data=new Bundle();
  data.putSerializable("String_Node_Str",pack);
  msg.setData(data);
  try {
    mService.send(msg);
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
catch (  NullPointerException e) {
    e.printStackTrace();
  }
}
Program: 95459
Project: 95459
Buggy source:
public double getMapRotation(){
  return getMap().getCameraPosition().bearing;
}

Fixed version (ground truth):
public double getMapRotation(){
  GoogleMap map=getMap();
  if (map != null) {
    return map.getCameraPosition().bearing;
  }
 else {
    return 0;
  }
}
Program: 95460
Project: 95460
Buggy source:
public void notifyDisconnected(){
  connectButton.setTitle(getResources().getString(R.string.menu_connect));
}

Fixed version (ground truth):
public void notifyDisconnected(){
  if (connectButton != null) {
    connectButton.setTitle(getResources().getString(R.string.menu_connect));
  }
}
Program: 95461
Project: 95461
Buggy source:
public void notifyConnected(){
  connectButton.setTitle(getResources().getString(R.string.menu_disconnect));
}

Fixed version (ground truth):
public void notifyConnected(){
  if (connectButton != null) {
    connectButton.setTitle(getResources().getString(R.string.menu_disconnect));
  }
}
Program: 95462
Project: 95462
Buggy source:
@Override protected String doInBackground(String... message){
  parser=new Parser();
  try {
    if (logEnabled) {
      logWriter=FileManager.getTLogFileStream();
    }
    getTCPStream();
    MAVLinkMessage m;
    while (connected) {
      int data;
      if ((data=mavIn.read()) >= 0) {
        if (logEnabled) {
          logWriter.write(data);
        }
        m=parser.mavlink_parse_char(data);
        if (m != null) {
          receivedCount++;
          publishProgress(m);
        }
      }
    }
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (socket != null) {
        socket.close();
      }
      if (logEnabled) {
        logWriter.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override protected String doInBackground(String... message){
  parser=new Parser();
  try {
    if (logEnabled) {
      logWriter=FileManager.getTLogFileStream();
    }
    getTCPStream();
    MAVLinkMessage m;
    int data;
    while (connected) {
      if ((data=mavIn.read()) >= 0) {
        if (logEnabled) {
          logWriter.write(data);
        }
        m=parser.mavlink_parse_char(data);
        if (m != null) {
          receivedCount++;
          publishProgress(m);
        }
      }
    }
  }
 catch (  UnknownHostException e) {
    e.printStackTrace();
  }
catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (socket != null) {
        socket.close();
      }
      if (logEnabled) {
        logWriter.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return null;
}
Program: 95463
Project: 95463
Buggy source:
/** 
 * Check if the size of the Payload is equal to the "len" byte
 */
public boolean payloadIsFilled(){
  return (payload.size() == len);
}

Fixed version (ground truth):
/** 
 * Check if the size of the Payload is equal to the "len" byte
 */
public boolean payloadIsFilled(){
  if (payload.size() >= MAVLinkPayload.MAX_PAYLOAD_SIZE - 1) {
    Log.d("String_Node_Str","String_Node_Str");
    return true;
  }
  return (payload.size() == len);
}
Program: 95464
Project: 95464
Buggy source:
/** 
 * Encode this packet for transmission. 
 * @return Array with bytes to be transmitted
 */
public byte[] encodePacket(){
  byte[] buffer=new byte[6 + len + 2];
  int i=0;
  buffer[i++]=(byte)MAVLINK_STX;
  buffer[i++]=(byte)len;
  buffer[i++]=(byte)seq;
  buffer[i++]=(byte)sysid;
  buffer[i++]=(byte)compid;
  buffer[i++]=(byte)msgid;
  for (  byte b : payload.payload) {
    buffer[i++]=b;
  }
  generateCRC();
  buffer[i++]=(byte)(crc.getLSB());
  buffer[i++]=(byte)(crc.getMSB());
  return buffer;
}

Fixed version (ground truth):
/** 
 * Encode this packet for transmission. 
 * @return Array with bytes to be transmitted
 */
public byte[] encodePacket(){
  byte[] buffer=new byte[6 + len + 2];
  int i=0;
  buffer[i++]=(byte)MAVLINK_STX;
  buffer[i++]=(byte)len;
  buffer[i++]=(byte)seq;
  buffer[i++]=(byte)sysid;
  buffer[i++]=(byte)compid;
  buffer[i++]=(byte)msgid;
  for (int j=0; j < payload.size(); j++) {
    buffer[i++]=payload.payload.get(j);
  }
  generateCRC();
  buffer[i++]=(byte)(crc.getLSB());
  buffer[i++]=(byte)(crc.getMSB());
  return buffer;
}
Program: 95465
Project: 95465
Buggy source:
public void add(byte c){
  payload.add(c);
}

Fixed version (ground truth):
public void add(byte c){
  payload.put(c);
}
Program: 95466
Project: 95466
Buggy source:
public MAVLinkPayload(){
  payload=new ArrayList<Byte>();
}

Fixed version (ground truth):
public MAVLinkPayload(){
  payload=ByteBuffer.allocate(MAX_PAYLOAD_SIZE);
}
Program: 95467
Project: 95467
Buggy source:
public int size(){
  return payload.size();
}

Fixed version (ground truth):
public int size(){
  return payload.position();
}
Program: 95468
Project: 95468
Buggy source:
public List<Byte> getData(){
  return payload;
}

Fixed version (ground truth):
public ByteBuffer getData(){
  return payload;
}
Program: 95469
Project: 95469
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  mMap.setOnMarkerDragListener(this);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
  mMap.setOnMapLongClickListener(this);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  mMap=getMap();
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  mMap.setOnMarkerDragListener(this);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
  mMap.setOnMapLongClickListener(this);
  return view;
}
Program: 95470
Project: 95470
Buggy source:
public void updateDronePosition(float heading,LatLng coord){
  mMap.clear();
  addDroneMarkerToMap(heading,coord);
}

Fixed version (ground truth):
public void updateDronePosition(float heading,LatLng coord){
  DroneMarker.setPosition(coord);
}
Program: 95471
Project: 95471
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  planeBitmap=BitmapFactory.decodeResource(getResources(),R.drawable.planetracker);
  mMap=getMap();
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup viewGroup,Bundle bundle){
  View view=super.onCreateView(inflater,viewGroup,bundle);
  planeBitmap=BitmapFactory.decodeResource(getResources(),R.drawable.planetracker);
  mMap=getMap();
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
  addDroneMarkerToMap();
  return view;
}
Program: 95472
Project: 95472
Buggy source:
private void addDroneMarkerToMap(float heading,LatLng coord){
  mMap.addMarker(new MarkerOptions().position(coord).anchor((float)0.5,(float)0.5).icon(BitmapDescriptorFactory.fromBitmap(planeBitmap)));
}

Fixed version (ground truth):
private void addDroneMarkerToMap(){
  DroneMarker=mMap.addMarker(new MarkerOptions().anchor((float)0.5,(float)0.5).position(new LatLng(0,0)).icon(BitmapDescriptorFactory.fromBitmap(planeBitmap)));
}
Program: 95473
Project: 95473
Buggy source:
private void updateMarkers(){
  int i=1;
  mMap.clear();
  for (  waypoint point : WPlist) {
    if (point.set) {
      mMap.addMarker(new MarkerOptions().position(point.coord).title(String.valueOf(i)).icon(BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_blue)).anchor((float)0.5,(float)0.5));
    }
 else {
      mMap.addMarker(new MarkerOptions().position(point.coord).title(String.valueOf(i)).icon(BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_red)).anchor((float)0.5,(float)0.5));
    }
    i++;
  }
}

Fixed version (ground truth):
private void updateMarkers(){
  int i=1;
  clearMap();
  for (  waypoint point : WPlist) {
    if (point.set) {
      mMap.addMarker(new MarkerOptions().position(point.coord).title(String.valueOf(i)).icon(BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_blue)).anchor((float)0.5,(float)0.5));
    }
 else {
      mMap.addMarker(new MarkerOptions().position(point.coord).title(String.valueOf(i)).icon(BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_red)).anchor((float)0.5,(float)0.5));
    }
    i++;
  }
}
Program: 95474
Project: 95474
Buggy source:
private void setUpMap(){
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  Log.d("String_Node_Str","String_Node_Str");
  mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
}

Fixed version (ground truth):
private void setUpMap(){
  mMap.setMyLocationEnabled(true);
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
  mMap.setOnMarkerClickListener(this);
  updateMarkers();
  Intent intent=getIntent();
  String action=intent.getAction();
  String type=intent.getType();
  if (Intent.ACTION_VIEW.equals(action) && type != null) {
    Toast.makeText(this,intent.getData().getPath(),Toast.LENGTH_LONG).show();
    openGCPFile(intent.getData().getPath());
    zoomToExtentsFixed();
  }
}
Program: 95476
Project: 95476
Buggy source:
@Bean public IntegrationFlow ftpMGetFlow(){
  return IntegrationFlows.from("String_Node_Str").handle(Ftp.outboundGateway(this.ftpSessionFactory,AbstractRemoteFileOutboundGateway.Command.MGET,"String_Node_Str").options(AbstractRemoteFileOutboundGateway.Option.RECURSIVE).regexFileNameFilter("String_Node_Str").localDirectoryExpression("String_Node_Str").localFilenameGeneratorExpression("String_Node_Str")).channel(remoteFileOutputChannel()).get();
}

Fixed version (ground truth):
@Bean public IntegrationFlow ftpMGetFlow(){
  return IntegrationFlows.from("String_Node_Str").handle(ftpOutboundGateway()).channel(remoteFileOutputChannel()).get();
}
Program: 95477
Project: 95477
Buggy source:
@Override public void start(Stage primaryStage) throws Exception {
  MazePane pane=new MazePane(8,100);
  HBox hBox=new HBox(20,pane.btnFindPath,pane.btnClearPath);
  hBox.setAlignment(Pos.BASELINE_CENTER);
  hBox.setPadding(new Insets(10));
  BorderPane borderPane=new BorderPane(pane);
  borderPane.setBottom(hBox);
  Scene scene=new Scene(borderPane);
  primaryStage.setScene(scene);
  primaryStage.setTitle("String_Node_Str");
  primaryStage.show();
}

Fixed version (ground truth):
@Override public void start(Stage primaryStage) throws Exception {
  MazePane pane=new MazePane(8,100);
  HBox hBox=new HBox(20,pane.btnFindPath,pane.btnClearPath,pane.btnClearMarks);
  hBox.setAlignment(Pos.BASELINE_CENTER);
  hBox.setPadding(new Insets(10));
  BorderPane borderPane=new BorderPane(pane);
  borderPane.setBottom(hBox);
  Scene scene=new Scene(borderPane);
  primaryStage.setScene(scene);
  primaryStage.setTitle("String_Node_Str");
  primaryStage.show();
}
Program: 95478
Project: 95478
Buggy source:
MazePane(int size,int width){
  squares=new SquarePane[size][size];
  for (int i=0; i < squares.length; i++) {
    for (int k=0; k < squares[i].length; k++) {
      squares[i][k]=new SquarePane(width);
      add(squares[i][k],k,i);
    }
  }
  btnClearPath.setOnMouseClicked(e -> clearPath());
  btnFindPath.setOnAction(e -> findPath());
  setPadding(new Insets(10));
}

Fixed version (ground truth):
MazePane(int size,int width){
  squares=new SquarePane[size][size];
  for (int i=0; i < squares.length; i++) {
    for (int k=0; k < squares[i].length; k++) {
      squares[i][k]=new SquarePane(width);
      add(squares[i][k],k,i);
    }
  }
  squares[0][0].setDisable(true);
  squares[size - 1][size - 1].setDisable(true);
  btnClearPath.setOnMouseClicked(e -> clearPath());
  btnFindPath.setOnMouseClicked(e -> findPath());
  btnClearMarks.setOnMouseClicked(e -> clearMarks());
  setPadding(new Insets(10));
}
Program: 95479
Project: 95479
Buggy source:
private boolean findPath(int x,int y){
  squares[y][x].isFilled=true;
  if (isSquareRoute(x,y)) {
    squares[y][x].isFilled=false;
    return false;
  }
  if (x == squares[0].length - 1 && y == squares.length - 1) {
    squares[0][0].fillSquare();
    squares[y][x].fillSquare();
    return true;
  }
  if (x < squares.length - 1 && !squares[y][x + 1].isMarked() && !squares[y][x + 1].isFilled()) {
    if (findPath(x + 1,y)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (y < squares.length - 1 && !squares[y + 1][x].isMarked() && !squares[y + 1][x].isFilled()) {
    if (findPath(x,y + 1)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (x > 0 && !squares[y][x - 1].isMarked() && !squares[y][x - 1].isFilled()) {
    if (findPath(x - 1,y)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (y > 0 && !squares[y - 1][x].isMarked() && !squares[y - 1][x].isFilled()) {
    if (findPath(x,y - 1)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  squares[y][x].isFilled=false;
  return false;
}

Fixed version (ground truth):
private boolean findPath(int x,int y){
  squares[y][x].isFilled=true;
  if (isSquareRoute(x,y)) {
    squares[y][x].isFilled=false;
    return false;
  }
  if (x == squares[0].length - 1 && y == squares.length - 1) {
    squares[y][x].fillSquare();
    return true;
  }
  if (x < squares.length - 1 && !squares[y][x + 1].isMarked() && !squares[y][x + 1].isFilled()) {
    if (findPath(x + 1,y)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (y < squares.length - 1 && !squares[y + 1][x].isMarked() && !squares[y + 1][x].isFilled()) {
    if (findPath(x,y + 1)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (x > 0 && !squares[y][x - 1].isMarked() && !squares[y][x - 1].isFilled()) {
    if (findPath(x - 1,y)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  if (y > 0 && !squares[y - 1][x].isMarked() && !squares[y - 1][x].isFilled()) {
    if (findPath(x,y - 1)) {
      squares[y][x].fillSquare();
      return true;
    }
  }
  squares[y][x].isFilled=false;
  return false;
}
Program: 95480
Project: 95480
Buggy source:
private void toggleX(){
  ObservableList<Node> list=this.getChildren();
  if (list.size() > 1) {
    list.clear();
  }
 else {
    list.addAll(new Line(0,0,getWidth(),getHeight()),new Line(getWidth(),0,0,getHeight()));
  }
}

Fixed version (ground truth):
private void toggleX(){
  ObservableList<Node> list=this.getChildren();
  if (list.size() > 0) {
    list.clear();
  }
 else {
    list.addAll(new Line(0,0,getWidth(),getHeight()),new Line(getWidth(),0,0,getHeight()));
  }
}
Program: 95481
Project: 95481
Buggy source:
private void clearPath(){
  x=0;
  y=0;
  for (int i=0; i < squares.length; i++) {
    for (int k=0; k < squares[i].length; k++) {
      if (!squares[i][k].isMarked()) {
        squares[i][k].reset();
      }
    }
  }
}

Fixed version (ground truth):
private void clearPath(){
  setStyle("String_Node_Str");
  isFilled=false;
}
Program: 95483
Project: 95483
Buggy source:
@Override public void attributeAdded(final AttributeEvent<T> event){
  present=true;
  val=(int)event.getValue();
}

Fixed version (ground truth):
@Override public void attributeAdded(final AttributeEvent<Integer> event){
  present=true;
  val=event.getValue();
}
Program: 95484
Project: 95484
Buggy source:
@Override public void attributeRemoved(final AttributeEvent<T> event){
  present=false;
}

Fixed version (ground truth):
@Override public void attributeRemoved(final AttributeEvent<Integer> event){
  present=false;
}
Program: 95485
Project: 95485
Buggy source:
@Override public void attributeChanged(final AttributeEvent<T> event){
  val=(int)event.getValue();
}

Fixed version (ground truth):
@Override public void attributeChanged(final AttributeEvent<Integer> event){
  val=event.getValue();
}
Program: 95486
Project: 95486
Buggy source:
@Override public MutableActionContext<T> scheduleForActor(final Action<T> action,final long initialDelay,final long period,final TimeUnit unit){
  if (engine.isStopped()) {
    return Actions.emptyActionContext();
  }
  final MutableActionContext<T> context;
synchronized (contexts) {
    context=engine.createContext(action);
    context.setActor(actor);
    context.setInitialDelay(initialDelay,unit);
    context.setPeriod(period,unit);
    contexts.add(new WeakReference<>(context));
  }
  context.schedule();
  return unmodifiableActionContext(context);
}

Fixed version (ground truth):
@Override public MutableActionContext<T> scheduleForActor(final Action<T> action,final long initialDelay,final long period,final TimeUnit unit){
  if (engine.isStopped()) {
    return Actions.emptyActionContext();
  }
  final MutableActionContext<T> context;
synchronized (contexts) {
    context=engine.createContext(action);
    context.setActor(actor);
    context.setInitialDelay(initialDelay,unit);
    context.setPeriod(period,unit);
    purge(false);
    contexts.add(new WeakReference<>(context));
  }
  context.schedule();
  return unmodifiableActionContext(context);
}
Program: 95487
Project: 95487
Buggy source:
/** 
 * Cancel all tasks scheduled to the current engine for the actor by this scheduler.
 */
@Override public void cancelAllScheduledForActor(){
synchronized (contexts) {
    final Iterator<WeakReference<ActionContext<T>>> it=contexts.iterator();
    while (it.hasNext()) {
      final ActionContext<T> cxt=it.next().get();
      if (cxt != null) {
        cxt.cancel();
      }
      it.remove();
    }
  }
}

Fixed version (ground truth):
/** 
 * Cancel all tasks scheduled to the current engine for the actor by this scheduler.
 */
@Override public void cancelAllScheduledForActor(){
synchronized (contexts) {
    purge(true);
  }
}
Program: 95488
Project: 95488
Buggy source:
@Override public boolean remove(final Object o){
  final Class<?> type=o.getClass();
  final TagsOfType tot=tags.get(type);
  if (tot == null) {
    return false;
  }
  tot.w.lock();
  try {
    if (tot.t.remove(tot)) {
      if (tot.t.isEmpty()) {
        tot.t=null;
        tags.remove(type);
      }
      return true;
    }
    return false;
  }
  finally {
    tot.w.unlock();
  }
}

Fixed version (ground truth):
@Override public boolean remove(final Object o){
  final Class<?> type=o.getClass();
  final TagsOfType tot=tags.get(type);
  if (tot == null) {
    return false;
  }
  tot.w.lock();
  try {
    if (tot.t.remove(o)) {
      if (tot.t.isEmpty()) {
        tot.t=null;
        tags.remove(type);
      }
      return true;
    }
    return false;
  }
  finally {
    tot.w.unlock();
  }
}
Program: 95489
Project: 95489
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T extends AgentWrapper>T wrap(final AgentWrapper agent,final Class<T> clazz){
  validateWrapper(clazz);
  return (T)Proxy.newProxyInstance(clazz.getClassLoader(),new Class[]{clazz},(p,m,a) -> {
    Object result=null;
    if (CACHED_METHODS.contains(m)) {
      result=m.invoke(agent,a);
    }
 else {
      final Class<? extends Attribute> attr=(Class<? extends Attribute>)((ParameterizedType)m.getGenericReturnType()).getActualTypeArguments()[0];
      if (a == null || a.length == 0) {
        result=agent.getAttribute(attr);
      }
 else {
        result=a[0] != null ? agent.associate((Attribute)a[0]) : agent.disassociate(attr);
      }
    }
    return result;
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T extends AgentWrapper>T wrap(final AgentWrapper agent,final Class<T> clazz){
  validateWrapper(clazz);
  return (T)Proxy.newProxyInstance(clazz.getClassLoader(),new Class[]{clazz},(p,m,a) -> {
    Object result=null;
    if (CACHED_METHODS.contains(m)) {
      result=m.invoke(agent,a);
    }
 else {
      final Type rt=m.getGenericReturnType();
      if (a == null || a.length == 0) {
        result=agent.getAttribute(getAttrClass(rt));
      }
 else {
        result=a[0] != null ? agent.associate((Attribute)a[0]) : agent.disassociate(getAttrClass(rt));
      }
    }
    return result;
  }
);
}
Program: 95490
Project: 95490
Buggy source:
public boolean canBlockStay(World world,BlockPos pos){
  return (world.getBlockState(pos.add(0,1,0)).getBlock() instanceof IAgriFluidComponent);
}

Fixed version (ground truth):
public boolean canBlockStay(World world,BlockPos pos){
  return WorldHelper.getTile(world,pos,TileEntitySprinkler.class).filter(TileEntitySprinkler::isConnected).isPresent();
}
Program: 95491
Project: 95491
Buggy source:
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  final int relMouseX=mouseX - this.guiLeft;
  final int relMouseY=mouseY - this.guiTop;
  final List<String> toolTips=new ArrayList<>();
  this.guis.getLast().onUpdateMouse(this,toolTips,relMouseX,relMouseY);
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  this.guis.getLast().onRenderForeground(this,toolTips,relMouseX,relMouseY);
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
  if (toolTips.size() > 0) {
    drawHoveringText(toolTips,relMouseX,relMouseY,fontRenderer);
  }
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
}

Fixed version (ground truth):
@Override protected void drawGuiContainerForegroundLayer(int mouseX,int mouseY){
  final int relMouseX=mouseX - this.guiLeft;
  final int relMouseY=mouseY - this.guiTop;
  this.guis.getLast().onUpdateMouse(this,relMouseX,relMouseY);
  GlStateManager.pushAttrib();
  GlStateManager.pushMatrix();
  this.guis.getLast().onRenderForeground(this,relMouseX,relMouseY);
  GlStateManager.popMatrix();
  GlStateManager.popAttrib();
}
Program: 95493
Project: 95493
Buggy source:
@Override public final synchronized void onRenderForeground(AgriGuiWrapper wrapper,List<String> tooltips,int relMouseX,int relMouseY){
  this.components.stream().filter(c -> c.isVisable()).peek(c -> onRenderComponent(wrapper,c,tooltips,relMouseX,relMouseY)).filter(c -> c.contains(relMouseX,relMouseY)).forEach(c -> onAddComponentToolTip(wrapper,c,tooltips,relMouseX,relMouseY));
  if (enableGuiInspector) {
    onRenderInspector(wrapper,tooltips,relMouseX,relMouseY);
  }
}

Fixed version (ground truth):
@Override public final synchronized void onRenderForeground(AgriGuiWrapper wrapper,int relMouseX,int relMouseY){
  this.components.stream().filter(c -> c.isVisable()).forEach(c -> onRenderComponent(wrapper,c,relMouseX,relMouseY));
}
Program: 95494
Project: 95494
Buggy source:
public final synchronized void onRenderComponent(AgriGuiWrapper wrapper,GuiComponent c,List<String> tooltips,int relMouseX,int relMouseY){
  c.renderComponent(wrapper);
  if (enableGuiInspector) {
    wrapper.drawRectangle(c.getBounds().x,c.getBounds().y,c.getBounds().width,c.getBounds().height,Color.MAGENTA.hashCode());
  }
}

Fixed version (ground truth):
public final synchronized void onRenderComponent(AgriGuiWrapper wrapper,GuiComponent c,int relMouseX,int relMouseY){
  c.renderComponent(wrapper);
  if (enableGuiInspector) {
    wrapper.drawRectangle(c.getBounds().x,c.getBounds().y,c.getBounds().width,c.getBounds().height,Color.MAGENTA.hashCode());
  }
}
Program: 95495
Project: 95495
Buggy source:
@Override public final synchronized void onUpdateMouse(AgriGuiWrapper wrapper,List<String> tooltips,int relMouseX,int relMouseY){
  if (this.lastMouseX != relMouseX || this.lastMouseY != relMouseY) {
    this.components.stream().filter(c -> c.isEnabled()).forEach(c -> c.onMouseMove(relMouseX,relMouseY));
    this.lastMouseX=relMouseX;
    this.lastMouseY=relMouseY;
  }
}

Fixed version (ground truth):
@Override public final synchronized void onUpdateMouse(AgriGuiWrapper wrapper,int relMouseX,int relMouseY){
  if (this.lastMouseX != relMouseX || this.lastMouseY != relMouseY) {
    this.components.stream().filter(c -> c.isEnabled()).forEach(c -> c.onMouseMove(relMouseX,relMouseY));
    this.lastMouseX=relMouseX;
    this.lastMouseY=relMouseY;
  }
}
Program: 95496
Project: 95496
Buggy source:
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return true;
  }
  TileEntityCrop crop=WorldHelper.getTile(world,pos,TileEntityCrop.class).orElse(null);
  if (crop == null) {
    return false;
  }
  if (heldItem == null) {
    crop.onHarvest(player);
    return true;
  }
  if (TypeHelper.isAnyType(heldItem.getItem(),ITEM_EXCLUDES)) {
    return false;
  }
  if (AgriApi.getFertilizerRegistry().hasAdapter(heldItem)) {
    Optional<IAgriFertilizer> fert=AgriApi.getFertilizerRegistry().valueOf(heldItem);
    return fert.isPresent() && fert.get().applyFertilizer(player,world,pos,crop,heldItem,crop.getRandom());
  }
  if (heldItem.getItem() == AgriItems.getInstance().CROPS) {
    if (crop.onApplyCrops(player) == MethodResult.SUCCESS) {
      if (!player.isCreative()) {
        heldItem.stackSize--;
      }
      return true;
    }
  }
  final Optional<AgriSeed> seed=AgriApi.getSeedRegistry().valueOf(heldItem);
  if (seed.isPresent()) {
    if (crop.onApplySeeds(player,seed.get()) == MethodResult.SUCCESS) {
      return true;
    }
  }
  crop.onHarvest(player);
  return true;
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,BlockPos pos,IBlockState state,EntityPlayer player,EnumHand hand,ItemStack heldItem,EnumFacing side,float hitX,float hitY,float hitZ){
  if (world.isRemote) {
    return true;
  }
  TileEntityCrop crop=WorldHelper.getTile(world,pos,TileEntityCrop.class).orElse(null);
  if (crop == null) {
    return false;
  }
  if (heldItem == null) {
    crop.onHarvest(player);
    return true;
  }
  if (TypeHelper.isAnyType(heldItem.getItem(),ITEM_EXCLUDES)) {
    return false;
  }
  if (AgriApi.getFertilizerRegistry().hasAdapter(heldItem)) {
    Optional<IAgriFertilizer> fert=AgriApi.getFertilizerRegistry().valueOf(heldItem);
    return fert.isPresent() && fert.get().applyFertilizer(player,world,pos,crop,heldItem,crop.getRandom());
  }
  if (heldItem.getItem() == AgriItems.getInstance().CROPS) {
    if (crop.onApplyCrops(player) == MethodResult.SUCCESS) {
      if (!player.isCreative()) {
        heldItem.stackSize--;
      }
      return true;
    }
  }
  final Optional<AgriSeed> seed=AgriApi.getSeedRegistry().valueOf(heldItem);
  if (seed.isPresent()) {
    if (crop.onApplySeeds(player,seed.get()) == MethodResult.SUCCESS) {
      StackHelper.decreaseStackSize(player,heldItem,1);
      return true;
    }
  }
  crop.onHarvest(player);
  return true;
}
Program: 95497
Project: 95497
Buggy source:
public static boolean hasKey(ItemStack stack,String... keys){
  return hasTag(stack) && NBTHelper.hasKey(stack.getTagCompound(),keys);
}

Fixed version (ground truth):
/** 
 * Determines if the given ItemStack has the given key(s) associated with its tag. In the case that the given stack or its tag is null, this method will always return false.
 * @see NBTHelper#hasKey(NBTTagCompound,String)
 * @param stack the stack to check for the given keys.
 * @param keys the keys to check for in the stack's tag.
 * @return {@literal true} if and only if the stack and its tag are non-nulland the tag has all of the given keys,  {@literal false} otherwise}.
 */
public static boolean hasKey(@Nullable ItemStack stack,@Nullable String... keys){
  return (stack != null) && NBTHelper.hasKey(stack.getTagCompound(),keys);
}
Program: 95498
Project: 95498
Buggy source:
public static int getSize(ItemStack stack){
  return (stack == null) ? 0 : stack.stackSize;
}

Fixed version (ground truth):
/** 
 * Fetches the size of a given stack in a null-safe manner.
 * @param stack the stack to get the size of.
 * @return the size of the given stack, or {@literal 0} if the given stackwas null.
 */
public static int getSize(@Nullable ItemStack stack){
  return (stack == null) ? 0 : stack.stackSize;
}
Program: 95499
Project: 95499
Buggy source:
public static List<ItemStack> fitToMaxSize(ItemStack stack){
  final List<ItemStack> items=new ArrayList<>();
  final int max=stack.getMaxStackSize();
  int total=stack.stackSize;
  while (total > 0) {
    ItemStack newStack=stack.copy();
    newStack.stackSize=Math.min(total,max);
    total=total - newStack.stackSize;
    items.add(newStack);
  }
  return items;
}

Fixed version (ground truth):
/** 
 * Breaks up an ItemStack into stacks that obey the maximum size limit set by the contained item.
 * @param stack the stack to break down.
 * @return a list containing the resulting stacks formed by decomposing thegiven stack into proper-sized stacks.
 */
@Nonnull public static List<ItemStack> fitToMaxSize(@Nullable ItemStack stack){
  if (stack == null) {
    return Collections.EMPTY_LIST;
  }
  if (stack.stackSize < 1) {
    return Collections.EMPTY_LIST;
  }
  int stackSize=stack.stackSize;
  final int maxSize=stack.getMaxStackSize();
  if (stack.stackSize <= maxSize) {
    Arrays.asList(stack);
  }
  final int totalStackCount=IntMath.divide(stackSize,maxSize,RoundingMode.UP);
  final List<ItemStack> stacks=new ArrayList<>(totalStackCount);
  while (stackSize > maxSize) {
    ItemStack partial=stack.copy();
    partial.stackSize=maxSize;
    stackSize=stackSize - maxSize;
    stacks.add(partial);
  }
  if (stackSize > 0) {
    ItemStack partial=stack.copy();
    partial.stackSize=stackSize;
    stacks.add(partial);
  }
  return stacks;
}
Program: 95500
Project: 95500
Buggy source:
public static boolean areEqual(ItemStack a,ItemStack b){
  return isValid(a,b) && a.getItem() == b.getItem() && (!a.getHasSubtypes() || a.getItemDamage() == b.getItemDamage()) && ItemStack.areItemStackTagsEqual(a,b);
}

Fixed version (ground truth):
/** 
 * Determines if the given ItemStacks are equal, as per the vanilla definition of ItemStack equality. Two item stacks, a & b, are considered equal if and only if either a & b are both null or a & b are both non-null and a's item, metadata, and tags equal b's item metadata, and tags. Notice, this method is simply a wrapper of  {@link ItemStack#areItemStacksEqual(ItemStack,ItemStack)}, with documentation added based off of bytecode analysis.
 * @param a the stack to compare equality against.
 * @param b the stack to check for equality.
 * @return {@literal true} if and only if a is considered to equivalent tob,  {@literal false} otherwise.
 */
public static boolean areEqual(@Nullable ItemStack a,@Nullable ItemStack b){
  return ItemStack.areItemStacksEqual(a,b);
}
Program: 95501
Project: 95501
Buggy source:
public static boolean hasTag(ItemStack stack){
  return isValid(stack) && stack.hasTagCompound();
}

Fixed version (ground truth):
/** 
 * Determines if the given ItemStack has a non-null NBTTagCompound currently associated with it.
 * @param stack the stack to check if has a non-null NBTTagCompound.
 * @return {@literal true} if and only if the given ItemStack is non-nulland ItemStack#getTagCompound() returns a non-null value,  {@literal false}otherwise.
 */
public static boolean hasTag(@Nullable ItemStack stack){
  return (stack != null) && (stack.getTagCompound() != null);
}
Program: 95502
Project: 95502
Buggy source:
public static boolean isValid(ItemStack stack,Class... itemClasses){
  return isValid(stack) && TypeHelper.isAllTypes(stack.getItem(),itemClasses);
}

Fixed version (ground truth):
/** 
 * Determines if a given ItemStack is valid and matches <em>all</em> the given Item type. An ItemStack is considered valid if and only if it is not null, its item is not null, its item matches <em>all</em> the given types, and its amount is greater than zero.
 * @param stack the ItemStack to determine if valid.
 * @param itemClasses all the classed that the item contained in theItemStack must match.
 * @return {@literal true} if and only if the given ItemStack is consideredvalid as per the method's description,  {@literal false} otherwise.
 */
public static boolean isValid(ItemStack stack,Class<?>... itemClasses){
  return isValid(stack) && TypeHelper.isAllTypes(stack.getItem(),itemClasses);
}
Program: 95503
Project: 95503
Buggy source:
public static NBTTagCompound getTag(ItemStack stack){
  if (hasTag(stack)) {
    return stack.getTagCompound();
  }
 else {
    NBTTagCompound tag=new NBTTagCompound();
    stack.setTagCompound(tag);
    return tag;
  }
}

Fixed version (ground truth):
/** 
 * Fetches the tag associated with a given stack, or associates and returns a new NBTTag compound to the stack.
 * @param stack the stack to get the tag from.
 * @return
 */
@Nonnull public static NBTTagCompound getTag(@Nonnull ItemStack stack){
  Objects.requireNonNull(stack,"String_Node_Str");
  NBTTagCompound tag=stack.getTagCompound();
  if (tag == null) {
    tag=new NBTTagCompound();
    stack.setTagCompound(tag);
  }
  return tag;
}