nus-yam/ex-repair huggingface dataset:
Program: 5413
Project: 5413
Buggy source:
@Override public void onPlayerMove(PlayerMoveEvent event){
  Block b;
  Player player=event.getPlayer();
  if (Nethrar.permissions != null && !Nethrar.permissions.has(player,"String_Node_Str")) {
    return;
  }
  if (!event.getPlayer().isInsideVehicle()) {
    b=event.getTo().getBlock();
  }
 else {
    b=event.getTo().getBlock().getFace(BlockFace.UP);
  }
  if (!b.getType().equals(Material.PORTAL)) {
    return;
  }
  Portal portal=PortalUtil.getPortalAt(b);
  if (portal != null) {
    Location endpoint=portal.teleport(player);
    if (endpoint != null) {
      event.setTo(endpoint);
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerMove(PlayerMoveEvent event){
  Block b;
  Player player=event.getPlayer();
  if (Nethrar.permissions != null && !Nethrar.permissions.has(player,"String_Node_Str")) {
    return;
  }
  if (!event.getPlayer().isInsideVehicle()) {
    b=event.getTo().getBlock();
  }
 else {
    b=event.getTo().getBlock().getFace(BlockFace.UP);
  }
  if (!b.getType().equals(Material.PORTAL)) {
    return;
  }
  Portal portal=PortalUtil.getPortalAt(b);
  if (portal != null) {
    Location endpoint=portal.teleport(player,event.getTo());
    if (endpoint != null) {
      event.setTo(endpoint);
    }
  }
}
Program: 5414
Project: 5414
Buggy source:
@Override public void onVehicleMove(VehicleMoveEvent event){
  Block b;
  Vehicle vehicle=event.getVehicle();
  if (vehicle.getPassenger() != null) {
    return;
  }
  b=vehicle.getLocation().getBlock();
  if (!b.getType().equals(Material.PORTAL)) {
    return;
  }
  Portal portal=PortalUtil.getPortalAt(b);
  portal.teleport(vehicle);
}

Fixed version (ground truth):
@Override public void onVehicleMove(VehicleMoveEvent event){
  Block b;
  Vehicle vehicle=event.getVehicle();
  if (vehicle.getPassenger() != null) {
    return;
  }
  b=vehicle.getLocation().getBlock();
  if (!b.getType().equals(Material.PORTAL)) {
    return;
  }
  Portal portal=PortalUtil.getPortalAt(b);
  portal.teleport(vehicle,event.getTo());
}
Program: 5417
Project: 5417
Buggy source:
@Override public void flush() throws IOException {
  stream.flush();
}

Fixed version (ground truth):
@Override public void flush(){
  stream.flush();
}
Program: 5418
Project: 5418
Buggy source:
@Override public void close() throws IOException {
  stream.close();
}

Fixed version (ground truth):
@Override public void close(){
  stream.close();
}
Program: 5419
Project: 5419
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeBitField(ByteBuffer buffer,BitFieldMessage msg){
  BitSet bitfield=msg.getBitField();
  int nbytes=(bitfield.size() + 7) / 8;
  byte[] bytes=new byte[nbytes];
  for (int i=0; i < nbytes * 8; i++) {
    if (bitfield.get(i)) {
      int bInd=i % 8;
      int bMask=1 << (7 - (i / 8));
      bytes[bInd]|=bMask;
    }
  }
  buffer.putInt(nbytes + 1);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.put(bytes);
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeBitField(ByteBuffer buffer,BitFieldMessage msg){
  BitSet bitfield=msg.getBitField();
  int nbytes=(bitfield.size() + 7) / 8;
  byte[] bytes=new byte[nbytes];
  for (int i=0; i < nbytes * 8; i++) {
    if (bitfield.get(i)) {
      int bInd=i % 8;
      int bMask=1 << (7 - (i / 8));
      bytes[bInd]|=bMask;
    }
  }
  buffer.putInt(nbytes + 1);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.put(bytes);
}
Program: 5420
Project: 5420
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeRequest(ByteBuffer buffer,RequestMessage msg){
  buffer.putInt(13);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.putInt(msg.getLength());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeRequest(ByteBuffer buffer,RequestMessage msg){
  buffer.putInt(13);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.putInt(msg.getLength());
}
Program: 5421
Project: 5421
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeHave(ByteBuffer buffer,HaveMessage msg){
  buffer.putInt(5);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getPieceIndex());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeHave(ByteBuffer buffer,HaveMessage msg){
  buffer.putInt(5);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getPieceIndex());
}
Program: 5422
Project: 5422
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodePort(ByteBuffer buffer,PortMessage msg){
  buffer.putInt(3);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putShort((short)msg.getPort());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodePort(ByteBuffer buffer,PortMessage msg){
  buffer.putInt(3);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putShort((short)msg.getPort());
}
Program: 5423
Project: 5423
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeCancel(ByteBuffer buffer,CancelMessage msg){
  buffer.putInt(13);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.putInt(msg.getLength());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeCancel(ByteBuffer buffer,CancelMessage msg){
  buffer.putInt(13);
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.putInt(msg.getLength());
}
Program: 5424
Project: 5424
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeHandShakeStart(ByteBuffer buffer,HandShakeStart msg){
  buffer.put((byte)msg.getProtocolName().length());
  buffer.put(msg.getProtocolName().getBytes(ISO_8859_1));
  byte[] bits=new byte[8];
  BitSet flags=msg.getFlags();
  for (int i=0; i < 64; i++) {
    if (flags.get(i)) {
      int bInd=7 - (i / 8);
      int bMask=1 << (i % 8);
      bits[bInd]|=bMask;
    }
  }
  buffer.put(msg.getHash().getBytes());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeHandShakeStart(ByteBuffer buffer,HandShakeStart msg){
  buffer.put((byte)msg.getProtocolName().length());
  buffer.put(msg.getProtocolName().getBytes(ISO_8859_1));
  byte[] bits=new byte[8];
  BitSet flags=msg.getFlags();
  for (int i=0; i < 64; i++) {
    if (flags.get(i)) {
      int bInd=7 - (i / 8);
      int bMask=1 << (i % 8);
      bits[bInd]|=bMask;
    }
  }
  buffer.put(bits);
  buffer.put(msg.getHash().getBytes());
}
Program: 5425
Project: 5425
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodePiece(ByteBuffer buffer,PieceMessage msg){
  ByteBuffer contents=msg.getPieceContents();
  contents.rewind().limit(contents.capacity());
  buffer.putInt(9 + contents.capacity());
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.put(contents);
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodePiece(ByteBuffer buffer,PieceMessage msg){
  ByteBuffer contents=msg.getPieceContents();
  contents.rewind().limit(contents.capacity());
  buffer.putInt(9 + contents.capacity());
  buffer.put((byte)msg.getMessageType().getId());
  buffer.putInt(msg.getIndex());
  buffer.putInt(msg.getOffset());
  buffer.put(contents);
}
Program: 5426
Project: 5426
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private void encodeHandShakeEnd(ByteBuffer buffer,HandShakeEnd msg){
  buffer.put(msg.getPeerId());
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt>
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 */
private static void encodeHandShakeEnd(ByteBuffer buffer,HandShakeEnd msg){
  buffer.put(msg.getPeerId());
}
Program: 5427
Project: 5427
Buggy source:
/** 
 * Encodes the given message into the given <tt>buffer</tt> in the format specified in the BitTorrent protocol specification. <p> If this method throws a   {@link BufferOverflowException}, the actual amount of bytes written into the buffer is not determined.
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws NullPointerException if any of the arguments is <tt>null</tt>
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 * @throws IllegalArgumentException if <tt>msg</tt> is not a valid message
 */
public void encodeMessageToBuffer(ByteBuffer buffer,BitTorrentMessage msg){
switch (msg.getMessageType()) {
case KEEP_ALIVE:
    buffer.putInt(0);
  break;
case CHOKE:
case UNCHOKE:
case INTERESTED:
case UNINTERESTED:
buffer.putInt(1);
buffer.put((byte)msg.getMessageType().getId());
break;
case HANDSHAKE_START:
encodeHandShakeStart(buffer,(HandShakeStart)msg);
break;
case HANDSHAKE_END:
encodeHandShakeEnd(buffer,(HandShakeEnd)msg);
break;
case HAVE:
encodeHave(buffer,(HaveMessage)msg);
break;
case BITFIELD:
encodeBitField(buffer,(BitFieldMessage)msg);
break;
case REQUEST:
encodeRequest(buffer,(RequestMessage)msg);
break;
case PIECE:
encodePiece(buffer,(PieceMessage)msg);
break;
case CANCEL:
encodeCancel(buffer,(CancelMessage)msg);
break;
case PORT:
encodePort(buffer,(PortMessage)msg);
break;
default :
throw new IllegalArgumentException();
}
}

Fixed version (ground truth):
/** 
 * Encodes the given message into the given <tt>buffer</tt> in the format specified in the BitTorrent protocol specification. <p> If this method throws a   {@link BufferOverflowException}, the actual amount of bytes written into the buffer is not determined.
 * @param buffer Destination buffer
 * @param msg Message to encode
 * @throws NullPointerException if any of the arguments is <tt>null</tt>
 * @throws BufferOverflowException if there is not enough space to encodethe full message
 * @throws IllegalArgumentException if <tt>msg</tt> is not a valid message
 */
public static void encodeMessageToBuffer(ByteBuffer buffer,BitTorrentMessage msg){
switch (msg.getMessageType()) {
case KEEP_ALIVE:
    buffer.putInt(0);
  break;
case CHOKE:
case UNCHOKE:
case INTERESTED:
case UNINTERESTED:
buffer.putInt(1);
buffer.put((byte)msg.getMessageType().getId());
break;
case HANDSHAKE_START:
encodeHandShakeStart(buffer,(HandShakeStart)msg);
break;
case HANDSHAKE_END:
encodeHandShakeEnd(buffer,(HandShakeEnd)msg);
break;
case HAVE:
encodeHave(buffer,(HaveMessage)msg);
break;
case BITFIELD:
encodeBitField(buffer,(BitFieldMessage)msg);
break;
case REQUEST:
encodeRequest(buffer,(RequestMessage)msg);
break;
case PIECE:
encodePiece(buffer,(PieceMessage)msg);
break;
case CANCEL:
encodeCancel(buffer,(CancelMessage)msg);
break;
case PORT:
encodePort(buffer,(PortMessage)msg);
break;
default :
throw new IllegalArgumentException();
}
}
Program: 5428
Project: 5428
Buggy source:
/** 
 * Constructs this message with the given peer ID.
 * @param peerId Peer ID of this handshake
 * @throws NullPointerException if <tt>peerId</tt> is <tt>null</tt>
 * @throws IllegalArgumentException if <tt>peerId</tt> has a lengthdifferent than 20
 */
public HandShakeEnd(byte[] peerId){
  if (peerId.length != 20) {
    throw new IllegalArgumentException();
  }
  this.peerId=Arrays.copyOf(peerId,peerId.length);
}

Fixed version (ground truth):
/** 
 * Constructs this message with the given peer ID.
 * @param peerId Peer ID of this handshake
 * @throws NullPointerException if <tt>peerId</tt> is <tt>null</tt>
 * @throws IllegalArgumentException if <tt>peerId</tt> has a lengthdifferent than 20
 */
public HandShakeEnd(byte[] peerId){
  if (peerId.length != 20) {
    throw new IllegalArgumentException();
  }
  this.peerId=Arrays.copyOf(peerId,peerId.length);
  strPeerId=new String(peerId,Charset.forName("String_Node_Str"));
}
Program: 5430
Project: 5430
Buggy source:
/** 
 * Constructs this object using every piece of information needed.
 * @param pieceLength Nominal length of every piece
 * @param pieceHashes List of SHA-1 hashes of all pieces
 * @param priv Whether this is a private torrent
 * @param baseDir The advised base directory name
 * @param files List of file information
 * @param hash SHA-1 hash of the info section
 * @throws NullPointerException if some argument is <tt>null</tt> orcontains a <tt>null</tt>
 * @throws IllegalArgumentException if <tt>pieceLength</tt> is negative
 */
protected TorrentInfoSection(long pieceLength,List<Sha1Hash> pieceHashes,boolean priv,String baseDir,List<TorrentFileInfo> files,Sha1Hash hash){
  if (baseDir == null | hash == null | pieceHashes.contains(null) | files.contains(null)) {
    throw new NullPointerException();
  }
  if (pieceLength < 0) {
    throw new IllegalArgumentException();
  }
  this.pieceLength=pieceLength;
  this.priv=priv;
  this.baseDir=baseDir;
  this.hash=hash;
  this.pieceHashes=Collections.unmodifiableList(new ArrayList<Sha1Hash>(pieceHashes));
  this.files=Collections.unmodifiableList(new ArrayList<TorrentFileInfo>(files));
}

Fixed version (ground truth):
/** 
 * Constructs this object using every piece of information needed.
 * @param pieceLength Nominal length of every piece
 * @param pieceHashes List of SHA-1 hashes of all pieces
 * @param priv Whether this is a private torrent
 * @param baseDir The advised base directory name
 * @param files List of file information
 * @param hash SHA-1 hash of the info section
 * @throws NullPointerException if some argument is <tt>null</tt> orcontains a <tt>null</tt>
 * @throws IllegalArgumentException if <tt>pieceLength</tt> is negative
 */
private TorrentInfoSection(long pieceLength,List<Sha1Hash> pieceHashes,boolean priv,String baseDir,List<TorrentFileInfo> files,Sha1Hash hash,String name){
  if (baseDir == null | hash == null | name == null | pieceHashes.contains(null) | files.contains(null)) {
    throw new NullPointerException();
  }
  if (pieceLength < 0) {
    throw new IllegalArgumentException();
  }
  this.pieceLength=pieceLength;
  this.priv=priv;
  this.baseDir=baseDir;
  this.hash=hash;
  this.pieceHashes=Collections.unmodifiableList(new ArrayList<Sha1Hash>(pieceHashes));
  this.files=Collections.unmodifiableList(new ArrayList<TorrentFileInfo>(files));
  this.name=name;
}
Program: 5431
Project: 5431
Buggy source:
/** 
 * Checks if this object is equal to the given <tt>obj</tt>. <p> This object is only equal to a <tt>TorrentInfoSection</tt> object that holds the same information and was created using a bencode value equivalent to the bencode value that created this object.
 */
@Override public boolean equals(Object obj){
  if (!(obj instanceof TorrentInfoSection)) {
    return false;
  }
  TorrentInfoSection tis=(TorrentInfoSection)obj;
  return hash.equals(tis.hash) && pieceLength == tis.pieceLength && priv == tis.priv && pieceHashes.equals(tis.pieceHashes) && baseDir.equals(tis.baseDir) && files.equals(tis.files);
}

Fixed version (ground truth):
/** 
 * Checks if this object is equal to the given <tt>obj</tt>. <p> This object is only equal to a <tt>TorrentInfoSection</tt> object that holds the same information and was created using a bencode value equivalent to the bencode value that created this object.
 */
@Override public boolean equals(Object obj){
  if (!(obj instanceof TorrentInfoSection)) {
    return false;
  }
  TorrentInfoSection tis=(TorrentInfoSection)obj;
  return hash.equals(tis.hash) && name.equals(tis.name) && pieceLength == tis.pieceLength && priv == tis.priv && pieceHashes.equals(tis.pieceHashes) && baseDir.equals(tis.baseDir) && files.equals(tis.files);
}
Program: 5432
Project: 5432
Buggy source:
/** 
 * Returns a tracker that sends its request to the specified URLs in the torrent. <p> Whether the returned object uses the <tt>announce</tt> or the <tt>announce-list</tt> values depends on the object passed and the implementation availability. In general, the best possible method is chosen for each torrent.
 * @param torrent Torrent meta-info used to build the tracker
 * @return A tracker that announces to the corresponding URL
 * @throws MalformedURLException if the URL or URLs used are not valid
 */
public static Tracker forTorrent(TorrentMetaInfo torrent) throws MalformedURLException {
  return getSingleTracker(torrent.getAnnounce());
}

Fixed version (ground truth):
/** 
 * Returns a tracker that sends its request to the specified URLs in the torrent. <p> Whether the returned object uses the <tt>announce</tt> or the <tt>announce-list</tt> values depends on the object passed and the implementation availability. In general, the best possible method is chosen for each torrent.
 * @param torrent Torrent meta-info used to build the tracker
 * @return A tracker that announces to the corresponding URL
 * @throws MalformedURLException if the URL or URLs used are not valid
 */
public static Tracker forTorrent(TorrentMetaInfo torrent) throws MalformedURLException {
  if (torrent.getAnnounceList().isEmpty()) {
    return getSingleTracker(torrent.getAnnounce());
  }
 else {
    return getMultiTracker(torrent.getAnnounceList());
  }
}
Program: 5434
Project: 5434
Buggy source:
/** 
 * Returns a <tt>Tracker</tt> object that send its request to the given announce URLs, in order, until one of them is successfull. <p> The passed object is treated as the <tt>announce-list</tt> key of a  torrent, and behaves like it. <p> <i><b>Note:</b> This mehtod is currently unimplemented and returns <tt>null</tt>. A <tt>Tacker</tt> implementation that matches the requirements of this method is needed.</i>
 * @param announces List of announce URLs
 * @return A tracker which announces to the given URL list
 */
@SuppressWarnings("String_Node_Str") private static Tracker getMultiTracker(List<Set<String>> announces){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a <tt>Tracker</tt> object that send its request to the given announce URLs, in order, until one of them is successfull. <p> The passed object is treated as the <tt>announce-list</tt> key of a  torrent, and behaves like it.
 * @param announces List of announce URLs
 * @return A tracker which announces to the given URL list
 */
private static Tracker getMultiTracker(List<Set<String>> announces){
  return new MultiTracker(announces);
}
Program: 5435
Project: 5435
Buggy source:
/** 
 * @return the tracker ID set for this request
 */
public byte[] getTrackerId(){
  return Arrays.copyOf(trackerId,trackerId.length);
}

Fixed version (ground truth):
/** 
 * @return the tracker ID set for this request
 */
public byte[] getTrackerId(){
  return (trackerId == null) ? null : Arrays.copyOf(trackerId,trackerId.length);
}
Program: 5436
Project: 5436
Buggy source:
/** 
 * Creates a new response with the given arguments.
 * @param failed Whether the request failed
 * @param failureReason Failure reason
 * @param warning Warning message
 * @param interval Normal announce interval
 * @param minInterval Minimum announce interval
 * @param trackerId Tracker ID
 * @param complete Number of seeders
 * @param incomplete Number of leechers
 * @param peers List of peers
 */
private TrackerResponse(boolean failed,String failureReason,String warning,long interval,long minInterval,byte[] trackerId,long complete,long incomplete,List<PeerInfo> peers){
  this.failed=failed;
  if (failed) {
    if (failureReason == null) {
      throw new NullPointerException();
    }
    this.failureReason=failureReason;
    this.warning=(warning == null) ? "String_Node_Str" : warning;
    this.interval=0;
    this.minInterval=0;
    this.trackerId=null;
    this.complete=0;
    this.incomplete=0;
    this.peers=Collections.emptyList();
  }
 else {
    if (peers == null) {
      throw new NullPointerException();
    }
    this.failureReason="String_Node_Str";
    this.warning=(warning == null) ? "String_Node_Str" : warning;
    this.interval=interval;
    this.minInterval=minInterval;
    this.trackerId=Arrays.copyOf(trackerId,trackerId.length);
    this.complete=complete;
    this.incomplete=incomplete;
    this.peers=Collections.unmodifiableList(new ArrayList<PeerInfo>(peers));
  }
}

Fixed version (ground truth):
/** 
 * Creates a new response with the given arguments.
 * @param failed Whether the request failed
 * @param failureReason Failure reason
 * @param warning Warning message
 * @param interval Normal announce interval
 * @param minInterval Minimum announce interval
 * @param trackerId Tracker ID
 * @param complete Number of seeders
 * @param incomplete Number of leechers
 * @param peers List of peers
 */
private TrackerResponse(boolean failed,String failureReason,String warning,long interval,long minInterval,byte[] trackerId,long complete,long incomplete,List<PeerInfo> peers){
  this.failed=failed;
  if (failed) {
    if (failureReason == null) {
      throw new NullPointerException();
    }
    this.failureReason=failureReason;
    this.warning=(warning == null) ? "String_Node_Str" : warning;
    this.interval=0;
    this.minInterval=0;
    this.trackerId=null;
    this.complete=0;
    this.incomplete=0;
    this.peers=Collections.emptyList();
  }
 else {
    if (peers == null) {
      throw new NullPointerException();
    }
    this.failureReason="String_Node_Str";
    this.warning=(warning == null) ? "String_Node_Str" : warning;
    this.interval=interval;
    this.minInterval=minInterval;
    this.trackerId=trackerId == null ? null : Arrays.copyOf(trackerId,trackerId.length);
    this.complete=complete;
    this.incomplete=incomplete;
    this.peers=Collections.unmodifiableList(new ArrayList<PeerInfo>(peers));
  }
}
Program: 5437
Project: 5437
Buggy source:
@Override public void onEnable(){
  String dataStoreMethod;
  pluginDataPath=this.getDataFolder().getAbsolutePath() + File.separator;
  File dataPath=new File(pluginDataPath);
  if (!dataPath.exists()) {
    dataPath.mkdirs();
  }
  if (!HomePermissions.initialize(this))   return;
  disableEssentials();
  Settings.initialize(this);
  Settings.loadSettings();
  MultiHomeEconManager.initialize(this);
  dataStoreMethod=Settings.getDataStoreMethod();
  if (dataStoreMethod.compareToIgnoreCase("String_Node_Str") == 0) {
    this.homes=new HomeManagerFile(this);
    this.invites=new InviteManagerFile(this);
    this.warmups=new WarmUpManagerFile(this);
    this.cooldowns=new CoolDownManagerFile(this);
  }
 else   if (dataStoreMethod.compareToIgnoreCase("String_Node_Str") == 0) {
    this.homes=new HomeManagerMySQL(this);
    this.invites=new InviteManagerMySQL(this);
    this.warmups=new WarmUpManagerMySQL(this);
    this.cooldowns=new CoolDownManagerMySQL(this);
  }
 else {
    this.homes=new HomeManagerFile(this);
    this.invites=new InviteManagerFile(this);
    this.warmups=new WarmUpManagerFile(this);
    this.cooldowns=new CoolDownManagerFile(this);
  }
  setupCommands();
  registerEvents();
  Messaging.logInfo("String_Node_Str" + this.getDescription().getVersion() + "String_Node_Str",this);
}

Fixed version (ground truth):
@Override public void onEnable(){
  String dataStoreMethod;
  pluginDataPath=this.getDataFolder().getAbsolutePath() + File.separator;
  File dataPath=new File(pluginDataPath);
  if (!dataPath.exists()) {
    dataPath.mkdirs();
  }
  if (!HomePermissions.initialize(this))   return;
  disableEssentials();
  Settings.initialize(this);
  Settings.loadSettings();
  MultiHomeEconManager.initialize(this);
  dataStoreMethod=Settings.getDataStoreMethod();
  if (dataStoreMethod.compareToIgnoreCase("String_Node_Str") == 0) {
    this.homes=new HomeManagerFile(this);
    this.invites=new InviteManagerFile(this);
    this.warmups=new WarmUpManagerFile(this);
    this.cooldowns=new CoolDownManagerFile(this);
    Messaging.logInfo("String_Node_Str",this);
  }
 else   if (dataStoreMethod.compareToIgnoreCase("String_Node_Str") == 0) {
    this.homes=new HomeManagerMySQL(this);
    this.invites=new InviteManagerMySQL(this);
    this.warmups=new WarmUpManagerMySQL(this);
    this.cooldowns=new CoolDownManagerMySQL(this);
    Messaging.logInfo("String_Node_Str",this);
  }
 else {
    this.homes=new HomeManagerFile(this);
    this.invites=new InviteManagerFile(this);
    this.warmups=new WarmUpManagerFile(this);
    this.cooldowns=new CoolDownManagerFile(this);
    Messaging.logInfo("String_Node_Str",this);
  }
  setupCommands();
  registerEvents();
  Messaging.logInfo("String_Node_Str" + this.getDescription().getVersion() + "String_Node_Str",this);
}
Program: 5438
Project: 5438
Buggy source:
@Override public void addHome(String player,String name,Location location){
  ArrayList<HomeEntry> homes;
  if (this.HomeEntrys.containsKey(player.toLowerCase())) {
    homes=this.HomeEntrys.get(player.toLowerCase());
  }
 else {
    homes=new ArrayList<HomeEntry>();
  }
  boolean homeSet=false;
  for (int index=0; index < homes.size(); index++) {
    HomeEntry thisHome=homes.get(index);
    if (thisHome.getHomeName().compareToIgnoreCase(name) == 0) {
      thisHome.setHomeLocation(location);
      homes.set(index,thisHome);
    }
  }
  if (!homeSet) {
    HomeEntry home=new HomeEntry(player,name.toLowerCase(),location);
    homes.add(home);
  }
  this.HomeEntrys.remove(player.toLowerCase());
  this.HomeEntrys.put(player.toLowerCase(),homes);
  this.saveHomes();
}

Fixed version (ground truth):
@Override public void addHome(String player,String name,Location location){
  ArrayList<HomeEntry> homes;
  if (this.HomeEntrys.containsKey(player.toLowerCase())) {
    homes=this.HomeEntrys.get(player.toLowerCase());
  }
 else {
    homes=new ArrayList<HomeEntry>();
  }
  boolean homeSet=false;
  for (int index=0; index < homes.size(); index++) {
    HomeEntry thisHome=homes.get(index);
    if (thisHome.getHomeName().compareToIgnoreCase(name) == 0) {
      thisHome.setHomeLocation(location);
      homes.set(index,thisHome);
      homeSet=true;
    }
  }
  if (!homeSet) {
    HomeEntry home=new HomeEntry(player,name.toLowerCase(),location);
    homes.add(home);
  }
  this.HomeEntrys.remove(player.toLowerCase());
  this.HomeEntrys.put(player.toLowerCase(),homes);
  this.saveHomes();
}
Program: 5440
Project: 5440
Buggy source:
public void setHomeLocation(Location homeLocation){
  this.homeLocation=homeLocation;
}

Fixed version (ground truth):
public void setHomeLocation(Location location){
  this.setWorld(location.getWorld().getName());
  this.setX(location.getX());
  this.setY(location.getY());
  this.setZ(location.getZ());
  this.setPitch(location.getPitch());
  this.setYaw(location.getYaw());
}
Program: 5441
Project: 5441
Buggy source:
public HomeLocation(String homeName,Location homeLocation){
  this.homeLocation=homeLocation;
  this.homeName=homeName;
}

Fixed version (ground truth):
public HomeLocation(String homeName,Location location){
  this.setHomeName(homeName);
  this.setWorld(location.getWorld().getName());
  this.setX(location.getX());
  this.setY(location.getY());
  this.setZ(location.getZ());
  this.setPitch(location.getPitch());
  this.setYaw(location.getYaw());
}
Program: 5442
Project: 5442
Buggy source:
public Location getHomeLocation(){
  return homeLocation;
}

Fixed version (ground truth):
public Location getHomeLocation(Server server){
  return new Location(server.getWorld(this.world),this.X,this.Y,this.Z,this.yaw,this.pitch);
}
Program: 5443
Project: 5443
Buggy source:
public Location getPlayerHomeLocation(Player player,String name){
  if (!homeLocations.containsKey(player.getName())) {
    return null;
  }
  ArrayList<HomeLocation> thisLocationList=homeLocations.get(player.getName());
  for (  HomeLocation thisLocation : thisLocationList) {
    if (thisLocation.getHomeName().compareToIgnoreCase(name) == 0) {
      return thisLocation.getHomeLocation();
    }
  }
  return null;
}

Fixed version (ground truth):
public Location getPlayerHomeLocation(Player player,String name){
  if (!homeLocations.containsKey(player.getName())) {
    return null;
  }
  ArrayList<HomeLocation> thisLocationList=homeLocations.get(player.getName());
  for (  HomeLocation thisLocation : thisLocationList) {
    if (thisLocation.getHomeName().compareToIgnoreCase(name) == 0) {
      return thisLocation.getHomeLocation(getServer());
    }
  }
  return null;
}
Program: 5445
Project: 5445
Buggy source:
public void saveHomes(){
  File file=new File(homesPath);
  if (!(file.exists())) {
    file.mkdir();
  }
  try {
    FileWriter fstream=new FileWriter(homesPath + homesFile);
    BufferedWriter writer=new BufferedWriter(fstream);
    writer.write("String_Node_Str");
    writer.newLine();
    writer.write("String_Node_Str");
    writer.newLine();
    writer.newLine();
    for (    Entry<String,ArrayList<HomeLocation>> entry : homeLocations.entrySet()) {
      for (      HomeLocation thisLocation : entry.getValue()) {
        Location loc=thisLocation.getHomeLocation();
        writer.write(entry.getKey() + "String_Node_Str" + loc.getX()+ "String_Node_Str"+ loc.getBlockY()+ "String_Node_Str"+ loc.getBlockZ()+ "String_Node_Str"+ loc.getPitch()+ "String_Node_Str"+ loc.getYaw()+ "String_Node_Str"+ loc.getWorld().getName()+ "String_Node_Str"+ thisLocation.getHomeName());
        writer.newLine();
      }
    }
    writer.close();
  }
 catch (  Exception e) {
    log.severe(pdfFile.getName() + "String_Node_Str");
    this.getServer().getPluginManager().disablePlugin(this);
  }
}

Fixed version (ground truth):
public void saveHomes(){
  File file=new File(homesPath);
  if (!(file.exists())) {
    file.mkdir();
  }
  try {
    FileWriter fstream=new FileWriter(homesPath + homesFile);
    BufferedWriter writer=new BufferedWriter(fstream);
    writer.write("String_Node_Str");
    writer.newLine();
    writer.write("String_Node_Str");
    writer.newLine();
    writer.newLine();
    for (    Entry<String,ArrayList<HomeLocation>> entry : homeLocations.entrySet()) {
      for (      HomeLocation thisLocation : entry.getValue()) {
        writer.write(entry.getKey() + "String_Node_Str" + thisLocation.getX()+ "String_Node_Str"+ thisLocation.getY()+ "String_Node_Str"+ thisLocation.getZ()+ "String_Node_Str"+ thisLocation.getPitch()+ "String_Node_Str"+ thisLocation.getYaw()+ "String_Node_Str"+ thisLocation.getWorld()+ "String_Node_Str"+ thisLocation.getHomeName());
        writer.newLine();
      }
    }
    writer.close();
  }
 catch (  Exception e) {
    log.severe(pdfFile.getName() + "String_Node_Str");
    e.printStackTrace();
  }
}
Program: 5447
Project: 5447
Buggy source:
@Override public void onEnable(){
  this.pdfFile=this.getDescription();
  this.homesPath="String_Node_Str" + File.separator + pdfFile.getName()+ File.separator;
  loadHomes();
  setupPermissions();
  log.info(pdfFile.getName() + "String_Node_Str" + pdfFile.getVersion()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onEnable(){
  this.pdfFile=this.getDescription();
  this.homesPath=this.getDataFolder().getAbsolutePath() + File.separator;
  setupHelp();
  loadHomes();
  setupPermissions();
  log.info(pdfFile.getName() + "String_Node_Str" + pdfFile.getVersion()+ "String_Node_Str");
}
Program: 5450
Project: 5450
Buggy source:
/** 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d("String_Node_Str");
  setResult(RESULT_CANCELED);
  mAppWidgetId=getIntent().getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  Log.d("String_Node_Str" + mAppWidgetId);
  AuthenticateActivity.registerAppParameters(this,getString(R.string.api_key),getString(R.string.api_secret),getString(R.string.auth_url));
  RestClient.setAuth(this);
  mFlickrLibraryPrefs=getSharedPreferences(GlobalResources.PREFERENCES_ID,0);
  if (APICalls.authCheckToken()) {
    displayConfigureLayout();
  }
 else {
    setContentView(R.layout.connect);
  }
  Log.d("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d("String_Node_Str");
  setResult(RESULT_CANCELED);
  mAppWidgetId=getIntent().getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    Log.e("String_Node_Str");
    finish();
    return;
  }
  Log.d("String_Node_Str" + mAppWidgetId);
  AuthenticateActivity.registerAppParameters(this,getString(R.string.api_key),getString(R.string.api_secret),getString(R.string.auth_url));
  RestClient.setAuth(this);
  mFlickrLibraryPrefs=getSharedPreferences(GlobalResources.PREFERENCES_ID,0);
  if (APICalls.authCheckToken()) {
    displayConfigureLayout();
  }
 else {
    setContentView(R.layout.connect);
  }
  Log.d("String_Node_Str");
}
Program: 5451
Project: 5451
Buggy source:
/** 
 * @param context
 * @param appWidgetId
 * @return
 */
public static WidgetConfiguration loadConfiguration(Context context,int appWidgetId){
  SharedPreferences widgetPrefs=context.getSharedPreferences(Constants.WIDGET_PREFS,0);
  WidgetConfiguration widgetConfiguration=new WidgetConfiguration();
  widgetConfiguration.setShowUserComments(widgetPrefs.getBoolean(Constants.WIDGET_SHOW_USERCOMMENTS,false));
  widgetConfiguration.setShowUserPhotos(widgetPrefs.getBoolean(Constants.WIDGET_SHOW_USERPHOTOS,false));
  return widgetConfiguration;
}

Fixed version (ground truth):
/** 
 * @param context
 * @param appWidgetId
 * @return
 */
public static WidgetConfiguration loadConfiguration(Context context,int appWidgetId){
  SharedPreferences widgetPrefs=context.getSharedPreferences(Constants.WIDGET_PREFS,0);
  WidgetConfiguration widgetConfiguration=new WidgetConfiguration();
  widgetConfiguration.setShowUserComments(widgetPrefs.getBoolean(Constants.WIDGET_SHOW_USERCOMMENTS + appWidgetId,false));
  widgetConfiguration.setShowUserPhotos(widgetPrefs.getBoolean(Constants.WIDGET_SHOW_USERPHOTOS + appWidgetId,false));
  return widgetConfiguration;
}
Program: 5452
Project: 5452
Buggy source:
public void onConfigurationDone(View view){
  WidgetConfiguration widgetConfiguration=generateWidgetConfiguration();
  saveConfiguration(this,mAppWidgetId,widgetConfiguration);
  Log.d("String_Node_Str");
  WidgetUpdateService.updateWidget(this,widgetConfiguration,mAppWidgetId);
  Intent resultValue=new Intent();
  resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,mAppWidgetId);
  setResult(RESULT_OK,resultValue);
  Log.d("String_Node_Str");
  finish();
}

Fixed version (ground truth):
public void onConfigurationDone(View view){
  WidgetConfiguration widgetConfiguration=generateWidgetConfiguration();
  saveConfiguration(this,mAppWidgetId,widgetConfiguration);
  Log.d("String_Node_Str" + mAppWidgetId);
  WidgetUpdateService.updateWidget(this,widgetConfiguration,mAppWidgetId);
  Intent resultValue=new Intent();
  resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,mAppWidgetId);
  setResult(RESULT_OK,resultValue);
  Log.d("String_Node_Str");
  finish();
}
Program: 5453
Project: 5453
Buggy source:
public void equip(Item item){
switch (item.glyph) {
case ')':
    unequip(weapon);
  weapon=item;
hp+=item.modHp;
attack+=item.modAttack;
defence+=item.modDefence;
item.equipped=true;
tell(AsciiPanel.white,"String_Node_Str" + item.name);
break;
case ']':
unequip(armor);
armor=item;
tell(AsciiPanel.white,"String_Node_Str" + item.name);
break;
default :
return;
}
hp+=item.modHp;
attack+=item.modAttack;
defence+=item.modDefence;
item.equipped=true;
}

Fixed version (ground truth):
public void equip(Item item){
switch (item.glyph) {
case ')':
    unequip(weapon);
  weapon=item;
hear(AsciiPanel.white,"String_Node_Str" + item.name);
break;
case ']':
unequip(armor);
armor=item;
hear(AsciiPanel.white,"String_Node_Str" + item.name);
break;
default :
return;
}
hp+=item.modHp;
attack+=item.modAttack;
defence+=item.modDefence;
item.equipped=true;
}
Program: 5454
Project: 5454
Buggy source:
public void unequip(Item item){
  if (item == null) {
    return;
  }
 else   if (weapon == item) {
    weapon=null;
    tell(AsciiPanel.white,"String_Node_Str" + item.name);
  }
 else   if (armor == item) {
    armor=null;
    tell(AsciiPanel.white,"String_Node_Str" + item.name);
  }
 else {
    return;
  }
  hp-=item.modHp;
  attack-=item.modAttack;
  defence-=item.modDefence;
  item.x=x;
  item.y=y;
  item.equipped=false;
}

Fixed version (ground truth):
public void unequip(Item item){
  if (item == null) {
    return;
  }
 else   if (weapon == item) {
    weapon=null;
    hear(AsciiPanel.white,"String_Node_Str" + item.name);
  }
 else   if (armor == item) {
    armor=null;
    hear(AsciiPanel.white,"String_Node_Str" + item.name);
  }
 else {
    return;
  }
  hp-=item.modHp;
  attack-=item.modAttack;
  defence-=item.modDefence;
  item.x=x;
  item.y=y;
  item.equipped=false;
}
Program: 5455
Project: 5455
Buggy source:
public void keyPressed(KeyEvent ke){
switch (stage) {
case start:
case win:
case lose:
    if (ke.getKeyChar() == ' ') {
      stage=play;
      reset();
    }
  break;
case help:
if (ke.getKeyChar() == ' ') {
  stage=play;
}
break;
case play:
boolean endTurn1=true;
boolean endTurn2=true;
switch (ke.getKeyChar()) {
case '?':
stage=help;
endTurn1=false;
break;
case '8':
case 'k':
target.moveBy(0,-1);
break;
case '2':
case 'j':
target.moveBy(0,1);
break;
case '4':
case 'h':
target.moveBy(-1,0);
break;
case '6':
case 'l':
target.moveBy(1,0);
break;
case '7':
case 'y':
target.moveBy(-1,-1);
break;
case '1':
case 'b':
target.moveBy(-1,1);
break;
case '9':
case 'u':
target.moveBy(1,-1);
break;
case '3':
case 'n':
target.moveBy(1,1);
break;
case '5':
case '.':
target.moveBy(0,0);
break;
case 'g':
case ',':
boolean found=false;
for (Item item : world.items) {
if (item.x == target.x && item.y == target.y && !item.equipped) {
target.equip(item);
found=true;
break;
}
}
if (!found) {
target.tell(AsciiPanel.white,"String_Node_Str");
endTurn1=false;
}
break;
default :
endTurn1=false;
}
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
target.moveBy(0,-1);
break;
case KeyEvent.VK_DOWN:
target.moveBy(0,1);
break;
case KeyEvent.VK_LEFT:
target.moveBy(-1,0);
break;
case KeyEvent.VK_RIGHT:
target.moveBy(1,0);
break;
default :
endTurn2=false;
}
if (endTurn1 || endTurn2) world.update();
break;
default :
stage=0;
break;
}
currentScreen();
}

Fixed version (ground truth):
public void keyPressed(KeyEvent ke){
switch (stage) {
case start:
case win:
case lose:
    if (ke.getKeyChar() == ' ') {
      stage=play;
      reset();
    }
  break;
case help:
if (ke.getKeyChar() == ' ') {
  stage=play;
}
break;
case play:
boolean endTurn1=true;
boolean endTurn2=true;
switch (ke.getKeyChar()) {
case '?':
stage=help;
endTurn1=false;
break;
case '8':
case 'k':
target.moveBy(0,-1);
break;
case '2':
case 'j':
target.moveBy(0,1);
break;
case '4':
case 'h':
target.moveBy(-1,0);
break;
case '6':
case 'l':
target.moveBy(1,0);
break;
case '7':
case 'y':
target.moveBy(-1,-1);
break;
case '1':
case 'b':
target.moveBy(-1,1);
break;
case '9':
case 'u':
target.moveBy(1,-1);
break;
case '3':
case 'n':
target.moveBy(1,1);
break;
case '5':
case '.':
target.moveBy(0,0);
break;
case 'g':
case ',':
boolean found=false;
for (Item item : world.items) {
if (item.x == target.x && item.y == target.y && !item.equipped) {
target.equip(item);
found=true;
break;
}
}
if (!found) {
target.hear(AsciiPanel.white,"String_Node_Str");
endTurn1=false;
}
break;
default :
endTurn1=false;
}
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
target.moveBy(0,-1);
break;
case KeyEvent.VK_DOWN:
target.moveBy(0,1);
break;
case KeyEvent.VK_LEFT:
target.moveBy(-1,0);
break;
case KeyEvent.VK_RIGHT:
target.moveBy(1,0);
break;
default :
endTurn2=false;
}
if (endTurn1 || endTurn2) world.update();
break;
default :
stage=0;
break;
}
currentScreen();
}
Program: 5456
Project: 5456
Buggy source:
private void writeMessages(){
  if (!target.messages.isEmpty()) {
    currentMessages=(ArrayList<String>)target.messages.clone();
    currentMessageColors=(ArrayList<Color>)target.messageColors.clone();
    target.messages.clear();
    target.messageColors.clear();
  }
  int startY=panel.getHeightInCharacters() - currentMessages.size() - 1;
  for (int i=0; i < currentMessages.size(); i++) {
    panel.writeCenter(currentMessages.get(i),startY + i,currentMessageColors.get(i));
  }
}

Fixed version (ground truth):
private void writeMessages(){
  if (!target.messages.isEmpty()) {
    currentMessages=(ArrayList<String>)target.messages.clone();
    currentMessageColors=(ArrayList<Color>)target.messageColors.clone();
    target.messages.clear();
    target.messageColors.clear();
  }
  int startY=panel.getHeightInCharacters() - currentMessages.size();
  for (int i=0; i < currentMessages.size(); i++) {
    panel.writeCenter(currentMessages.get(i),startY + i,currentMessageColors.get(i));
  }
}
Program: 5457
Project: 5457
Buggy source:
public void playScreen(){
  panel.clear();
  int viewWidth=80;
  int viewHeight=23;
  int vx=Math.max(0,Math.min(target.x - viewWidth / 2,world.width - viewWidth));
  int vy=Math.max(0,Math.min(target.y - viewHeight / 2,world.height - viewHeight));
  for (int x=vx; x < vx + viewWidth; x++) {
    for (int y=vy; y < vy + viewHeight; y++) {
      panel.write(world.getGlyph(x,y),x - vx,y - vy,world.getColor(x,y));
    }
  }
  Item itemHere=null;
  for (  Item item : world.items) {
    int cx=item.x - vx;
    int cy=item.y - vy;
    if (cx < 0 || cx >= viewWidth || cy < 0 || cy >= viewHeight)     continue;
    if (item.equipped)     continue;
    if (item.x == target.x && item.y == target.y)     itemHere=item;
    panel.write(item.glyph,cx,cy,item.color);
  }
  for (  Creature creature : world.creatures) {
    int cx=creature.x - vx;
    int cy=creature.y - vy;
    if (cx < 0 || cx >= viewWidth || cy < 0 || cy >= viewHeight)     continue;
    panel.write(creature.glyph,cx,cy,creature.color);
  }
  if (target.target != null) {
    infoPanel(target,1);
    infoPanel(target.target,-1);
  }
 else   if (itemHere != null) {
    infoPanel(target,1);
    infoPanel(target,itemHere,22);
  }
  writeMessages();
  panel.write(world.getName(target.x,target.y),71,panel.getHeightInCharacters() - 1);
  String status="String_Node_Str" + target.name + "String_Node_Str"+ target.x+ "String_Node_Str"+ target.y+ "String_Node_Str";
  if (target.weapon != null)   status+="String_Node_Str" + target.weapon.name;
  if (target.armor != null)   status+="String_Node_Str" + target.armor.name;
  panel.write(status,0,panel.getHeightInCharacters() - 1);
}

Fixed version (ground truth):
public void playScreen(){
  panel.clear();
  int viewWidth=80;
  int viewHeight=24;
  int vx=Math.max(0,Math.min(target.x - viewWidth / 2,world.width - viewWidth));
  int vy=Math.max(0,Math.min(target.y - viewHeight / 2,world.height - viewHeight));
  for (int x=vx; x < vx + viewWidth; x++) {
    for (int y=vy; y < vy + viewHeight; y++) {
      panel.write(world.getGlyph(x,y),x - vx,y - vy,world.getColor(x,y));
    }
  }
  Item itemHere=null;
  for (  Item item : world.items) {
    int cx=item.x - vx;
    int cy=item.y - vy;
    if (cx < 0 || cx >= viewWidth || cy < 0 || cy >= viewHeight)     continue;
    if (item.equipped)     continue;
    if (item.x == target.x && item.y == target.y)     itemHere=item;
    panel.write(item.glyph,cx,cy,item.color);
  }
  for (  Creature creature : world.creatures) {
    int cx=creature.x - vx;
    int cy=creature.y - vy;
    if (cx < 0 || cx >= viewWidth || cy < 0 || cy >= viewHeight)     continue;
    panel.write(creature.glyph,cx,cy,creature.color);
  }
  infoPanel(target,1);
  if (target.target != null) {
    infoPanel(target.target,-1);
  }
 else   if (itemHere != null) {
    infoPanel(target,1);
    infoPanel(target,itemHere,22);
  }
  writeMessages();
}
Program: 5459
Project: 5459
Buggy source:
public void tellAll(Color color,String message){
  for (  Creature creature : creatures) {
    creature.tell(color,message);
  }
}

Fixed version (ground truth):
public void tellAll(Color color,String message){
  for (  Creature creature : creatures) {
    creature.hear(color,message);
  }
}
Program: 5460
Project: 5460
Buggy source:
/** 
 * Returns the readings count for a node.
 * @param node , a node .
 * @return the count of this node.
 */
public Long getNodeReadingsCount(final Node node){
  final Session session=getSessionFactory().getCurrentSession();
  final Criteria criteria=session.createCriteria(NodeReading.class);
  criteria.add(Restrictions.eq("String_Node_Str",node));
  criteria.setProjection(Projections.count("String_Node_Str"));
  criteria.setMaxResults(1);
  return (Long)criteria.uniqueResult();
}

Fixed version (ground truth):
/** 
 * Returns the readings count for a node.
 * @param node , a node .
 * @return the count of this node.
 */
public Long getNodeReadingsCount(final Node node){
  final Session session=getSessionFactory().getCurrentSession();
  final Criteria criteria=session.createCriteria(NodeReading.class);
  criteria.add(Restrictions.eq(NODE,node));
  criteria.setProjection(Projections.count(NODE));
  criteria.setMaxResults(1);
  return (Long)criteria.uniqueResult();
}