nus-yam/ex-repair huggingface dataset:
Program: 35082
Project: 35082
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str")}) public Result<Balance> transfer(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) TransferForm form){
  Na value=Na.valueOf(form.getAmount());
  return accountLedgerService.transfer(AddressTool.getAddress(form.getAddress()),AddressTool.getAddress(form.getToAddress()),value,form.getPassword(),form.getRemark());
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str")}) public Result<Balance> transfer(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) TransferForm form){
  if (form == null) {
    return Result.getFailed(AccountLedgerErrorCode.PARAMETER_ERROR);
  }
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountLedgerErrorCode.ADDRESS_ERROR);
  }
  if (!Address.validAddress(form.getToAddress())) {
    return Result.getFailed(AccountLedgerErrorCode.ADDRESS_ERROR);
  }
  if (form.getAmount() <= 0) {
    return Result.getFailed(AccountLedgerErrorCode.PARAMETER_ERROR);
  }
  Na value=Na.valueOf(form.getAmount());
  return accountLedgerService.transfer(AddressTool.getAddress(form.getAddress()),AddressTool.getAddress(form.getToAddress()),value,form.getPassword(),form.getRemark());
}
Program: 35084
Project: 35084
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation("String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result<Boolean> alias(@PathParam("String_Node_Str") String alias,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(alias) || !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  return aliasService.setAlias(form.getAddress(),form.getPassword(),alias);
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation("String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result<Boolean> alias(@PathParam("String_Node_Str") String alias,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(alias)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  if (StringUtils.isBlank(form.getPassword()) || !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return aliasService.setAlias(form.getAddress(),form.getPassword(),alias);
}
Program: 35085
Project: 35085
Buggy source:
/** 
 * 设置密码
 * @param address
 * @param password
 * @return
 */
public Result setPassword(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (!StringUtils.validPassword(password)) {
    return new Result(false,"String_Node_Str");
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str" + address);
  }
  if (account.isEncrypted()) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_IS_ALREADY_ENCRYPTED,"String_Node_Str");
  }
  try {
    account.encrypt(password);
    accountStorageService.updateAccount(new AccountPo(account));
  }
 catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed();
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
/** 
 * 设置密码
 * @param address
 * @param password
 * @return
 */
public Result setPassword(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(password)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (!StringUtils.validPassword(password)) {
    return new Result(false,"String_Node_Str");
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str" + address);
  }
  if (account.isEncrypted()) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_IS_ALREADY_ENCRYPTED,"String_Node_Str");
  }
  try {
    account.encrypt(password);
    accountStorageService.updateAccount(new AccountPo(account));
  }
 catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed();
  }
  return Result.getSuccess();
}
Program: 35086
Project: 35086
Buggy source:
/** 
 * 修改账户密码
 * @param oldPassword
 * @param newPassword
 * @return
 */
