nus-yam/ex-repair huggingface dataset:
Program: 85583
Project: 85583
Buggy source:
Sha256Hash calculateScore(int mod,Sha256Hash hash){
  BigInteger bi_aux=vin.getOutpoint().getHash().toBigInteger().add(BigInteger.valueOf(vin.getOutpoint().getIndex()));
  byte[] temp=new byte[32];
  System.arraycopy(bi_aux.toByteArray(),0,temp,0,32);
  Sha256Hash aux=Sha256Hash.wrap(temp);
  if (hash.equals(Sha256Hash.ZERO_HASH)) {
    log.info("String_Node_Str");
    return Sha256Hash.ZERO_HASH;
  }
  Sha256Hash hash2=Sha256Hash.twiceOf(hash.getBytes());
  try {
    UnsafeByteArrayOutputStream bos=new UnsafeByteArrayOutputStream();
    bos.write(hash.getBytes());
    bos.write(aux.getBytes());
    Sha256Hash hash3=Sha256Hash.twiceOf(bos.toByteArray());
    BigInteger bhash2=hash2.toBigInteger();
    BigInteger bhash3=hash3.toBigInteger();
    if (bhash3.compareTo(bhash2) > 0) {
      System.arraycopy(bhash3.subtract(bhash2).toByteArray(),0,temp,0,32);
      return Sha256Hash.wrap(temp);
    }
 else {
      System.arraycopy(bhash2.subtract(bhash3).toByteArray(),0,temp,0,32);
      return Sha256Hash.wrap(temp);
    }
  }
 catch (  IOException x) {
    return Sha256Hash.ZERO_HASH;
  }
}

Fixed version (ground truth):
static Sha256Hash calculateScore(TransactionInput vin,Sha256Hash hash){
  BigInteger bi_aux=vin.getOutpoint().getHash().toBigInteger().add(BigInteger.valueOf(vin.getOutpoint().getIndex()));
  byte[] temp=new byte[32];
  byte[] bi_bytes=bi_aux.toByteArray();
  int length=bi_bytes[0] == 0 ? java.lang.Math.min(bi_bytes.length - 1,32) : java.lang.Math.min(bi_bytes.length,32);
  System.arraycopy(bi_bytes,bi_bytes[0] == 0 ? 1 : 0,temp,0,length);
  Sha256Hash aux=Sha256Hash.wrap(temp);
  Sha256Hash hash2=Sha256Hash.wrapReversed(Sha256Hash.hashTwice(hash.getReversedBytes()));
  try {
    UnsafeByteArrayOutputStream bos=new UnsafeByteArrayOutputStream();
    bos.write(hash.getReversedBytes());
    bos.write(aux.getReversedBytes());
    Sha256Hash hash3=Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray()));
    BigInteger bhash2=hash2.toBigInteger();
    BigInteger bhash3=hash3.toBigInteger();
    if (bhash3.compareTo(bhash2) > 0) {
      byte[] subtraction=bhash3.subtract(bhash2).toByteArray();
      length=subtraction[0] == 0 ? java.lang.Math.min(subtraction.length - 1,32) : java.lang.Math.min(subtraction.length,32);
      System.arraycopy(subtraction,subtraction[0] == 0 ? 1 : 0,temp,0,length);
      return Sha256Hash.wrap(temp);
    }
 else {
      byte[] subtraction=bhash2.subtract(bhash3).toByteArray();
      length=subtraction[0] == 0 ? java.lang.Math.min(subtraction.length - 1,32) : java.lang.Math.min(subtraction.length,32);
      System.arraycopy(subtraction,subtraction[0] == 0 ? 1 : 0,temp,0,length);
      return Sha256Hash.wrap(temp);
    }
  }
 catch (  IOException x) {
    return Sha256Hash.ZERO_HASH;
  }
}
Program: 85584
Project: 85584
Buggy source:
public Sha256Hash getHash(){
  byte[] dataToHash=new byte[pubkey.getBytes().length + 8];
  Utils.uint32ToByteArrayLE(sigTime,dataToHash,0);
  System.arraycopy(pubkey.getBytes(),0,dataToHash,8,pubkey.getBytes().length);
  return Sha256Hash.twiceOf(dataToHash);
}

