Program: 85931
Project: 85931
Buggy source:
/** 
 * Once a transaction has some inputs and outputs added, the signatures in the inputs can be calculated. The signature is over the transaction itself, to prove the redeemer actually created that transaction, so we have to do this step last.<p> <p/> This method is similar to SignatureHash in script.cpp
 * @param hashType This should always be set to SigHash.ALL currently. Other types are unused.
 * @param wallet   A wallet is required to fetch the keys needed for signing.
 */
public synchronized void signInputs(SigHash hashType,Wallet wallet) throws ScriptException {
  Preconditions.checkState(inputs.size() > 0);
  Preconditions.checkState(outputs.size() > 0);
  Preconditions.checkArgument(hashType == SigHash.ALL,"String_Node_Str");
  byte[][] signatures=new byte[inputs.size()][];
  ECKey[] signingKeys=new ECKey[inputs.size()];
  for (int i=0; i < inputs.size(); i++) {
    TransactionInput input=inputs.get(i);
    Preconditions.checkState(input.getScriptBytes().length == 0,"String_Node_Str");
    ECKey key=input.getOutpoint().getConnectedKey(wallet);
    Preconditions.checkNotNull(key,"String_Node_Str",input.getOutpoint().getHash());
    signingKeys[i]=key;
    boolean anyoneCanPay=false;
    byte[] connectedPubKeyScript=input.getOutpoint().getConnectedPubKeyScript();
    Sha256Hash hash=hashTransactionForSignature(i,connectedPubKeyScript,hashType,anyoneCanPay);
    try {
      ByteArrayOutputStream bos=new UnsafeByteArrayOutputStream(73);
      bos.write(key.sign(hash.getBytes()));
      bos.write((hashType.ordinal() + 1) | (anyoneCanPay ? 0x80 : 0));
      signatures[i]=bos.toByteArray();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
  for (int i=0; i < inputs.size(); i++) {
    TransactionInput input=inputs.get(i);
    Preconditions.checkState(input.getScriptBytes().length == 0);
    ECKey key=signingKeys[i];
    Script scriptPubKey=input.getOutpoint().getConnectedOutput().getScriptPubKey();
    if (scriptPubKey.isSentToAddress()) {
      input.setScriptBytes(Script.createInputScript(signatures[i],key.getPubKey()));
    }
 else     if (scriptPubKey.isSentToRawPubKey()) {
      input.setScriptBytes(Script.createInputScript(signatures[i]));
    }
 else {
      throw new RuntimeException("String_Node_Str" + scriptPubKey);
    }
  }
}

Fixed version (ground truth):
/** 
 * Once a transaction has some inputs and outputs added, the signatures in the inputs can be calculated. The signature is over the transaction itself, to prove the redeemer actually created that transaction, so we have to do this step last.<p> <p/> This method is similar to SignatureHash in script.cpp
 * @param hashType This should always be set to SigHash.ALL currently. Other types are unused.
 * @param wallet   A wallet is required to fetch the keys needed for signing.
 */
public synchronized void signInputs(SigHash hashType,Wallet wallet) throws ScriptException {
  Preconditions.checkState(inputs.size() > 0);
  Preconditions.checkState(outputs.size() > 0);
  Preconditions.checkArgument(hashType == SigHash.ALL,"String_Node_Str");
  byte[][] signatures=new byte[inputs.size()][];
  ECKey[] signingKeys=new ECKey[inputs.size()];
  for (int i=0; i < inputs.size(); i++) {
    TransactionInput input=inputs.get(i);
    Preconditions.checkState(input.getScriptBytes().length == 0,"String_Node_Str");
    ECKey key=input.getOutpoint().getConnectedKey(wallet);
    Preconditions.checkNotNull(key,"String_Node_Str",input.getOutpoint().getHash());
    signingKeys[i]=key;
    boolean anyoneCanPay=false;
    byte[] connectedPubKeyScript=input.getOutpoint().getConnectedPubKeyScript();
    Sha256Hash hash=hashTransactionForSignature(i,connectedPubKeyScript,hashType,anyoneCanPay);
    try {
      ByteArrayOutputStream bos=new UnsafeByteArrayOutputStream(73);
      bos.write(key.sign(hash.getBytes()));
      bos.write((hashType.ordinal() + 1) | (anyoneCanPay ? 0x80 : 0));
      signatures[i]=bos.toByteArray();
      bos.close();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
  for (int i=0; i < inputs.size(); i++) {
    TransactionInput input=inputs.get(i);
    Preconditions.checkState(input.getScriptBytes().length == 0);
    ECKey key=signingKeys[i];
    Script scriptPubKey=input.getOutpoint().getConnectedOutput().getScriptPubKey();
    if (scriptPubKey.isSentToAddress()) {
      input.setScriptBytes(Script.createInputScript(signatures[i],key.getPubKey()));
    }
 else     if (scriptPubKey.isSentToRawPubKey()) {
      input.setScriptBytes(Script.createInputScript(signatures[i]));
    }
 else {
      throw new RuntimeException("String_Node_Str" + scriptPubKey);
    }
  }
}