public Result changePassword(String address,String oldPassword,String newPassword){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (!StringUtils.validPassword(oldPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  if (!StringUtils.validPassword(newPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST,"String_Node_Str" + address);
  }
  try {
    if (!account.isEncrypted()) {
      return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
    }
    if (!account.unlock(oldPassword)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
    }
    account.encrypt(newPassword,true);
    AccountPo po=new AccountPo(account);
    return accountStorageService.updateAccount(po);
  }
 catch (  Exception e) {
    Log.error(e);
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * 修改账户密码
 * @param oldPassword
 * @param newPassword
 * @return
 */
public Result changePassword(String address,String oldPassword,String newPassword){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(oldPassword)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (StringUtils.isBlank(newPassword)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (!StringUtils.validPassword(oldPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  if (!StringUtils.validPassword(newPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST,"String_Node_Str" + address);
  }
  try {
    if (!account.isEncrypted()) {
      return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
    }
    if (!account.unlock(oldPassword)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
    }
    account.encrypt(newPassword,true);
    AccountPo po=new AccountPo(account);
    return accountStorageService.updateAccount(po);
  }
 catch (  Exception e) {
    Log.error(e);
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
  }
}
Program: 35087
Project: 35087
Buggy source:
@PUT @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result setPassword(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountUpdatePasswordForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  String password=form.getPassword();
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  String newPassword=form.getNewPassword();
  if (!StringUtils.validPassword(newPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  return this.accountBaseService.changePassword(address,password,newPassword);
}

Fixed version (ground truth):
@PUT @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result setPassword(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountUpdatePasswordForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  String password=form.getPassword();
  String newPassword=form.getNewPassword();
  if (StringUtils.isBlank(password)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (StringUtils.isBlank(newPassword)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  if (!StringUtils.validPassword(newPassword)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  return this.accountBaseService.changePassword(address,password,newPassword);
}
Program: 35088
Project: 35088
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result updatePassword(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountPasswordForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  String password=form.getPassword();
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  return accountBaseService.setPassword(address,password);
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result updatePassword(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountPasswordForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  String password=form.getPassword();
  if (StringUtils.isBlank(password)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR,"String_Node_Str");
  }
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG,"String_Node_Str");
  }
  return accountBaseService.setPassword(address,password);
}
Program: 35089
Project: 35089
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation("String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result<Boolean> alias(@PathParam("String_Node_Str") String alias,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(alias)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  if (StringUtils.isBlank(form.getPassword()) || !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return aliasService.setAlias(form.getAddress(),form.getPassword(),alias);
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation("String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Result.class)}) public Result<Boolean> alias(@PathParam("String_Node_Str") String alias,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(form.getAddress())) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(alias)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  if (StringUtils.isNotBlank(form.getPassword()) && !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return aliasService.setAlias(form.getAddress(),form.getPassword(),alias);
}
Program: 35090
Project: 35090
Buggy source:
@Override public Result validPassword(Account account,String password){
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  if (null != account) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  try {
    if (!account.unlock(password)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
 else {
      return Result.getSuccess();
    }
  }
 catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed();
  }
}

Fixed version (ground truth):
@Override public Result validPassword(Account account,String password){
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  if (null == account) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  try {
    if (!account.unlock(password)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
 else {
      return Result.getSuccess();
    }
  }
 catch (  NulsException e) {
    Log.error(e);
    return Result.getFailed();
  }
}
Program: 35091
Project: 35091
Buggy source:
@Override public void onMessage(GetBlocksHashRequest message,Node fromNode){
  GetBlocksHashParam param=message.getMsgBody();
  if (param.getSize() > MAX_SIZE) {
    return;
  }
  BlockHeader endHeader=blockService.getBlockHeader(param.getStart() + param.getSize()).getData();
  if (null == endHeader) {
    sendNotFound(fromNode,message.getHash());
    return;
  }
  BlockHashResponse response=new BlockHashResponse();
  response.setRequestMessageHash(message.getHash());
  BlockHeader header=endHeader;
  while (header.getHeight() > param.getStart()) {
    response.putFront(header.getHeight(),header.getHash());
    header=blockService.getBlockHeader(header.getPreHash()).getData();
  }
  sendResponse(response,fromNode);
}

Fixed version (ground truth):
@Override public void onMessage(GetBlocksHashRequest message,Node fromNode){
  GetBlocksHashParam param=message.getMsgBody();
  if (param.getSize() > MAX_SIZE) {
    return;
  }
  BlockHeader endHeader=blockService.getBlockHeader(param.getStart() + param.getSize() - 1).getData();
  if (null == endHeader) {
    sendNotFound(fromNode,message.getHash());
    return;
  }
  BlockHashResponse response=new BlockHashResponse();
  response.setRequestMessageHash(message.getHash());
  BlockHeader header=endHeader;
  while (header.getHeight() > param.getStart()) {
    response.putFront(header.getHeight(),header.getHash());
    header=blockService.getBlockHeader(header.getPreHash()).getData();
  }
  sendResponse(response,fromNode);
}
Program: 35092
Project: 35092
Buggy source:
@Override public Transaction getTx(NulsDigestData hash){
  return transactionStorageService.getTx(hash);
}

Fixed version (ground truth):
@Override public Transaction getTx(NulsDigestData hash){
  return utxoLedgerTransactionStorageService.getTx(hash);
}
Program: 35093
Project: 35093
Buggy source:
private Result saveCoinData(Transaction tx) throws IOException {
  byte[] txHashBytes=txHashBytes=tx.getHash().serialize();
  BatchOperation batch=utxoStorageService.createWriteBatch();
  CoinData coinData=tx.getCoinData();
  if (coinData != null) {
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      batch.delete(from.getOwner());
    }
    List<Coin> tos=coinData.getTo();
    byte[] indexBytes;
    for (int i=0, length=tos.size(); i < length; i++) {
      try {
        batch.put(Arrays.concatenate(txHashBytes,new VarInt(i).encode()),tos.get(i).serialize());
      }
 catch (      IOException e) {
        Log.error(e);
        return Result.getFailed(e.getMessage());
      }
    }
    Result batchResult=batch.executeBatch();
    if (batchResult.isFailed()) {
      return batchResult;
    }
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
private Result saveCoinData(Transaction tx) throws IOException {
  byte[] txHashBytes=txHashBytes=tx.getHash().serialize();
  BatchOperation batch=utxoLedgerUtxoStorageService.createWriteBatch();
  CoinData coinData=tx.getCoinData();
  if (coinData != null) {
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      batch.delete(from.getOwner());
    }
    List<Coin> tos=coinData.getTo();
    byte[] indexBytes;
    for (int i=0, length=tos.size(); i < length; i++) {
      try {
        batch.put(Arrays.concatenate(txHashBytes,new VarInt(i).encode()),tos.get(i).serialize());
      }
 catch (      IOException e) {
        Log.error(e);
        return Result.getFailed(e.getMessage());
      }
    }
    Result batchResult=batch.executeBatch();
    if (batchResult.isFailed()) {
      return batchResult;
    }
  }
  return Result.getSuccess();
}
Program: 35094
Project: 35094
Buggy source:
@Override public Result unlockTxCoinData(Transaction tx){
  if (tx == null || tx.getCoinData() == null) {
    return ValidateResult.getFailedResult(CLASS_NAME,LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    CoinData coinData=tx.getCoinData();
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      if (from.getLockTime() != -1) {
        return ValidateResult.getFailedResult(CLASS_NAME,LedgerErrorCode.UTXO_STATUS_CHANGE);
      }
    }
    Result result=saveCoinData(tx);
    return result;
  }
 catch (  IOException e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public Result unlockTxCoinData(Transaction tx){
  if (tx == null || tx.getCoinData() == null) {
    return ValidateResult.getFailedResult(CLASS_NAME,LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    CoinData coinData=tx.getCoinData();
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      if (from.getLockTime() != -1) {
        return ValidateResult.getFailedResult(CLASS_NAME,LedgerErrorCode.UTXO_STATUS_CHANGE);
      }
    }
    Result result=saveCoinData(tx);
    if (result.isFailed()) {
      rollbackCoinData(tx);
    }
    return result;
  }
 catch (  IOException e) {
    try {
      rollbackCoinData(tx);
    }
 catch (    IOException e1) {
    }
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}
Program: 35095
Project: 35095
Buggy source:
@Override public Result rollbackTx(Transaction tx){
  if (tx == null) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    rollbackCoinData(tx);
    Result result=transactionStorageService.deleteTx(tx);
    return result;
  }
 catch (  Exception e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public Result rollbackTx(Transaction tx){
  if (tx == null) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    Result result=rollbackCoinData(tx);
    if (result.isFailed()) {
      return result;
    }
    result=utxoLedgerTransactionStorageService.deleteTx(tx);
    return result;
  }
 catch (  Exception e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}
Program: 35096
Project: 35096
Buggy source:
private Result rollbackCoinData(Transaction tx) throws IOException {
  byte[] txHashBytes=txHashBytes=tx.getHash().serialize();
  BatchOperation batch=utxoStorageService.createWriteBatch();
  CoinData coinData=tx.getCoinData();
  if (coinData != null) {
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      try {
        batch.put(from.getOwner(),from.serialize());
      }
 catch (      IOException e) {
        Log.error(e);
        return Result.getFailed(e.getMessage());
      }
    }
    List<Coin> tos=coinData.getTo();
    byte[] indexBytes;
    for (int i=0, length=tos.size(); i < length; i++) {
      batch.delete(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
    }
    Result batchResult=batch.executeBatch();
    if (batchResult.isFailed()) {
      return batchResult;
    }
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
private Result rollbackCoinData(Transaction tx) throws IOException {
  byte[] txHashBytes=txHashBytes=tx.getHash().serialize();
  BatchOperation batch=utxoLedgerUtxoStorageService.createWriteBatch();
  CoinData coinData=tx.getCoinData();
  if (coinData != null) {
    List<Coin> froms=coinData.getFrom();
    for (    Coin from : froms) {
      try {
        batch.put(from.getOwner(),from.serialize());
      }
 catch (      IOException e) {
        Log.error(e);
        return Result.getFailed(e.getMessage());
      }
    }
    List<Coin> tos=coinData.getTo();
    byte[] indexBytes;
    for (int i=0, length=tos.size(); i < length; i++) {
      batch.delete(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
    }
    Result batchResult=batch.executeBatch();
    if (batchResult.isFailed()) {
      return batchResult;
    }
  }
  return Result.getSuccess();
}
Program: 35097
Project: 35097
Buggy source:
@Override public Result saveTx(Transaction tx){
  if (tx == null) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    saveCoinData(tx);
    Result result=transactionStorageService.saveTx(tx);
    return result;
  }
 catch (  Exception e) {
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public Result saveTx(Transaction tx){
  if (tx == null) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER);
  }
  try {
    Result result=saveCoinData(tx);
    if (result.isFailed()) {
      rollbackCoinData(tx);
      return result;
    }
    result=utxoLedgerTransactionStorageService.saveTx(tx);
    if (result.isFailed()) {
      rollbackTx(tx);
    }
    return result;
  }
 catch (  Exception e) {
    rollbackTx(tx);
    Log.error(e);
    return Result.getFailed(e.getMessage());
  }
}
Program: 35099
Project: 35099
Buggy source:
/** 
 * serialize important field
 */
@Override protected void serializeToStream(NulsOutputStreamBuffer stream) throws IOException {
  int fromCount=from == null ? 0 : from.size();
  stream.writeVarInt(fromCount);
  if (null != from) {
    for (    Coin coin : from) {
      stream.writeNulsData(coin);
    }
  }
  int toCount=to == null ? 0 : to.size();
  stream.writeVarInt(toCount);
  if (null != from) {
    for (    Coin coin : from) {
      stream.writeNulsData(coin);
    }
  }
}

Fixed version (ground truth):
/** 
 * serialize important field
 */
@Override protected void serializeToStream(NulsOutputStreamBuffer stream) throws IOException {
  int fromCount=from == null ? 0 : from.size();
  stream.writeVarInt(fromCount);
  if (null != from) {
    for (    Coin coin : from) {
      stream.writeNulsData(coin);
    }
  }
  int toCount=to == null ? 0 : to.size();
  stream.writeVarInt(toCount);
  if (null != to) {
    for (    Coin coin : to) {
      stream.writeNulsData(coin);
    }
  }
}
Program: 35100
Project: 35100
Buggy source:
public void saveNode(Node node){
  dbService.putModel(NetworkConstant.NODE_DB_AREA,node.getId(),node);
}

Fixed version (ground truth):
public void saveNode(Node node){
  dbService.putModel(NetworkConstant.NODE_DB_AREA,bytes(node.getId()),node);
}
Program: 35101
Project: 35101
Buggy source:
<T extends BaseNulsData>T get(String area,String key,Class<T> clazz);

Fixed version (ground truth):
byte[] get(String area,byte[] key);
Program: 35102
Project: 35102
Buggy source:
<T extends BaseNulsData>Result put(String area,String key,T value);

Fixed version (ground truth):
Result put(String area,byte[] key,String value);
Program: 35103
Project: 35103
Buggy source:
public static synchronized void init() throws Exception {
  if (!isInit) {
    isInit=true;
    File dir=loadDataPath();
    dataPath=dir.getPath();
    Log.info("String_Node_Str" + dataPath);
    File[] areaFiles=dir.listFiles();
    DB db=null;
    for (    File areaFile : areaFiles) {
      if (!areaFile.isDirectory()) {
        continue;
      }
      try {
        db=openDB(areaFile.getPath() + File.separator + BASE_DB_NAME,false);
        AREAS.put(areaFile.getName(),db);
      }
 catch (      Exception e) {
        Log.warn("String_Node_Str" + areaFile.getName(),e);
      }
    }
  }
}

Fixed version (ground truth):
public static synchronized void init() throws Exception {
  if (!isInit) {
    isInit=true;
    File dir=loadDataPath();
    dataPath=dir.getPath();
    Log.info("String_Node_Str" + dataPath);
    File[] areaFiles=dir.listFiles();
    DB db=null;
    for (    File areaFile : areaFiles) {
      if (!areaFile.isDirectory()) {
        continue;
      }
      try {
        db=openDB(areaFile.getPath() + File.separator + BASE_DB_NAME,false);
        if (db != null) {
          AREAS.put(areaFile.getName(),db);
        }
      }
 catch (      Exception e) {
        Log.warn("String_Node_Str" + areaFile.getName(),e);
      }
    }
  }
}
Program: 35104
Project: 35104
Buggy source:
public void testDestroyArea(){
  for (int i=0, length=getMax() + 10; i < length; i++) {
    destroyArea(area + "String_Node_Str" + i);
  }
}

Fixed version (ground truth):
public void testDestroyArea(){
  for (int i=0, length=getMax() + 10; i < length; i++) {
    destroyArea(area + "String_Node_Str" + i);
  }
  Assert.assertTrue(listArea().length < getMax());
}
Program: 35105
Project: 35105
Buggy source:
public static Properties loadProperties(String fileName) throws IOException {
  InputStream is=ConfigLoader.class.getClassLoader().getResourceAsStream(fileName);
  Properties prop=new Properties();
  prop.load(is);
  return prop;
}

Fixed version (ground truth):
public static Properties loadProperties(String fileName) throws IOException {
  InputStream is=ConfigLoader.class.getClassLoader().getResourceAsStream(fileName);
  Properties prop=new Properties();
  prop.load(is);
  is.close();
  return prop;
}
Program: 35106
Project: 35106
Buggy source:
private static File loadDataPath() throws Exception {
  Properties properties=Resources.getResourceAsProperties("String_Node_Str");
  String path=properties.getProperty("String_Node_Str","String_Node_Str");
  String max_str=properties.getProperty("String_Node_Str","String_Node_Str");
  try {
    max=Integer.parseInt(max_str);
  }
 catch (  Exception e) {
    max=20;
  }
  File dir=null;
  String pathSeparator=System.getProperty("String_Node_Str");
  String unixPathSeparator="String_Node_Str";
  String rootPath;
  if (unixPathSeparator.equals(pathSeparator)) {
    rootPath="String_Node_Str";
    if (path.startsWith(rootPath)) {
      dir=new File(path);
    }
 else {
      dir=new File(genAbsolutePath(path));
    }
  }
 else {
    rootPath="String_Node_Str";
    if (path.matches(rootPath)) {
      dir=new File(path);
    }
 else {
      dir=new File(genAbsolutePath(path));
    }
  }
  if (!dir.exists()) {
    dir.mkdirs();
  }
  return dir;
}

Fixed version (ground truth):
private static File loadDataPath() throws Exception {
  Properties properties=ConfigLoader.loadProperties("String_Node_Str");
  String path=properties.getProperty("String_Node_Str","String_Node_Str");
  String max_str=properties.getProperty("String_Node_Str","String_Node_Str");
  try {
    max=Integer.parseInt(max_str);
  }
 catch (  Exception e) {
    max=20;
  }
  File dir=null;
  String pathSeparator=System.getProperty("String_Node_Str");
  String unixPathSeparator="String_Node_Str";
  String rootPath;
  if (unixPathSeparator.equals(pathSeparator)) {
    rootPath="String_Node_Str";
    if (path.startsWith(rootPath)) {
      dir=new File(path);
    }
 else {
      dir=new File(genAbsolutePath(path));
    }
  }
 else {
    rootPath="String_Node_Str";
    if (path.matches(rootPath)) {
      dir=new File(path);
    }
 else {
      dir=new File(genAbsolutePath(path));
    }
  }
  if (!dir.exists()) {
    dir.mkdirs();
  }
  return dir;
}
Program: 35109
Project: 35109
Buggy source:
@Override public ValidateResult validate(RegisterAgentTransaction tx){
  ValidateResult result=ValidateResult.getSuccessResult();
  Agent agent=tx.getTxData().getExtend();
  if (null == agent) {
    return ValidateResult.getFailedResult(ErrorCode.NULL_PARAMETER);
  }
  if (PocConsensusConstant.AGENT_DEPOSIT_LOWER_LIMIT.isGreaterThan(agent.getDeposit())) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_NOT_ENOUGH);
  }
  try {
    if (!agent.getDeposit().equals(tx.getCoinData().getTotalNa())) {
      return ValidateResult.getFailedResult(SeverityLevelEnum.FLAGRANT_FOUL,ErrorCode.DEPOSIT_ERROR);
    }
  }
 catch (  NulsException e) {
    return ValidateResult.getFailedResult(ErrorCode.ORPHAN_TX);
  }
  return result;
}

Fixed version (ground truth):
@Override public ValidateResult validate(RegisterAgentTransaction tx){
  ValidateResult result=ValidateResult.getSuccessResult();
  Agent agent=tx.getTxData().getExtend();
  if (null == agent) {
    return ValidateResult.getFailedResult(ErrorCode.NULL_PARAMETER);
  }
  if (PocConsensusConstant.AGENT_DEPOSIT_LOWER_LIMIT.isGreaterThan(agent.getDeposit())) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_NOT_ENOUGH);
  }
  try {
    if (!agent.getDeposit().equals(tx.getCoinData().getTotalNa())) {
      return ValidateResult.getFailedResult(SeverityLevelEnum.FLAGRANT_FOUL,ErrorCode.DEPOSIT_ERROR);
    }
  }
 catch (  NulsException e) {
    return ValidateResult.getFailedResult(e.getErrorCode(),e.getMessage());
  }
  return result;
}
Program: 35110
Project: 35110
Buggy source:
@Override public ValidateResult validate(PocJoinConsensusTransaction data){
  Na limit=PocConsensusConstant.ENTRUSTER_DEPOSIT_LOWER_LIMIT;
  Na max=PocConsensusConstant.SUM_OF_DEPOSIT_OF_AGENT_UPPER_LIMIT;
  List<DepositPo> list=depositDataService.getEffectiveList(null,NulsContext.getInstance().getBestHeight(),data.getTxData().getExtend().getAgentHash(),null);
  if (list == null) {
    return ValidateResult.getSuccessResult();
  }
  Na total=Na.ZERO;
  for (  DepositPo cd : list) {
    total=total.add(Na.valueOf(cd.getDeposit()));
  }
  if (limit.isGreaterThan(data.getTxData().getExtend().getDeposit())) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_NOT_ENOUGH);
  }
  if (max.isLessThan(total.add(data.getTxData().getExtend().getDeposit()))) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_TOO_MUCH);
  }
  try {
    if (!data.getTxData().getExtend().getDeposit().equals(data.getCoinData().getTotalNa())) {
      return ValidateResult.getFailedResult(SeverityLevelEnum.FLAGRANT_FOUL,ErrorCode.DEPOSIT_ERROR);
    }
  }
 catch (  NulsException e) {
    Log.error(e);
    return ValidateResult.getFailedResult(e.getMessage());
  }
  return ValidateResult.getSuccessResult();
}

Fixed version (ground truth):
@Override public ValidateResult validate(PocJoinConsensusTransaction data){
  Na limit=PocConsensusConstant.ENTRUSTER_DEPOSIT_LOWER_LIMIT;
  Na max=PocConsensusConstant.SUM_OF_DEPOSIT_OF_AGENT_UPPER_LIMIT;
  List<DepositPo> list=depositDataService.getEffectiveList(null,NulsContext.getInstance().getBestHeight(),data.getTxData().getExtend().getAgentHash(),null);
  if (list == null) {
    return ValidateResult.getSuccessResult();
  }
  Na total=Na.ZERO;
  for (  DepositPo cd : list) {
    total=total.add(Na.valueOf(cd.getDeposit()));
  }
  if (limit.isGreaterThan(data.getTxData().getExtend().getDeposit())) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_NOT_ENOUGH);
  }
  if (max.isLessThan(total.add(data.getTxData().getExtend().getDeposit()))) {
    return ValidateResult.getFailedResult(ErrorCode.DEPOSIT_TOO_MUCH);
  }
  try {
    if (!data.getTxData().getExtend().getDeposit().equals(data.getCoinData().getTotalNa())) {
      return ValidateResult.getFailedResult(SeverityLevelEnum.FLAGRANT_FOUL,ErrorCode.DEPOSIT_ERROR);
    }
  }
 catch (  NulsException e) {
    Log.error(e);
    return ValidateResult.getFailedResult(e.getErrorCode(),e.getMessage());
  }
  return ValidateResult.getSuccessResult();
}
Program: 35111
Project: 35111
Buggy source:
/** 
 * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.
 * @param message            the detail message.
 * @param cause              the cause.  (A {@code null} value is permitted,and indicates that the cause is nonexistent or unknown.)
 * @param enableSuppression  whether or not suppression is enabledor disabled
 * @param writableStackTrace whether or not the stack trace shouldbe writable
 * @since 1.7
 */
protected NulsException(ErrorCode message,Throwable cause,boolean enableSuppression,boolean writableStackTrace){
  super(message.getMsg(),cause,enableSuppression,writableStackTrace);
  this.code=message.getCode();
  this.message=message.getMsg();
}

Fixed version (ground truth):
/** 
 * Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.
 * @param message            the detail message.
 * @param cause              the cause.  (A {@code null} value is permitted,and indicates that the cause is nonexistent or unknown.)
 * @param enableSuppression  whether or not suppression is enabledor disabled
 * @param writableStackTrace whether or not the stack trace shouldbe writable
 * @since 1.7
 */
protected NulsException(ErrorCode message,Throwable cause,boolean enableSuppression,boolean writableStackTrace){
  super(message.getMsg(),cause,enableSuppression,writableStackTrace);
  this.errorCode=message;
  this.code=message.getCode();
  this.message=message.getMsg();
}
Program: 35114
Project: 35114
Buggy source:
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
  SocketChannel channel=(SocketChannel)ctx.channel();
  Attribute<Node> nodeAttribute=channel.attr(key);
  Node node=nodeAttribute.get();
  if (node.getPort() == 0) {
    Log.debug("String_Node_Str");
  }
  String nodeId=node == null ? null : node.getId();
  Log.debug("String_Node_Str" + nodeId);
  Map<String,Node> nodes=getNetworkService().getNodes();
  for (  Node n : nodes.values()) {
    if (n.getIp().equals(node.getIp()) && n.getPort() != node.getSeverPort()) {
      Log.debug("String_Node_Str" + n.getId() + "String_Node_Str"+ n.getType()+ "String_Node_Str"+ nodeId+ "String_Node_Str");
      ctx.channel().close();
      return;
    }
  }
}

Fixed version (ground truth):
@Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
  SocketChannel channel=(SocketChannel)ctx.channel();
  Attribute<Node> nodeAttribute=channel.attr(key);
  Node node=nodeAttribute.get();
  if (node.getPort() == 0) {
    Log.debug("String_Node_Str");
  }
  String nodeId=node == null ? null : node.getId();
  Log.debug("String_Node_Str" + nodeId);
  Map<String,Node> nodes=getNetworkService().getNodes();
  for (  Node n : nodes.values()) {
    if (n.getIp().equals(node.getIp()) && !n.getPort().equals(node.getSeverPort())) {
      Log.debug("String_Node_Str" + n.getId() + "String_Node_Str"+ n.getType()+ "String_Node_Str"+ nodeId+ "String_Node_Str");
      ctx.channel().close();
      return;
    }
  }
}
Program: 35115
Project: 35115
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public RpcResult setLanguage(@PathParam("String_Node_Str") String language){
  AssertUtil.canNotEmpty(language);
  boolean b=I18nUtils.hasLanguage(language);
  if (!b) {
    return RpcResult.getFailed(ErrorCode.DATA_ERROR,"String_Node_Str");
  }
  try {
    I18nUtils.setLanguage(language);
  }
 catch (  NulsException e) {
    Log.error(e);
    RpcResult.getFailed(e.getMessage());
  }
  return RpcResult.getSuccess();
}

Fixed version (ground truth):
@PUT @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public RpcResult setLanguage(@PathParam("String_Node_Str") String language){
  AssertUtil.canNotEmpty(language);
  boolean b=I18nUtils.hasLanguage(language);
  if (!b) {
    return RpcResult.getFailed(ErrorCode.DATA_ERROR,"String_Node_Str");
  }
  try {
    I18nUtils.setLanguage(language);
  }
 catch (  NulsException e) {
    Log.error(e);
    RpcResult.getFailed(e.getMessage());
  }
  return RpcResult.getSuccess();
}
Program: 35116
Project: 35116
Buggy source:
@POST @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Boolean.class)}) public RpcResult forwardTransaction(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) TxForm form){
  Transaction tx=null;
  try {
    tx=form.getTx();
  }
 catch (  Exception e) {
    Log.error(e);
  }
  if (tx == null) {
    throw new NulsRuntimeException(ErrorCode.NULL_PARAMETER);
  }
  ValidateResult result=tx.verify();
  if (result.isFailed() && ErrorCode.ORPHAN_TX != result.getErrorCode()) {
    return RpcResult.getFailed(ErrorCode.DATA_ERROR);
  }
  TransactionEvent event=new TransactionEvent();
  event.setEventBody(tx);
  boolean b=eventBroadcaster.publishToLocal(event);
  return RpcResult.getSuccess().setData(b);
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Boolean.class)}) public RpcResult forwardTransaction(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) TxForm form){
  Transaction tx=null;
  try {
    tx=form.getTx();
  }
 catch (  Exception e) {
    Log.error(e);
  }
  if (tx == null) {
    throw new NulsRuntimeException(ErrorCode.NULL_PARAMETER);
  }
  ValidateResult result=tx.verify();
  if (result.isFailed() && ErrorCode.ORPHAN_TX != result.getErrorCode()) {
    return RpcResult.getFailed(ErrorCode.DATA_ERROR);
  }
  TransactionEvent event=new TransactionEvent();
  event.setEventBody(tx);
  boolean b=eventBroadcaster.publishToLocal(event);
  return RpcResult.getSuccess().setData(b);
}
Program: 35117
Project: 35117
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Page.class)}) public RpcResult getAgentList(@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer pageNumber,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer pageSize,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") String keyword,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") String sortType){
  if (pageNumber < 0 || pageSize < 0 || pageSize > 100) {
    return RpcResult.getFailed(ErrorCode.PARAMETER_ERROR);
  }
  if (null == pageNumber || pageNumber == 0) {
    pageNumber=1;
  }
  if (null == pageSize || pageSize == 0) {
    pageSize=10;
  }
  RpcResult result=RpcResult.getSuccess();
  Page<Map<String,Object>> list=this.consensusService.getAgentList(keyword,null,null,sortType,pageNumber,pageSize);
  result.setData(list);
  return result;
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Page.class)}) public RpcResult getAgentList(@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer pageNumber,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer pageSize,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") String keyword,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") String sortType){
  if (null == pageNumber || pageNumber == 0) {
    pageNumber=1;
  }
  if (null == pageSize || pageSize == 0) {
    pageSize=10;
  }
  if (pageNumber < 0 || pageSize < 0 || pageSize > 100) {
    return RpcResult.getFailed(ErrorCode.PARAMETER_ERROR);
  }
  RpcResult result=RpcResult.getSuccess();
  Page<Map<String,Object>> list=this.consensusService.getAgentList(keyword,null,null,sortType,pageNumber,pageSize);
  result.setData(list);
  return result;
}
Program: 35119
Project: 35119
Buggy source:
public static void close(){
  Collection<DB> dbs=AREAS.values();
  for (  DB db : dbs) {
    try {
      db.close();
    }
 catch (    IOException e) {
      Log.warn("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public static void close(){
  Set<Map.Entry<String,DB>> entries=AREAS.entrySet();
  for (  Map.Entry<String,DB> entry : entries) {
    try {
      AREAS.remove(entry.getKey());
      entry.getValue().close();
    }
 catch (    IOException e) {
      Log.warn("String_Node_Str",e);
    }
  }
}
Program: 35120
Project: 35120
Buggy source:
@Override public ValidateResult validate(RegisterAgentTransaction tx){
  ValidateResult result=ValidateResult.getSuccessResult();
  Agent agent=tx.getTxData().getExtend();
  String agentName=agent.getAgentName();
  List<AgentPo> caList=agentDataService.getEffectiveList(null,NulsContext.getInstance().getBestHeight(),null);
  if (caList != null) {
    for (    AgentPo ca : caList) {
      if (ca.getId().equals(tx.getTxData().getHexHash())) {
        continue;
      }
      if (ca.getAgentAddress().equals(tx.getTxData().getAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (ca.getAgentAddress().equals(agent.getPackingAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agent.getPackingAddress().equals(ca.getAgentAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agent.getPackingAddress().equals(ca.getPackingAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agentName.equals(ca.getAgentName())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (ConsensusContext.getSeedNodeList().contains(tx.getTxData().getAddress()) || ConsensusContext.getSeedNodeList().contains(agent.getPackingAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public ValidateResult validate(RegisterAgentTransaction tx){
  ValidateResult result=ValidateResult.getSuccessResult();
  Agent agent=tx.getTxData().getExtend();
  String agentName=agent.getAgentName();
  List<AgentPo> caList=agentDataService.getEffectiveList(null,NulsContext.getInstance().getBestHeight(),null);
  if (caList != null) {
    for (    AgentPo ca : caList) {
      if (ca.getId().equals(tx.getTxData().getHexHash())) {
        continue;
      }
      if (ca.getAgentAddress().equals(tx.getTxData().getAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (ca.getAgentAddress().equals(agent.getPackingAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agent.getPackingAddress().equals(ca.getAgentAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agent.getPackingAddress().equals(ca.getPackingAddress())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
      if (agentName.equals(ca.getAgentName())) {
        return ValidateResult.getFailedResult("String_Node_Str");
      }
    }
  }
  if (ConsensusContext.getSeedNodeList().contains(tx.getTxData().getAddress()) || ConsensusContext.getSeedNodeList().contains(agent.getPackingAddress())) {
    return ValidateResult.getFailedResult("String_Node_Str");
  }
  return result;
}
Program: 35121
Project: 35121
Buggy source:
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  String channelId=ctx.channel().id().asLongText();
  SocketChannel channel=(SocketChannel)ctx.channel();
  String nodeId=IpUtil.getNodeId(channel.remoteAddress());
  Log.debug("String_Node_Str" + nodeId);
  Log.debug("String_Node_Str" + channel.localAddress().getHostString() + "String_Node_Str"+ channel.localAddress().getPort());
  Attribute<Node> nodeAttribute=channel.attr(key);
  Node node=nodeAttribute.get();
  try {
    NioChannelMap.add(channelId,channel);
    node.setChannelId(channelId);
    node.setStatus(Node.CONNECT);
    getNetworkService().addConnNode(node);
  }
 catch (  Exception e) {
    Log.debug(nodeId);
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception {
  String channelId=ctx.channel().id().asLongText();
  SocketChannel channel=(SocketChannel)ctx.channel();
  String nodeId=IpUtil.getNodeId(channel.remoteAddress());
  Log.debug("String_Node_Str" + nodeId);
  Log.debug("String_Node_Str" + channel.localAddress().getHostString() + "String_Node_Str"+ channel.localAddress().getPort());
  Attribute<Node> nodeAttribute=channel.attr(key);
  Node node=nodeAttribute.get();
  try {
    NioChannelMap.add(channelId,channel);
    node.setChannelId(channelId);
    node.setStatus(Node.CONNECT);
    boolean result=getNetworkService().addConnNode(node);
    if (!result) {
      channel.close();
    }
  }
 catch (  Exception e) {
    Log.info("String_Node_Str" + nodeId);
  }
}
Program: 35122
Project: 35122
Buggy source:
public boolean isUsable(){
  return OutPutStatusEnum.UTXO_CONFIRM_UNSPEND == status || OutPutStatusEnum.UTXO_UNCONFIRM_UNSPEND == status;
}

Fixed version (ground truth):
public boolean isUsable(){
  return OutPutStatusEnum.UTXO_CONFIRMED_UNSPENT == status || OutPutStatusEnum.UTXO_UNCONFIRMED_UNSPENT == status;
}
Program: 35123
Project: 35123
Buggy source:
public boolean isConfirm(){
  return OutPutStatusEnum.UTXO_CONFIRM_UNSPEND == status || OutPutStatusEnum.UTXO_CONFIRM_TIME_LOCK == status || OutPutStatusEnum.UTXO_CONFIRM_SPEND == status || OutPutStatusEnum.UTXO_CONFIRM_CONSENSUS_LOCK == status;
}

Fixed version (ground truth):
public boolean isConfirm(){
  return OutPutStatusEnum.UTXO_CONFIRMED_UNSPENT == status || OutPutStatusEnum.UTXO_CONFIRMED_TIME_LOCK == status || OutPutStatusEnum.UTXO_CONFIRMED_SPENT == status || OutPutStatusEnum.UTXO_CONFIRMED_CONSENSUS_LOCK == status;
}
Program: 35124
Project: 35124
Buggy source:
public boolean isLocked(){
  return OutPutStatusEnum.UTXO_CONFIRM_CONSENSUS_LOCK == status || OutPutStatusEnum.UTXO_UNCONFIRM_CONSENSUS_LOCK == status || OutPutStatusEnum.UTXO_CONFIRM_TIME_LOCK == status || OutPutStatusEnum.UTXO_UNCONFIRM_TIME_LOCK == status;
}

Fixed version (ground truth):
public boolean isLocked(){
  return OutPutStatusEnum.UTXO_CONFIRMED_CONSENSUS_LOCK == status || OutPutStatusEnum.UTXO_UNCONFIRMED_CONSENSUS_LOCK == status || OutPutStatusEnum.UTXO_CONFIRMED_TIME_LOCK == status || OutPutStatusEnum.UTXO_UNCONFIRMED_TIME_LOCK == status;
}
Program: 35125
Project: 35125
Buggy source:
public boolean isSpend(){
  return OutPutStatusEnum.UTXO_CONFIRM_SPEND == status || OutPutStatusEnum.UTXO_UNCONFIRM_SPEND == status;
}

Fixed version (ground truth):
public boolean isSpend(){
  return OutPutStatusEnum.UTXO_CONFIRMED_SPENT == status || OutPutStatusEnum.UTXO_UNCONFIRMED_SPENT == status;
}