Program: 34989
Project: 34989
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=TransactionDto.class)}) public RpcClientResult getTxByHash(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String hash){
  if (StringUtils.isBlank(hash)) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER).toRpcClientResult();
  }
  if (!NulsDigestData.validHash(hash)) {
    return Result.getFailed(LedgerErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  Result result=null;
  try {
    Transaction tx=ledgerService.getTx(NulsDigestData.fromDigestHex(hash));
    if (tx == null) {
      result=Result.getFailed(LedgerErrorCode.DATA_NOT_FOUND);
    }
 else {
      tx.setStatus(TxStatusEnum.CONFIRMED);
      TransactionDto txDto=null;
      CoinData coinData=tx.getCoinData();
      if (coinData != null) {
        List<Coin> froms=coinData.getFrom();
        if (froms != null && froms.size() > 0) {
          byte[] fromHash, owner;
          int fromIndex;
          NulsDigestData fromHashObj;
          Transaction fromTx;
          Coin fromUtxo;
          for (          Coin from : froms) {
            owner=from.getOwner();
            fromHash=LedgerUtil.getTxHashBytes(owner);
            fromIndex=LedgerUtil.getIndex(owner);
            fromHashObj=new NulsDigestData();
            fromHashObj.parse(fromHash);
            fromTx=ledgerService.getTx(fromHashObj);
            fromUtxo=fromTx.getCoinData().getTo().get(fromIndex);
            from.setFrom(fromUtxo);
          }
        }
        txDto=new TransactionDto(tx);
        List<OutputDto> outputDtoList=new ArrayList<>();
        List<Coin> tos=coinData.getTo();
        if (tos != null && tos.size() > 0) {
          byte[] txHashBytes=tx.getHash().serialize();
          String txHash=hash;
          OutputDto outputDto=null;
          Coin to, temp;
          long bestHeight=NulsContext.getInstance().getBestHeight();
          long currentTime=TimeService.currentTimeMillis();
          long lockTime;
          for (int i=0, length=tos.size(); i < length; i++) {
            to=tos.get(i);
            outputDto=new OutputDto(to);
            outputDto.setTxHash(txHash);
            outputDto.setIndex(i);
            temp=utxoLedgerUtxoStorageService.getUtxo(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
            if (temp == null) {
              outputDto.setStatus(3);
            }
 else {
              lockTime=temp.getLockTime();
              if (lockTime > NulsConstant.BlOCKHEIGHT_TIME_DIVIDE) {
                if (lockTime > currentTime) {
                  outputDto.setStatus(2);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
 else {
                if (lockTime > bestHeight) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
            }
            outputDtoList.add(outputDto);
          }
        }
        txDto.setOutputs(outputDtoList);
        calTransactionValue(txDto);
      }
      result=Result.getSuccess();
      result.setData(txDto);
    }
  }
 catch (  NulsRuntimeException re) {
    Log.error(re);
    result=new Result(false,re.getCode(),re.getMessage());
  }
catch (  Exception e) {
    Log.error(e);
    result=Result.getFailed(LedgerErrorCode.SYS_UNKOWN_EXCEPTION);
  }
  return result.toRpcClientResult();
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=TransactionDto.class)}) public RpcClientResult getTxByHash(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String hash){
  if (StringUtils.isBlank(hash)) {
    return Result.getFailed(LedgerErrorCode.NULL_PARAMETER).toRpcClientResult();
  }
  if (!NulsDigestData.validHash(hash)) {
    return Result.getFailed(LedgerErrorCode.PARAMETER_ERROR).toRpcClientResult();
  }
  Result result=null;
  try {
    Transaction tx=ledgerService.getTx(NulsDigestData.fromDigestHex(hash));
    if (tx == null) {
      result=Result.getFailed(LedgerErrorCode.DATA_NOT_FOUND);
    }
 else {
      tx.setStatus(TxStatusEnum.CONFIRMED);
      TransactionDto txDto=null;
      CoinData coinData=tx.getCoinData();
      if (coinData != null) {
        List<Coin> froms=coinData.getFrom();
        if (froms != null && froms.size() > 0) {
          byte[] fromHash, owner;
          int fromIndex;
          NulsDigestData fromHashObj;
          Transaction fromTx;
          Coin fromUtxo;
          for (          Coin from : froms) {
            owner=from.getOwner();
            fromHash=LedgerUtil.getTxHashBytes(owner);
            fromIndex=LedgerUtil.getIndex(owner);
            fromHashObj=new NulsDigestData();
            fromHashObj.parse(fromHash);
            fromTx=ledgerService.getTx(fromHashObj);
            fromUtxo=fromTx.getCoinData().getTo().get(fromIndex);
            from.setFrom(fromUtxo);
          }
        }
        txDto=new TransactionDto(tx);
        List<OutputDto> outputDtoList=new ArrayList<>();
        List<Coin> tos=coinData.getTo();
        if (tos != null && tos.size() > 0) {
          byte[] txHashBytes=tx.getHash().serialize();
          String txHash=hash;
          OutputDto outputDto=null;
          Coin to, temp;
          long bestHeight=NulsContext.getInstance().getBestHeight();
          long currentTime=TimeService.currentTimeMillis();
          long lockTime;
          for (int i=0, length=tos.size(); i < length; i++) {
            to=tos.get(i);
            outputDto=new OutputDto(to);
            outputDto.setTxHash(txHash);
            outputDto.setIndex(i);
            temp=utxoLedgerUtxoStorageService.getUtxo(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
            if (temp == null) {
              outputDto.setStatus(3);
            }
 else {
              lockTime=temp.getLockTime();
              if (lockTime < 0) {
                outputDto.setStatus(2);
              }
 else               if (lockTime == 0) {
                outputDto.setStatus(0);
              }
 else               if (lockTime > NulsConstant.BlOCKHEIGHT_TIME_DIVIDE) {
                if (lockTime > currentTime) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
 else {
                if (lockTime > bestHeight) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
            }
            outputDtoList.add(outputDto);
          }
        }
        txDto.setOutputs(outputDtoList);
        calTransactionValue(txDto);
      }
      result=Result.getSuccess();
      result.setData(txDto);
    }
  }
 catch (  NulsRuntimeException re) {
    Log.error(re);
    result=new Result(false,re.getCode(),re.getMessage());
  }
catch (  Exception e) {
    Log.error(e);
    result=Result.getFailed(LedgerErrorCode.SYS_UNKOWN_EXCEPTION);
  }
  return result.toRpcClientResult();
}