Fixed version (ground truth):
public Sha256Hash getHash(){
  byte[] dataToHash=new byte[pubkey.getBytes().length + 8];
  Utils.uint32ToByteArrayLE(sigTime,dataToHash,0);
  System.arraycopy(pubkey.getBytes(),0,dataToHash,8,pubkey.getBytes().length);
  try {
    UnsafeByteArrayOutputStream bos=new UnsafeByteArrayOutputStream(8 + pubkey.calculateMessageSizeInBytes());
    Utils.int64ToByteStreamLE(sigTime,bos);
    pubkey.bitcoinSerialize(bos);
    return Sha256Hash.wrapReversed(Sha256Hash.hashTwice((bos.toByteArray())));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 85586
Project: 85586
Buggy source:
void processMasternodePing(Peer peer,MasternodePing mnp){
  log.info("String_Node_Str" + mnp.vin.toString());
  if (mapSeenMasternodePing.containsKey(mnp.getHash()))   return;
  mapSeenMasternodePing.put(mnp.getHash(),mnp);
  int nDoS=0;
  if (mnp.checkAndUpdate())   return;
  if (nDoS > 0) {
  }
 else {
    Masternode pmn=find(mnp.vin);
    if (pmn != null)     return;
  }
  askForMN(peer,mnp.vin);
}

Fixed version (ground truth):
void processMasternodePing(Peer peer,MasternodePing mnp){
  if (mapSeenMasternodePing.containsKey(mnp.getHash()))   return;
  mapSeenMasternodePing.put(mnp.getHash(),mnp);
  int nDoS=0;
  if (mnp.checkAndUpdate())   return;
  if (nDoS > 0) {
  }
 else {
    Masternode pmn=find(mnp.vin);
    if (pmn != null)     return;
  }
  askForMN(peer,mnp.vin);
}
Program: 85587
Project: 85587
Buggy source:
public int countEnabled(int protocolVersion){
  int i=0;
  protocolVersion=protocolVersion == -1 ? params.masternodePayments.getMinMasternodePaymentsProto() : protocolVersion;
  for (  Masternode mn : vMasternodes) {
    mn.check();
    if (mn.protocolVersion < protocolVersion || !mn.isEnabled())     continue;
    i++;
  }
  return i;
}

Fixed version (ground truth):
public int countEnabled(int protocolVersion){
  int i=0;
  protocolVersion=protocolVersion == -1 ? params.masternodePayments.getMinMasternodePaymentsProto() : protocolVersion;
  lock.lock();
  try {
    for (    Masternode mn : vMasternodes) {
      mn.check();
      if (mn.protocolVersion < protocolVersion || !mn.isEnabled())       continue;
      i++;
    }
  }
  finally {
    lock.unlock();
  }
  return i;
}
Program: 85588
Project: 85588
Buggy source:
void processMasternodeBroadcast(MasternodeBroadcast mnb){
  if (mapSeenMasternodeBroadcast.containsKey(mnb.getHash())) {
    params.masternodeSync.addedMasternodeList(mnb.getHash());
    return;
  }
  mapSeenMasternodeBroadcast.put(mnb.getHash(),mnb);
  int nDoS=0;
  if (!mnb.checkAndUpdate()) {
    return;
  }
  if (!DarkSendSigner.isVinAssociatedWithPubkey(params,mnb.vin,mnb.pubkey)) {
    log.info("String_Node_Str");
    return;
  }
  if (mnb.checkInputsAndAdd()) {
    params.masternodeSync.addedMasternodeList(mnb.getHash());
  }
 else {
    log.info("String_Node_Str" + mnb.address.toString());
  }
}

Fixed version (ground truth):
void processMasternodeBroadcast(MasternodeBroadcast mnb){
  if (mapSeenMasternodeBroadcast.containsKey(mnb.getHash())) {
    params.masternodeSync.addedMasternodeList(mnb.getHash());
    return;
  }
  mapSeenMasternodeBroadcast.put(mnb.getHash(),mnb);
  int nDoS=0;
  if (!mnb.checkAndUpdate()) {
    return;
  }
  if (!DarkSendSigner.isVinAssociatedWithPubkey(params,mnb.vin,mnb.pubkey)) {
    log.info("String_Node_Str");
    return;
  }
  if (mnb.checkInputsAndAdd()) {
  }
 else {
    log.info("String_Node_Str" + mnb.address.toString());
  }
}
Program: 85589
Project: 85589
Buggy source:
public Sha256Hash getHash(){
  try {
    ByteArrayOutputStream bos=new UnsafeByteArrayOutputStream(vchSig.getBytes().length + 8);
    bos.write(vchSig.getBytes());
    Utils.int64ToByteStreamLE(sigTime,bos);
    return Sha256Hash.twiceOf(bos.toByteArray());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Sha256Hash getHash(){
  try {
    UnsafeByteArrayOutputStream bos=new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes() + 8);
    vin.bitcoinSerialize(bos);
    Utils.int64ToByteStreamLE(sigTime,bos);
    return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray()));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 85590
Project: 85590
Buggy source:
/** 
 * Clean up the wallet. Currently, it only removes risky pending transaction from the wallet and only if their outputs have not been spent.
 */
public void cleanup(){
  lock.lock();
  try {
    boolean dirty=false;
    for (Iterator<Transaction> i=pending.values().iterator(); i.hasNext(); ) {
      Transaction tx=i.next();
      if (isTransactionRisky(tx,null) && !acceptRiskyTransactions) {
        log.debug("String_Node_Str",tx.getHashAsString());
        if (!tx.isAnyOutputSpent()) {
          for (          TransactionInput input : tx.getInputs()) {
            TransactionOutput output=input.getConnectedOutput();
            if (output == null)             continue;
            myUnspents.add(output);
            input.disconnect();
          }
          for (          TransactionOutput output : tx.getOutputs())           myUnspents.remove(output);
          i.remove();
          transactions.remove(tx.getHash());
          dirty=true;
          log.info("String_Node_Str",tx.getHashAsString());
        }
 else {
          log.info("String_Node_Str",tx.getHashAsString());
        }
      }
    }
    if (dirty) {
      isConsistentOrThrow();
      saveLater();
      if (log.isInfoEnabled())       log.info("String_Node_Str",getBalance(BalanceType.ESTIMATED).toFriendlyString());
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Clean up the wallet. Currently, it only removes risky pending transaction from the wallet and only if their outputs have not been spent.
 */
public void cleanup(){
  lock.lock();
  try {
    boolean dirty=false;
    for (Iterator<Transaction> i=pending.values().iterator(); i.hasNext(); ) {
      Transaction tx=i.next();
      if (isTransactionRisky(tx,null) && !acceptRiskyTransactions) {
        log.debug("String_Node_Str",tx.getHashAsString());
        if (!tx.isAnyOutputSpent()) {
          for (          TransactionInput input : tx.getInputs()) {
            TransactionOutput output=input.getConnectedOutput();
            if (output == null)             continue;
            if (output.isMineOrWatched(this))             checkState(myUnspents.add(output));
            input.disconnect();
          }
          for (          TransactionOutput output : tx.getOutputs())           myUnspents.remove(output);
          i.remove();
          transactions.remove(tx.getHash());
          dirty=true;
          log.info("String_Node_Str",tx.getHashAsString());
        }
 else {
          log.info("String_Node_Str",tx.getHashAsString());
        }
      }
    }
    if (dirty) {
      isConsistentOrThrow();
      saveLater();
      if (log.isInfoEnabled())       log.info("String_Node_Str",getBalance(BalanceType.ESTIMATED).toFriendlyString());
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 85591
Project: 85591
Buggy source:
/** 
 * Convenience for connecting only to peers that can serve specific services. It will configure suitable peer discoveries.
 * @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
 */
public void setRequiredServices(long requiredServices){
  lock.lock();
  try {
    this.requiredServices=requiredServices;
    peerDiscoverers.clear();
    peerDiscoverers.add(MultiplexingDiscovery.forServices(params,requiredServices));
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Convenience for connecting only to peers that can serve specific services. It will configure suitable peer discoveries.
 * @param requiredServices Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
 */
public void setRequiredServices(long requiredServices){
  lock.lock();
  try {
    this.requiredServices=requiredServices;
    peerDiscoverers.clear();
    addPeerDiscovery(MultiplexingDiscovery.forServices(params,requiredServices));
  }
  finally {
    lock.unlock();
  }
}
Program: 85592
Project: 85592
Buggy source:
/** 
 * Generates a new deterministic key from the given seed, which can be any arbitrary byte array. However resist the temptation to use a string as the seed - any key derived from a password is likely to be weak and easily broken by attackers (this is not theoretical, people have had money stolen that way). This method checks that the given seed is at least 64 bits long.
 * @throws HDDerivationException if generated master key is invalid (private key 0 or >= n).
 * @throws IllegalArgumentException if the seed is less than 8 bytes and could be brute forced.
 */
public static DeterministicKey createMasterPrivateKey(byte[] seed) throws HDDerivationException {
  checkArgument(seed.length > 8,"String_Node_Str");
  byte[] i=HDUtils.hmacSha512(MASTER_HMAC_SHA512,seed);
  checkState(i.length == 64,i.length);
  byte[] il=Arrays.copyOfRange(i,0,32);
  byte[] ir=Arrays.copyOfRange(i,32,64);
  Arrays.fill(i,(byte)0);
  DeterministicKey masterPrivKey=createMasterPrivKeyFromBytes(il,ir);
  Arrays.fill(il,(byte)0);
  Arrays.fill(ir,(byte)0);
  masterPrivKey.setCreationTimeSeconds(Utils.currentTimeSeconds());
  return masterPrivKey;
}

Fixed version (ground truth):
/** 
 * Generates a new deterministic key from the given seed, which can be any arbitrary byte array. However resist the temptation to use a string as the seed - any key derived from a password is likely to be weak and easily broken by attackers (this is not theoretical, people have had money stolen that way). This method checks that the given seed is at least 64 bits long.
 * @throws HDDerivationException if generated master key is invalid (private key 0 or >= n).
 * @throws IllegalArgumentException if the seed is less than 8 bytes and could be brute forced.
 */
public static DeterministicKey createMasterPrivateKey(byte[] seed) throws HDDerivationException {
  checkArgument(seed.length > 8,"String_Node_Str");
  byte[] i=HDUtils.hmacSha512(HDUtils.createHmacSha512Digest("String_Node_Str".getBytes()),seed);
  checkState(i.length == 64,i.length);
  byte[] il=Arrays.copyOfRange(i,0,32);
  byte[] ir=Arrays.copyOfRange(i,32,64);
  Arrays.fill(i,(byte)0);
  DeterministicKey masterPrivKey=createMasterPrivKeyFromBytes(il,ir);
  Arrays.fill(il,(byte)0);
  Arrays.fill(ir,(byte)0);
  masterPrivKey.setCreationTimeSeconds(Utils.currentTimeSeconds());
  return masterPrivKey;
}
Program: 85593
Project: 85593
Buggy source:
@Override public int hashCode(){
  if (bits != null)   return Arrays.hashCode(bits);
 else   return get().hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return Arrays.hashCode(getCanonicalEncoding());
}
Program: 85594
Project: 85594
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  LazyECPoint point1=(LazyECPoint)o;
  if (bits != null && point1.bits != null)   return Arrays.equals(bits,point1.bits);
 else   return get().equals(point1.get());
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  return this == o || o != null && getClass() == o.getClass() && Arrays.equals(getCanonicalEncoding(),((LazyECPoint)o).getCanonicalEncoding());
}
Program: 85595
Project: 85595
Buggy source:
@Override public int hashCode(){
  return Objects.hashCode(bytes,version,compressed);
}

Fixed version (ground truth):
@Override public int hashCode(){
  return Objects.hashCode(version,compressed,Arrays.hashCode(bytes));
}
Program: 85596
Project: 85596
Buggy source:
@Override public int hashCode(){
  int result=(int)(sequence ^ (sequence >>> 32));
  result=31 * result + outpoint.hashCode();
  result=31 * result + (scriptBytes != null ? Arrays.hashCode(scriptBytes) : 0);
  result=31 * result + (scriptSig != null ? scriptSig.hashCode() : 0);
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=(int)(sequence ^ (sequence >>> 32));
  result=31 * result + outpoint.hashCode();
  result=31 * result + (scriptBytes != null ? Arrays.hashCode(scriptBytes) : 0);
  return result;
}
Program: 85597
Project: 85597
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  TransactionInput input=(TransactionInput)o;
  if (sequence != input.sequence)   return false;
  if (!outpoint.equals(input.outpoint))   return false;
  if (!Arrays.equals(scriptBytes,input.scriptBytes))   return false;
  if (scriptSig != null ? !scriptSig.equals(input.scriptSig) : input.scriptSig != null)   return false;
  if (parent != input.parent)   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  TransactionInput input=(TransactionInput)o;
  if (sequence != input.sequence)   return false;
  if (!outpoint.equals(input.outpoint))   return false;
  if (!Arrays.equals(scriptBytes,input.scriptBytes))   return false;
  if (parent != input.parent)   return false;
  return true;
}
Program: 85598
Project: 85598
Buggy source:
@Override public int hashCode(){
  return 31 * hash.hashCode() + (int)(index ^ (index >>> 32));
}

Fixed version (ground truth):
@Override public int hashCode(){
  return 31 * getHash().hashCode() + (int)(getIndex() ^ (getIndex() >>> 32));
}
Program: 85599
Project: 85599
Buggy source:
@Override public int hashCode(){
  int result=(int)(value ^ (value >>> 32));
  result=31 * result + Arrays.hashCode(scriptBytes);
  if (parent != null)   result*=parent.getHash().hashCode() + getIndex();
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int result=(int)(value ^ (value >>> 32));
  result=31 * result + Arrays.hashCode(scriptBytes);
  if (parent != null)   result*=parent.getHash().hashCode();
  return result;
}
Program: 85600
Project: 85600
Buggy source:
/** 
 * Prepares the wallet for a blockchain replay. Removes all transactions (as they would get in the way of the replay) and makes the wallet think it has never seen a block.   {@link WalletEventListener#onWalletChanged()} willbe fired.
 */
public void reset(){
  lock.lock();
  try {
    clearTransactions();
    lastBlockSeenHash=null;
    lastBlockSeenHeight=-1;
    lastBlockSeenTimeSecs=0;
    saveLater();
    maybeQueueOnWalletChanged();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Prepares the wallet for a blockchain replay. Removes all transactions (as they would get in the way of the replay) and makes the wallet think it has never seen a block.   {@link WalletEventListener#onWalletChanged} willbe fired.
 */
public void reset(){
  lock.lock();
  try {
    clearTransactions();
    lastBlockSeenHash=null;
    lastBlockSeenHeight=-1;
    lastBlockSeenTimeSecs=0;
    saveLater();
    maybeQueueOnWalletChanged();
  }
  finally {
    lock.unlock();
  }
}
Program: 85601
Project: 85601
Buggy source:
/** 
 * <p>Gets a future which returns this when the channel is successfully opened, or throws an exception if there is an error before the channel has reached the open state.</p> <p>After this future completes successfully, you may call  {@link PaymentChannelClientConnection#incrementPayment(Coin)} or {@link PaymentChannelClientConnection#incrementPayment(Coin,com.google.protobuf.ByteString)} to begin paying the server.</p>
 */
public ListenableFuture<PaymentChannelClientConnection> getChannelOpenFuture(){
  return channelOpenFuture;
}

Fixed version (ground truth):
/** 
 * <p>Gets a future which returns this when the channel is successfully opened, or throws an exception if there is an error before the channel has reached the open state.</p> <p>After this future completes successfully, you may call  {@link PaymentChannelClientConnection#incrementPayment(Coin)} or{@link PaymentChannelClientConnection#incrementPayment(Coin,com.google.protobuf.ByteString,KeyParameter)} tobegin paying the server.</p>
 */
public ListenableFuture<PaymentChannelClientConnection> getChannelOpenFuture(){
  return channelOpenFuture;
}
Program: 85602
Project: 85602
Buggy source:
/** 
 * Returns the loaded protocol buffer from the given byte stream. You normally want  {@link Wallet#loadFromFile(java.io.File)} instead - this method is designed for low level work involving thewallet file format itself.
 */
public static Protos.Wallet parseToProto(InputStream input) throws IOException {
  CodedInputStream codedInput=CodedInputStream.newInstance(input);
  codedInput.setSizeLimit(WALLET_SIZE_LIMIT);
  return Protos.Wallet.parseFrom(codedInput);
}

Fixed version (ground truth):
/** 
 * Returns the loaded protocol buffer from the given byte stream. You normally want  {@link Wallet#loadFromFile(java.io.File,WalletExtension)} instead - this method is designed for low levelwork involving the wallet file format itself.
 */
public static Protos.Wallet parseToProto(InputStream input) throws IOException {
  CodedInputStream codedInput=CodedInputStream.newInstance(input);
  codedInput.setSizeLimit(WALLET_SIZE_LIMIT);
  return Protos.Wallet.parseFrom(codedInput);
}
Program: 85603
Project: 85603
Buggy source:
/** 
 * Return the number of fractional decimal places to be displayed when formatting the given number of monetory units of the denomination indicated by the given decimal scale value, where 0 = coin, 3 = millicoin, and so on.
 * @param unitCount      the number of monetary units to be formatted
 * @param scale          the denomination of those units as the decimal-place shift from coins
 * @param minDecimals    the minimum number of fractional decimal places
 * @param fractiongroups the sizes of option fractional decimal-place groups
 */
private static int calculateFractionPlaces(BigDecimal unitCount,int scale,int minDecimals,List<Integer> fractionGroups){
  int places=minDecimals;
  for (  int group : fractionGroups) {
    places+=group;
  }
  int max=Math.min(places,offSatoshis(scale));
  places=Math.min(minDecimals,max);
  for (  int group : fractionGroups) {
    if (unitCount.setScale(places,HALF_UP).compareTo(unitCount.setScale(max,HALF_UP)) == 0)     break;
    places+=group;
    if (places > max)     places=max;
  }
  return places;
}

Fixed version (ground truth):
/** 
 * Return the number of fractional decimal places to be displayed when formatting the given number of monetory units of the denomination indicated by the given decimal scale value, where 0 = coin, 3 = millicoin, and so on.
 * @param unitCount      the number of monetary units to be formatted
 * @param scale          the denomination of those units as the decimal-place shift from coins
 * @param minDecimals    the minimum number of fractional decimal places
 * @param fractionGroups the sizes of option fractional decimal-place groups
 */
private static int calculateFractionPlaces(BigDecimal unitCount,int scale,int minDecimals,List<Integer> fractionGroups){
  int places=minDecimals;
  for (  int group : fractionGroups) {
    places+=group;
  }
  int max=Math.min(places,offSatoshis(scale));
  places=Math.min(minDecimals,max);
  for (  int group : fractionGroups) {
    if (unitCount.setScale(places,HALF_UP).compareTo(unitCount.setScale(max,HALF_UP)) == 0)     break;
    places+=group;
    if (places > max)     places=max;
  }
  return places;
}
Program: 85605
Project: 85605
Buggy source:
/** 
 * Parse a human readable fiat value to a   {@link org.bitcoinj.core.Fiat} instance.
 * @throws NumberFormatException if the string cannot be parsed for some reason
 */
public Fiat parseFiat(String currencyCode,String str) throws NumberFormatException {
  return Fiat.valueOf(currencyCode,parseValue(str,Fiat.SMALLEST_UNIT_EXPONENT));
}

Fixed version (ground truth):
/** 
 * Parse a human readable fiat value to a   {@link org.bitcoinj.utils.Fiat} instance.
 * @throws NumberFormatException if the string cannot be parsed for some reason
 */
public Fiat parseFiat(String currencyCode,String str) throws NumberFormatException {
  return Fiat.valueOf(currencyCode,parseValue(str,Fiat.SMALLEST_UNIT_EXPONENT));
}
Program: 85606
Project: 85606
Buggy source:
/** 
 * Uses the checksum in the last 4 bytes of the decoded data to verify the rest are correct. The checksum is removed from the returned data.
 * @throws AddressFormatException if the input is not base 58 or the checksum does not validate.
 */
public static byte[] decodeChecked(String input) throws AddressFormatException {
  byte tmp[]=decode(input);
  if (tmp.length < 4)   throw new AddressFormatException("String_Node_Str");
  byte[] bytes=copyOfRange(tmp,0,tmp.length - 4);
  byte[] checksum=copyOfRange(tmp,tmp.length - 4,tmp.length);
  tmp=Sha256Hash.hashTwice(bytes);
  byte[] hash=copyOfRange(tmp,0,4);
  if (!Arrays.equals(checksum,hash))   throw new AddressFormatException("String_Node_Str");
  return bytes;
}

Fixed version (ground truth):
/** 
 * Uses the checksum in the last 4 bytes of the decoded data to verify the rest are correct. The checksum is removed from the returned data.
 * @throws AddressFormatException if the input is not base 58 or the checksum does not validate.
 */
public static byte[] decodeChecked(String input) throws AddressFormatException {
  byte[] tmp=decode(input);
  if (tmp.length < 4)   throw new AddressFormatException("String_Node_Str");
  byte[] bytes=copyOfRange(tmp,0,tmp.length - 4);
  byte[] checksum=copyOfRange(tmp,tmp.length - 4,tmp.length);
  tmp=Sha256Hash.hashTwice(bytes);
  byte[] hash=copyOfRange(tmp,0,4);
  if (!Arrays.equals(checksum,hash))   throw new AddressFormatException("String_Node_Str");
  return bytes;
}
Program: 85607
Project: 85607
Buggy source:
/** 
 * Returns an immutable list of transactions held in this block, or null if this object represents just a header. 
 */
public @Nullable List<Transaction> getTransactions(){
  maybeParseTransactions();
  if (transactions == null)   return null;
 else   return ImmutableList.copyOf(transactions);
}

Fixed version (ground truth):
/** 
 * Returns an immutable list of transactions held in this block, or null if this object represents just a header. 
 */
@Nullable public List<Transaction> getTransactions(){
  maybeParseTransactions();
  return transactions == null ? null : ImmutableList.copyOf(transactions);
}
Program: 85608
Project: 85608
Buggy source:
@Override final protected void bitcoinSerializeToStream(OutputStream stream) throws IOException {
}

Fixed version (ground truth):
@Override protected final void bitcoinSerializeToStream(OutputStream stream) throws IOException {
}
Program: 85609
Project: 85609
Buggy source:
/** 
 * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized transactions won't be included by miners and can be replaced with newer versions using sequence numbers. This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as micropayment channels.</p> <p>Note that currently the replacement feature is disabled in the Satoshi client and will need to be re-activated before this functionality is useful.</p>
 */
public boolean isFinal(int height,long blockTimeSeconds){
  long time=getLockTime();
  if (time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds))   return true;
  if (!isTimeLocked())   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized transactions won't be included by miners and can be replaced with newer versions using sequence numbers. This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as micropayment channels.</p> <p>Note that currently the replacement feature is disabled in the Satoshi client and will need to be re-activated before this functionality is useful.</p>
 */
public boolean isFinal(int height,long blockTimeSeconds){
  long time=getLockTime();
  return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked();
}
Program: 85610
Project: 85610
Buggy source:
/** 
 * Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to this byte array output stream.
 * @param b   the data.
 * @param off the start offset in the data.
 * @param len the number of bytes to write.
 */
@Override public void write(byte b[],int off,int len){
  if ((off < 0) || (off > b.length) || (len < 0)|| ((off + len) > b.length)|| ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return;
  }
  int newcount=count + len;
  if (newcount > buf.length) {
    buf=Utils.copyOf(buf,Math.max(buf.length << 1,newcount));
  }
  System.arraycopy(b,off,buf,count,len);
  count=newcount;
}

Fixed version (ground truth):
/** 
 * Writes <code>len</code> bytes from the specified byte array starting at offset <code>off</code> to this byte array output stream.
 * @param b   the data.
 * @param off the start offset in the data.
 * @param len the number of bytes to write.
 */
@Override public void write(byte[] b,int off,int len){
  if ((off < 0) || (off > b.length) || (len < 0)|| ((off + len) > b.length)|| ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return;
  }
  int newcount=count + len;
  if (newcount > buf.length) {
    buf=Utils.copyOf(buf,Math.max(buf.length << 1,newcount));
  }
  System.arraycopy(b,off,buf,count,len);
  count=newcount;
}
Program: 85612
Project: 85612
Buggy source:
static ArrayList<InetSocketAddress> parseUserList(String[] userNames) throws UnknownHostException {
  ArrayList<InetSocketAddress> addresses=new ArrayList<InetSocketAddress>();
  for (  String user : userNames) {
    if (!user.startsWith("String_Node_Str")) {
      continue;
    }
    byte[] addressBytes;
    try {
      addressBytes=Base58.decodeChecked(user.substring(1));
    }
 catch (    AddressFormatException e) {
      log.warn("String_Node_Str" + user);
      continue;
    }
    if (addressBytes.length != 6) {
      continue;
    }
    byte[] ipBytes=new byte[]{addressBytes[0],addressBytes[1],addressBytes[2],addressBytes[3]};
    int port=Utils.readUint16BE(addressBytes,4);
    InetAddress ip;
    try {
      ip=InetAddress.getByAddress(ipBytes);
    }
 catch (    UnknownHostException e) {
      continue;
    }
    InetSocketAddress address=new InetSocketAddress(ip,port);
    addresses.add(address);
  }
  return addresses;
}

Fixed version (ground truth):
static ArrayList<InetSocketAddress> parseUserList(String[] userNames) throws UnknownHostException {
  ArrayList<InetSocketAddress> addresses=new ArrayList<InetSocketAddress>();
  for (  String user : userNames) {
    if (!user.startsWith("String_Node_Str")) {
      continue;
    }
    byte[] addressBytes;
    try {
      addressBytes=Base58.decodeChecked(user.substring(1));
    }
 catch (    AddressFormatException e) {
      log.warn("String_Node_Str" + user);
      continue;
    }
    if (addressBytes.length != 6) {
      continue;
    }
    byte[] ipBytes={addressBytes[0],addressBytes[1],addressBytes[2],addressBytes[3]};
    int port=Utils.readUint16BE(addressBytes,4);
    InetAddress ip;
    try {
      ip=InetAddress.getByAddress(ipBytes);
    }
 catch (    UnknownHostException e) {
      continue;
    }
    InetSocketAddress address=new InetSocketAddress(ip,port);
    addresses.add(address);
  }
  return addresses;
}
Program: 85614
Project: 85614
Buggy source:
/** 
 * Generates a Payment message based on the information in the PaymentRequest. Provide transactions built by the wallet. If the PaymentRequest did not specify a payment_url, returns null.
 * @param txns list of transactions to be included with the Payment message.
 * @param refundAddr will be used by the merchant to send money back if there was a problem.
 * @param memo is a message to include in the payment message sent to the merchant.
 */
public @Nullable Protos.Payment getPayment(List<Transaction> txns,@Nullable Address refundAddr,@Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork {
  if (paymentDetails.hasPaymentUrl()) {
    for (    Transaction tx : txns)     if (!tx.getParams().equals(params))     throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId());
    return PaymentProtocol.createPaymentMessage(txns,totalValue,refundAddr,memo,getMerchantData());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Generates a Payment message based on the information in the PaymentRequest. Provide transactions built by the wallet. If the PaymentRequest did not specify a payment_url, returns null.
 * @param txns list of transactions to be included with the Payment message.
 * @param refundAddr will be used by the merchant to send money back if there was a problem.
 * @param memo is a message to include in the payment message sent to the merchant.
 */
@Nullable public Protos.Payment getPayment(List<Transaction> txns,@Nullable Address refundAddr,@Nullable String memo) throws IOException, PaymentProtocolException.InvalidNetwork {
  if (paymentDetails.hasPaymentUrl()) {
    for (    Transaction tx : txns)     if (!tx.getParams().equals(params))     throw new PaymentProtocolException.InvalidNetwork(params.getPaymentProtocolId());
    return PaymentProtocol.createPaymentMessage(txns,totalValue,refundAddr,memo,getMerchantData());
  }
 else {
    return null;
  }
}
Program: 85615
Project: 85615
Buggy source:
/** 
 * Returns the payment url where the Payment message should be sent. Returns null if no payment url was provided in the PaymentRequest.
 */
public @Nullable String getPaymentUrl(){
  if (paymentDetails.hasPaymentUrl())   return paymentDetails.getPaymentUrl();
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the payment url where the Payment message should be sent. Returns null if no payment url was provided in the PaymentRequest.
 */
@Nullable public String getPaymentUrl(){
  if (paymentDetails.hasPaymentUrl())   return paymentDetails.getPaymentUrl();
  return null;
}
Program: 85616
Project: 85616
Buggy source:
/** 
 * Calculate the balance for a coinbase, to-address, or p2sh address. <p>The balance   {@link org.bitcoinj.store.DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returnsthe balance (summed) as an number, then use calculateClientSide=false</p> <p>The balance  {@link org.bitcoinj.store.DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returnsthe all the openoutputs as stored in the DB (binary), then use calculateClientSide=true</p>
 * @param address The address to calculate the balance of
 * @return The balance of the address supplied.  If the address has not been seen, or there are no outputs open for thisaddress, the return value is 0.
 * @throws BlockStoreException If there is an error getting the balance.
 */
public BigInteger calculateBalanceForAddress(Address address) throws BlockStoreException {
  maybeConnect();
  PreparedStatement s=null;
  try {
    s=conn.get().prepareStatement(getBalanceSelectSQL());
    s.setString(1,address.toString());
    ResultSet rs=s.executeQuery();
    BigInteger balance=BigInteger.ZERO;
    while (rs.next()) {
      return BigInteger.valueOf(rs.getLong(1));
    }
    return balance;
  }
 catch (  SQLException ex) {
    throw new BlockStoreException(ex);
  }
 finally {
    if (s != null) {
      try {
        s.close();
      }
 catch (      SQLException e) {
        throw new BlockStoreException("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Calculate the balance for a coinbase, to-address, or p2sh address. <p>The balance   {@link org.bitcoinj.store.DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returnsthe balance (summed) as an number, then use calculateClientSide=false</p> <p>The balance  {@link org.bitcoinj.store.DatabaseFullPrunedBlockStore#getBalanceSelectSQL()} returnsthe all the openoutputs as stored in the DB (binary), then use calculateClientSide=true</p>
 * @param address The address to calculate the balance of
 * @return The balance of the address supplied.  If the address has not been seen, or there are no outputs open for thisaddress, the return value is 0.
 * @throws BlockStoreException If there is an error getting the balance.
 */
public BigInteger calculateBalanceForAddress(Address address) throws BlockStoreException {
  maybeConnect();
  PreparedStatement s=null;
  try {
    s=conn.get().prepareStatement(getBalanceSelectSQL());
    s.setString(1,address.toString());
    ResultSet rs=s.executeQuery();
    BigInteger balance=BigInteger.ZERO;
    if (rs.next()) {
      return BigInteger.valueOf(rs.getLong(1));
    }
    return balance;
  }
 catch (  SQLException ex) {
    throw new BlockStoreException(ex);
  }
 finally {
    if (s != null) {
      try {
        s.close();
      }
 catch (      SQLException e) {
        throw new BlockStoreException("String_Node_Str");
      }
    }
  }
}
Program: 85617
Project: 85617
Buggy source:
/** 
 * Sets the number of fractional decimal places to be displayed on the given NumberFormat object to the value of the given integer.
 * @return The minimum and maximum fractional places settings that theformatter had before this change, as an ImmutableList. 
 */
private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter,int min,int max){
  ImmutableList<Integer> ante=ImmutableList.<Integer>of(formatter.getMinimumFractionDigits(),formatter.getMaximumFractionDigits());
  formatter.setMinimumFractionDigits(min);
  formatter.setMaximumFractionDigits(max);
  return ante;
}

Fixed version (ground truth):
/** 
 * Sets the number of fractional decimal places to be displayed on the given NumberFormat object to the value of the given integer.
 * @return The minimum and maximum fractional places settings that theformatter had before this change, as an ImmutableList. 
 */
private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter,int min,int max){
  ImmutableList<Integer> ante=ImmutableList.of(formatter.getMinimumFractionDigits(),formatter.getMaximumFractionDigits());
  formatter.setMinimumFractionDigits(min);
  formatter.setMaximumFractionDigits(max);
  return ante;
}
Program: 85618
Project: 85618
Buggy source:
private static List<Integer> boxAsList(int[] elements) throws IllegalArgumentException {
  List<Integer> list=new ArrayList<Integer>(elements.length);
  for (  int e : elements) {
    checkArgument(e > 0,"String_Node_Str");
    list.add(e);
  }
  ;
  return list;
}

Fixed version (ground truth):
private static List<Integer> boxAsList(int[] elements) throws IllegalArgumentException {
  List<Integer> list=new ArrayList<Integer>(elements.length);
  for (  int e : elements) {
    checkArgument(e > 0,"String_Node_Str");
    list.add(e);
  }
  return list;
}
Program: 85619
Project: 85619
Buggy source:
private @Nullable Result analyzeIsFinal(){
  if (tx.getConfidence().getSource() == TransactionConfidence.Source.SELF)   return Result.OK;
  if (wallet == null)   return null;
  final int height=wallet.getLastBlockSeenHeight();
  final long time=wallet.getLastBlockSeenTimeSecs();
  final int adjustedHeight=height + 1;
  if (!tx.isFinal(adjustedHeight,time)) {
    nonFinal=tx;
    return Result.NON_FINAL;
  }
  for (  Transaction dep : dependencies) {
    if (!dep.isFinal(adjustedHeight,time)) {
      nonFinal=dep;
      return Result.NON_FINAL;
    }
  }
  return Result.OK;
}

Fixed version (ground truth):
@Nullable private Result analyzeIsFinal(){
  if (tx.getConfidence().getSource() == TransactionConfidence.Source.SELF)   return Result.OK;
  if (wallet == null)   return null;
  final int height=wallet.getLastBlockSeenHeight();
  final long time=wallet.getLastBlockSeenTimeSecs();
  final int adjustedHeight=height + 1;
  if (!tx.isFinal(adjustedHeight,time)) {
    nonFinal=tx;
    return Result.NON_FINAL;
  }
  for (  Transaction dep : dependencies) {
    if (!dep.isFinal(adjustedHeight,time)) {
      nonFinal=dep;
      return Result.NON_FINAL;
    }
  }
  return Result.OK;
}
Program: 85620
Project: 85620
Buggy source:
/** 
 * Get 1 header of the block number 1 (the first one is 0) in the chain
 */
@Test public void testHeaders1() throws Exception {
  BitcoinSerializer bs=new BitcoinSerializer(MainNetParams.get());
  String headersMessageBytesHex="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  byte[] headersMessageBytes=HEX.decode(headersMessageBytesHex);
  HeadersMessage hm=(HeadersMessage)bs.deserialize(ByteBuffer.wrap(headersMessageBytes));
  Block block=hm.getBlockHeaders().get(0);
  String hash=block.getHashAsString();
  assertEquals(hash,"String_Node_Str");
  assertNull(block.transactions);
  assertEquals(Utils.HEX.encode(block.getMerkleRoot().getBytes()),"String_Node_Str");
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
  bs.serialize(hm,byteArrayOutputStream);
  byte[] serializedBytes=byteArrayOutputStream.toByteArray();
  String serializedBytesHex=new String(HEX.encode(serializedBytes));
  assertEquals(headersMessageBytes.length,serializedBytes.length);
  assertEquals(true,Arrays.equals(headersMessageBytes,serializedBytes));
}

Fixed version (ground truth):
/** 
 * Get 1 header of the block number 1 (the first one is 0) in the chain
 */
@Test public void testHeaders1() throws Exception {
  BitcoinSerializer bs=new BitcoinSerializer(MainNetParams.get());
  String headersMessageBytesHex="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  byte[] headersMessageBytes=HEX.decode(headersMessageBytesHex);
  HeadersMessage hm=(HeadersMessage)bs.deserialize(ByteBuffer.wrap(headersMessageBytes));
  Block block=hm.getBlockHeaders().get(0);
  String hash=block.getHashAsString();
  assertEquals(hash,"String_Node_Str");
  assertNull(block.transactions);
  assertEquals(Utils.HEX.encode(block.getMerkleRoot().getBytes()),"String_Node_Str");
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
  bs.serialize(hm,byteArrayOutputStream);
  byte[] serializedBytes=byteArrayOutputStream.toByteArray();
  String serializedBytesHex=HEX.encode(serializedBytes);
  assertEquals(headersMessageBytes.length,serializedBytes.length);
  assertEquals(true,Arrays.equals(headersMessageBytes,serializedBytes));
}
Program: 85623
Project: 85623
Buggy source:
@Test public void validateSetup(){
  byte[] b1=new byte[]{1,1,1,2,3,4,5,6,7};
  byte[] b2=new byte[]{1,2,3};
  assertTrue(arrayContains(b1,b2));
  assertTrue(arrayContains(txMessage,txMessagePart));
  assertTrue(arrayContains(tx1BytesWithHeader,tx1Bytes));
  assertTrue(arrayContains(tx2BytesWithHeader,tx2Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,b1Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,tx1Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,tx2Bytes));
  assertFalse(arrayContains(tx1BytesWithHeader,b1Bytes));
}

Fixed version (ground truth):
@Test public void validateSetup(){
  byte[] b1={1,1,1,2,3,4,5,6,7};
  byte[] b2={1,2,3};
  assertTrue(arrayContains(b1,b2));
  assertTrue(arrayContains(txMessage,txMessagePart));
  assertTrue(arrayContains(tx1BytesWithHeader,tx1Bytes));
  assertTrue(arrayContains(tx2BytesWithHeader,tx2Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,b1Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,tx1Bytes));
  assertTrue(arrayContains(b1BytesWithHeader,tx2Bytes));
  assertFalse(arrayContains(tx1BytesWithHeader,b1Bytes));
}
Program: 85624
Project: 85624
Buggy source:
/** 
 * Returns only the keys that have been issued by this chain, lookahead not included.
 */
public List<ECKey> getIssuedReceiveKeys(){
  return getKeys(false);
}

Fixed version (ground truth):
/** 
 * Returns only the external keys that have been issued by this chain, lookahead not included.
 */
public List<ECKey> getIssuedReceiveKeys(){
  final List<ECKey> keys=new ArrayList<ECKey>(getKeys(false));
  for (Iterator<ECKey> i=keys.iterator(); i.hasNext(); ) {
    DeterministicKey parent=((DeterministicKey)i.next()).getParent();
    if (parent == null || !externalKey.equals(parent))     i.remove();
  }
  return keys;
}
Program: 85626
Project: 85626
Buggy source:
@Override void bitcoinSerializeToStream(OutputStream stream) throws IOException {
  Utils.uint32ToByteStreamLE(height,stream);
  stream.write(chainHead.getBytes());
  stream.write(new VarInt(hits.length).encode());
  stream.write(hits);
  stream.write(new VarInt(outputs.size()).encode());
  for (  TransactionOutput output : outputs) {
    Transaction tx=output.getParentTransaction();
    Utils.uint32ToByteStreamLE(tx != null ? tx.getVersion() : 0L,stream);
    Utils.uint32ToByteStreamLE(height,stream);
    output.bitcoinSerializeToStream(stream);
  }
}

Fixed version (ground truth):
@Override void bitcoinSerializeToStream(OutputStream stream) throws IOException {
  Utils.uint32ToByteStreamLE(height,stream);
  stream.write(chainHead.getBytes());
  stream.write(new VarInt(hits.length).encode());
  stream.write(hits);
  stream.write(new VarInt(outputs.size()).encode());
  for (int i=0; i < outputs.size(); i++) {
    TransactionOutput output=outputs.get(i);
    Transaction tx=output.getParentTransaction();
    Utils.uint32ToByteStreamLE(tx != null ? tx.getVersion() : 0L,stream);
    Utils.uint32ToByteStreamLE(heights[i],stream);
    output.bitcoinSerializeToStream(stream);
  }
}
Program: 85627
Project: 85627
Buggy source:
@Override @Before public void setUp() throws Exception {
  super.setUp();
  confidenceTable=Context.get().getConfidenceTable();
  VersionMessage ver=new VersionMessage(unitTestParams,100);
  InetSocketAddress address=new InetSocketAddress("String_Node_Str",4000);
  peer=new Peer(unitTestParams,ver,new PeerAddress(address),blockChain);
  peer.addWallet(wallet);
}

Fixed version (ground truth):
@Override @Before public void setUp() throws Exception {
  super.setUp();
  VersionMessage ver=new VersionMessage(unitTestParams,100);
  InetSocketAddress address=new InetSocketAddress("String_Node_Str",4000);
  peer=new Peer(unitTestParams,ver,new PeerAddress(address),blockChain);
  peer.addWallet(wallet);
}
Program: 85628
Project: 85628
Buggy source:
@Test public void getUTXOs() throws Exception {
  connectWithVersion(GetUTXOsMessage.MIN_PROTOCOL_VERSION,VersionMessage.NODE_NETWORK | VersionMessage.NODE_GETUTXOS);
  Sha256Hash hash1=Sha256Hash.hash("String_Node_Str".getBytes());
  TransactionOutPoint op1=new TransactionOutPoint(unitTestParams,1,hash1);
  Sha256Hash hash2=Sha256Hash.hash("String_Node_Str".getBytes());
  TransactionOutPoint op2=new TransactionOutPoint(unitTestParams,2,hash1);
  ListenableFuture<UTXOsMessage> future1=peer.getUTXOs(ImmutableList.of(op1));
  ListenableFuture<UTXOsMessage> future2=peer.getUTXOs(ImmutableList.of(op2));
  GetUTXOsMessage msg1=(GetUTXOsMessage)outbound(writeTarget);
  GetUTXOsMessage msg2=(GetUTXOsMessage)outbound(writeTarget);
  assertEquals(op1,msg1.getOutPoints().get(0));
  assertEquals(op2,msg2.getOutPoints().get(0));
  assertEquals(1,msg1.getOutPoints().size());
  assertFalse(future1.isDone());
  ECKey key=new ECKey();
  TransactionOutput out1=new TransactionOutput(unitTestParams,null,Coin.CENT,key);
  UTXOsMessage response1=new UTXOsMessage(unitTestParams,ImmutableList.of(out1),new long[]{-1},Sha256Hash.ZERO_HASH,1234);
  inbound(writeTarget,response1);
  assertEquals(future1.get(),response1);
  TransactionOutput out2=new TransactionOutput(unitTestParams,null,Coin.FIFTY_COINS,key);
  UTXOsMessage response2=new UTXOsMessage(unitTestParams,ImmutableList.of(out2),new long[]{-1},Sha256Hash.ZERO_HASH,1234);
  inbound(writeTarget,response2);
  assertEquals(future1.get(),response2);
}

Fixed version (ground truth):
@Test public void getUTXOs() throws Exception {
  connectWithVersion(GetUTXOsMessage.MIN_PROTOCOL_VERSION,VersionMessage.NODE_NETWORK | VersionMessage.NODE_GETUTXOS);
  TransactionOutPoint op1=new TransactionOutPoint(unitTestParams,1,Sha256Hash.hash("String_Node_Str".getBytes()));
  TransactionOutPoint op2=new TransactionOutPoint(unitTestParams,2,Sha256Hash.hash("String_Node_Str".getBytes()));
  ListenableFuture<UTXOsMessage> future1=peer.getUTXOs(ImmutableList.of(op1));
  ListenableFuture<UTXOsMessage> future2=peer.getUTXOs(ImmutableList.of(op2));
  GetUTXOsMessage msg1=(GetUTXOsMessage)outbound(writeTarget);
  GetUTXOsMessage msg2=(GetUTXOsMessage)outbound(writeTarget);
  assertEquals(op1,msg1.getOutPoints().get(0));
  assertEquals(op2,msg2.getOutPoints().get(0));
  assertEquals(1,msg1.getOutPoints().size());
  assertFalse(future1.isDone());
  ECKey key=new ECKey();
  TransactionOutput out1=new TransactionOutput(unitTestParams,null,Coin.CENT,key);
  UTXOsMessage response1=new UTXOsMessage(unitTestParams,ImmutableList.of(out1),new long[]{UTXOsMessage.MEMPOOL_HEIGHT},Sha256Hash.ZERO_HASH,1234);
  inbound(writeTarget,response1);
  assertEquals(future1.get(),response1);
  TransactionOutput out2=new TransactionOutput(unitTestParams,null,Coin.FIFTY_COINS,key);
  UTXOsMessage response2=new UTXOsMessage(unitTestParams,ImmutableList.of(out2),new long[]{1000},Sha256Hash.ZERO_HASH,1234);
  inbound(writeTarget,response2);
  assertEquals(future2.get(),response2);
}