nus-yam/ex-repair huggingface dataset:
Program: 35000
Project: 35000
Buggy source:
/** 
 * 初始化加载所有命令行实现
 */
private void init(){
  register(new GetTxProcessor());
  register(new GetBlockHeaderProcessor());
  register(new GetBlockProcessor());
  register(new GetBestBlockHeaderProcessor());
  register(new BackupAccountProcessor());
  register(new CreateAccountProcessor());
  register(new CreateAccountsProcessor());
  register(new GetAccountProcessor());
  register(new GetAccountsProcessor());
  register(new GetAssetProcessor());
  register(new GetBalanceProcessor());
  register(new GetWalletBalanceProcessor());
  register(new GetPrivateKeyProcessor());
  register(new ImportByKeyStoreProcessor());
  register(new ImportByPrivateKeyProcessor());
  register(new RemoveAccountProcessor());
  register(new ResetPasswordProcessor());
  register(new SetAliasProcessor());
  register(new SetPasswordProcessor());
  register(new TransferProcessor());
  register(new GetAccountTxListProcessor());
  register(new GetUTXOProcessor());
  register(new CreateAgentProcessor());
  register(new GetConsensusProcessor());
  register(new DepositProcessor());
  register(new WithdrawProcessor());
  register(new StopAgentProcessor());
  register(new GetAgentProcessor());
  register(new GetAgentsProcessor());
  register(new GetDepositedAgentsProcessor());
  register(new GetDepositedsProcessor());
  register(new GetDepositedInfoProcessor());
  register(new GetNetInfoProcessor());
  register(new GetNetNodesProcessor());
  register(new ExitProcessor());
  register(new HelpProcessor());
  register(new VersionProcessor());
  sdkInit();
}

Fixed version (ground truth):
/** 
 * 初始化加载所有命令行实现
 */
private void init(){
  register(new GetTxProcessor());
  register(new GetBlockHeaderProcessor());
  register(new GetBlockProcessor());
  register(new GetBestBlockHeaderProcessor());
  register(new CreateAccountProcessor());
  register(new CreateAccountsProcessor());
  register(new GetAccountProcessor());
  register(new GetAccountsProcessor());
  register(new GetAssetProcessor());
  register(new GetBalanceProcessor());
  register(new GetPrivateKeyProcessor());
  register(new ImportByPrivateKeyProcessor());
  register(new RemoveAccountProcessor());
  register(new ResetPasswordProcessor());
  register(new SetAliasProcessor());
  register(new SetPasswordProcessor());
  register(new TransferProcessor());
  register(new GetAccountTxListProcessor());
  register(new CreateAgentProcessor());
  register(new GetConsensusProcessor());
  register(new DepositProcessor());
  register(new WithdrawProcessor());
  register(new StopAgentProcessor());
  register(new GetAgentProcessor());
  register(new GetAgentsProcessor());
  register(new GetDepositedAgentsProcessor());
  register(new GetDepositedsProcessor());
  register(new GetDepositedInfoProcessor());
  register(new GetNetInfoProcessor());
  register(new GetNetNodesProcessor());
  register(new ExitProcessor());
  register(new HelpProcessor());
  register(new VersionProcessor());
  sdkInit();
}
Program: 35003
Project: 35003
Buggy source:
@Override public ValidateResult validate(RedPunishTransaction1 data){
  RedPunishData punishData=data.getTxData();
  if (punishData.getReasonCode() == PunishReasonEnum.DOUBLE_SPEND.getCode()) {
    SmallBlock smallBlock=new SmallBlock();
    try {
      smallBlock.parse(punishData.getEvidence());
    }
 catch (    NulsException e) {
      Log.error(e);
      return ValidateResult.getFailedResult(this.getClass().getName(),e.getErrorCode(),e.getMessage());
    }
  }
 else   if (punishData.getReasonCode() == PunishReasonEnum.TOO_MUCH_YELLOW_PUNISH.getCode()) {
  }
 else   if (punishData.getReasonCode() == PunishReasonEnum.BIFURCATION.getCode()) {
  }
 else {
    return ValidateResult.getFailedResult(this.getClass().getName(),"String_Node_Str");
  }
  return ValidateResult.getSuccessResult();
}

Fixed version (ground truth):
@Override public ValidateResult validate(RedPunishTransaction data){
  RedPunishData punishData=data.getTxData();
  if (punishData.getReasonCode() == PunishReasonEnum.DOUBLE_SPEND.getCode()) {
    SmallBlock smallBlock=new SmallBlock();
    try {
      smallBlock.parse(punishData.getEvidence());
    }
 catch (    NulsException e) {
      Log.error(e);
      return ValidateResult.getFailedResult(this.getClass().getName(),e.getErrorCode(),e.getMessage());
    }
  }
 else   if (punishData.getReasonCode() == PunishReasonEnum.TOO_MUCH_YELLOW_PUNISH.getCode()) {
  }
 else   if (punishData.getReasonCode() == PunishReasonEnum.BIFURCATION.getCode()) {
  }
 else {
    return ValidateResult.getFailedResult(this.getClass().getName(),"String_Node_Str");
  }
  return ValidateResult.getSuccessResult();
}
Program: 35004
Project: 35004
Buggy source:
private ValidateResult doValidate(NulsData data){
  index.set(1 + index.get());
  if (index.get() == list.size()) {
    return ValidateResult.getSuccessResult();
  }
  NulsDataValidator validator=list.get(index.get());
  ValidateResult result=validator.validate(data);
  if (null == result) {
    Log.error(validator.getClass() + "String_Node_Str");
  }
  if (!result.isSuccess()) {
    return result;
  }
  return this.doValidate(data);
}

Fixed version (ground truth):
private ValidateResult doValidate(NulsData data){
  index.set(1 + index.get());
  if (index.get() == list.size()) {
    return ValidateResult.getSuccessResult();
  }
  NulsDataValidator validator=list.get(index.get());
  ValidateResult result=null;
  try {
    result=validator.validate(data);
  }
 catch (  NulsException e) {
    Log.error(e);
    return ValidateResult.getFailedResult(this.getClass().getName(),e.getErrorCode(),e.getMessage());
  }
  if (null == result) {
    Log.error(validator.getClass() + "String_Node_Str");
  }
  if (!result.isSuccess()) {
    return result;
  }
  return this.doValidate(data);
}
Program: 35005
Project: 35005
Buggy source:
@Override public CommandResult execute(String[] args){
  int type=0;
  int pageNumber=0;
  int pageSize=0;
  if (args.length == 4) {
    pageNumber=Integer.parseInt(args[2]);
    pageSize=Integer.parseInt(args[3]);
  }
 else {
    type=Integer.parseInt(args[2]);
    pageNumber=Integer.parseInt(args[3]);
    pageSize=Integer.parseInt(args[4]);
  }
  String address=args[1];
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",type);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  int type=0;
  int pageNumber=0;
  int pageSize=0;
  if (args.length == 4) {
    pageNumber=Integer.parseInt(args[2]);
    pageSize=Integer.parseInt(args[3]);
  }
 else {
    type=Integer.parseInt(args[2]);
    pageNumber=Integer.parseInt(args[3]);
    pageSize=Integer.parseInt(args[4]);
  }
  String address=args[1];
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",type);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
    map.put("String_Node_Str",CommandHelper.txTypeExplain((Integer)map.get("String_Node_Str")));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}
Program: 35006
Project: 35006
Buggy source:
@Override public CommandResult execute(String[] args){
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  String address=args[1];
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  String address=args[1];
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
    map.put("String_Node_Str",CommandHelper.txTypeExplain((Integer)map.get("String_Node_Str")));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}
Program: 35008
Project: 35008
Buggy source:
@Override public CommandResult execute(String[] args){
  String agentHash=args[1];
  RpcClientResult result=restFul.get("String_Node_Str" + agentHash,null);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  Map<String,Object> map=(Map)result.getData();
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  result.setData(map);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  String agentHash=args[1];
  RpcClientResult result=restFul.get("String_Node_Str" + agentHash,null);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  Map<String,Object> map=(Map)result.getData();
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  map.put("String_Node_Str",CommandHelper.consensusExplain((Integer)map.get("String_Node_Str")));
  result.setData(map);
  return CommandResult.getResult(result);
}
Program: 35009
Project: 35009
Buggy source:
@Override public CommandResult execute(String[] args){
  int pageNumber=Integer.parseInt(args[1]);
  int pageSize=Integer.parseInt(args[2]);
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str",parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  int pageNumber=Integer.parseInt(args[1]);
  int pageSize=Integer.parseInt(args[2]);
  Map<String,Object> parameters=new HashMap<>();
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str",parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
    map.put("String_Node_Str",CommandHelper.consensusExplain((Integer)map.get("String_Node_Str")));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}
Program: 35010
Project: 35010
Buggy source:
@Override public CommandResult execute(String[] args){
  String address=args[1];
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  Map<String,Object> parameters=new HashMap<>(4);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  String address=args[1];
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  Map<String,Object> parameters=new HashMap<>(4);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.consensusExplain((Integer)map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}
Program: 35011
Project: 35011
Buggy source:
@Override public CommandResult execute(String[] args){
  String address=args[1];
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  Map<String,Object> parameters=new HashMap<>(4);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  if (args.length == 5) {
    parameters.put("String_Node_Str",args[4]);
  }
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  String address=args[1];
  int pageNumber=Integer.parseInt(args[2]);
  int pageSize=Integer.parseInt(args[3]);
  Map<String,Object> parameters=new HashMap<>(4);
  parameters.put("String_Node_Str",pageNumber);
  parameters.put("String_Node_Str",pageSize);
  if (args.length == 5) {
    parameters.put("String_Node_Str",args[4]);
  }
  RpcClientResult result=restFul.get("String_Node_Str" + address,parameters);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  List<Map<String,Object>> list=(List<Map<String,Object>>)((Map)result.getData()).get("String_Node_Str");
  for (  Map<String,Object> map : list) {
    map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
    map.put("String_Node_Str",CommandHelper.consensusExplain((Integer)map.get("String_Node_Str")));
    map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  }
  result.setData(list);
  return CommandResult.getResult(result);
}
Program: 35012
Project: 35012
Buggy source:
public static Double naToNuls(Object object){
  if (null == object) {
    return null;
  }
  Long na=null;
  if (object instanceof Long) {
    na=(Long)object;
  }
 else   if (object instanceof Integer) {
    na=((Integer)object).longValue();
  }
 else {
    return null;
  }
  return Na.valueOf(na).toDouble();
}

Fixed version (ground truth):
public static String naToNuls(Object object){
  if (null == object) {
    return null;
  }
  Long na=null;
  if (object instanceof Long) {
    na=(Long)object;
  }
 else   if (object instanceof Integer) {
    na=((Integer)object).longValue();
  }
 else {
    return null;
  }
  return (Na.valueOf(na)).toText();
}
Program: 35013
Project: 35013
Buggy source:
@Override public CommandResult execute(String[] args){
  String hash=args[1];
  if (StringUtils.isBlank(hash)) {
    return CommandResult.getFailed(KernelErrorCode.PARAMETER_ERROR.getMsg());
  }
  RpcClientResult result=restFul.get("String_Node_Str" + hash,null);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  Map<String,Object> map=(Map)result.getData();
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  map.put("String_Node_Str",statusExplain((Integer)map.get("String_Node_Str")));
  List<Map<String,Object>> inputs=(List<Map<String,Object>>)map.get("String_Node_Str");
  for (  Map<String,Object> input : inputs) {
    input.put("String_Node_Str",CommandHelper.naToNuls(input.get("String_Node_Str")));
  }
  List<Map<String,Object>> outputs=(List<Map<String,Object>>)map.get("String_Node_Str");
  for (  Map<String,Object> output : outputs) {
    output.put("String_Node_Str",CommandHelper.naToNuls(output.get("String_Node_Str")));
    output.put("String_Node_Str",statusExplainForOutPut((Integer)output.get("String_Node_Str")));
  }
  result.setData(map);
  return CommandResult.getResult(result);
}

Fixed version (ground truth):
@Override public CommandResult execute(String[] args){
  String hash=args[1];
  if (StringUtils.isBlank(hash)) {
    return CommandResult.getFailed(KernelErrorCode.PARAMETER_ERROR.getMsg());
  }
  RpcClientResult result=restFul.get("String_Node_Str" + hash,null);
  if (result.isFailed()) {
    return CommandResult.getFailed(result.getMsg());
  }
  Map<String,Object> map=(Map)result.getData();
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.naToNuls(map.get("String_Node_Str")));
  map.put("String_Node_Str",DateUtil.convertDate(new Date((Long)map.get("String_Node_Str"))));
  map.put("String_Node_Str",statusExplain((Integer)map.get("String_Node_Str")));
  map.put("String_Node_Str",CommandHelper.txTypeExplain((Integer)map.get("String_Node_Str")));
  List<Map<String,Object>> inputs=(List<Map<String,Object>>)map.get("String_Node_Str");
  for (  Map<String,Object> input : inputs) {
    input.put("String_Node_Str",CommandHelper.naToNuls(input.get("String_Node_Str")));
  }
  map.put("String_Node_Str",inputs);
  List<Map<String,Object>> outputs=(List<Map<String,Object>>)map.get("String_Node_Str");
  for (  Map<String,Object> output : outputs) {
    output.put("String_Node_Str",CommandHelper.naToNuls(output.get("String_Node_Str")));
    output.put("String_Node_Str",statusExplainForOutPut((Integer)output.get("String_Node_Str")));
  }
  map.put("String_Node_Str",outputs);
  result.setData(map);
  return CommandResult.getResult(result);
}
Program: 35014
Project: 35014
Buggy source:
@Override public Result<Integer> rollbackTransaction(Transaction tx){
  if (!AccountLegerUtils.isLocalTransaction(tx)) {
    return Result.getSuccess().setData(new Integer(0));
  }
  TransactionInfoPo txInfoPo=new TransactionInfoPo(tx);
  Result result=transactionInfoService.deleteTransactionInfo(txInfoPo);
  if (result.isFailed()) {
    return result;
  }
  result=localUtxoService.deleteUtxoOfTransaction(tx);
  return result;
}

Fixed version (ground truth):
@Override public Result<Integer> rollbackTransaction(Transaction tx){
  if (!AccountLegerUtils.isLocalTransaction(tx)) {
    return Result.getSuccess().setData(new Integer(0));
  }
  List<byte[]> addresses=AccountLegerUtils.getRelatedAddresses(tx);
  if (addresses == null || addresses.size() == 0) {
    return Result.getSuccess().setData(new Integer(0));
  }
  TransactionInfoPo txInfoPo=new TransactionInfoPo(tx);
  Result result=transactionInfoService.deleteTransactionInfo(txInfoPo);
  if (result.isFailed()) {
    return result;
  }
  result=localUtxoService.deleteUtxoOfTransaction(tx);
  for (int i=0; i < addresses.size(); i++) {
    balanceManager.refreshBalance(addresses.get(i));
  }
  return result;
}
Program: 35017
Project: 35017
Buggy source:
/** 
 * 根据密码加密账户(给账户设置密码) Password-encrypted account (set password for account)
 * @param password
 */
public void encrypt(String password,boolean isForce) throws NulsException {
  if (this.isEncrypted() && !isForce) {
    if (!unlock(password)) {
      throw new NulsException(AccountErrorCode.ACCOUNT_IS_ALREADY_ENCRYPTED);
    }
  }
  ECKey eckey=this.getEcKey();
  byte[] privKeyBytes=eckey.getPrivKeyBytes();
  EncryptedData encryptedPrivateKey=AESEncrypt.encrypt(privKeyBytes,EncryptedData.DEFAULT_IV,new KeyParameter(Sha256Hash.hash(password.getBytes())));
  eckey.setEncryptedPrivateKey(encryptedPrivateKey);
  ECKey result=ECKey.fromEncrypted(encryptedPrivateKey,getPubKey());
  this.setPriKey(new byte[0]);
  this.setEcKey(result);
  this.setEncryptedPriKey(encryptedPrivateKey.getEncryptedBytes());
}

Fixed version (ground truth):
/** 
 * 根据密码加密账户(给账户设置密码) Password-encrypted account (set password for account)
 * @param password
 */
public void encrypt(String password,boolean isForce) throws NulsException {
  if (this.isEncrypted() && !isForce) {
    if (!unlock(password)) {
      throw new NulsException(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
  ECKey eckey=this.getEcKey();
  byte[] privKeyBytes=eckey.getPrivKeyBytes();
  EncryptedData encryptedPrivateKey=AESEncrypt.encrypt(privKeyBytes,EncryptedData.DEFAULT_IV,new KeyParameter(Sha256Hash.hash(password.getBytes())));
  eckey.setEncryptedPrivateKey(encryptedPrivateKey);
  ECKey result=ECKey.fromEncrypted(encryptedPrivateKey,getPubKey());
  this.setPriKey(new byte[0]);
  this.setEcKey(result);
  this.setEncryptedPriKey(encryptedPrivateKey.getEncryptedBytes());
}
Program: 35018
Project: 35018
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.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");
  }
}

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.PASSWORD_IS_WRONG,"String_Node_Str");
  }
}
Program: 35019
Project: 35019
Buggy source:
@Override public Result validPassword(Account account,String password){
  if (null == account) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  if (!account.isEncrypted()) {
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
  }
  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 (null == account) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  if (!StringUtils.validPassword(password)) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  if (!account.isEncrypted()) {
    return Result.getFailed(AccountErrorCode.FAILED,"String_Node_Str");
  }
  try {
    if (!account.unlock(password)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
 else {
      return Result.getSuccess();
    }
  }
 catch (  NulsException e) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
}
Program: 35021
Project: 35021
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result unlock(@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) @QueryParam("String_Node_Str") String password,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer unlockTime){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  try {
    account.unlock(password);
    accountCacheService.putAccount(account);
    if (null == unlockTime || unlockTime > AccountConstant.ACCOUNT_MAX_UNLOCK_TIME) {
      unlockTime=AccountConstant.ACCOUNT_MAX_UNLOCK_TIME;
    }
    if (unlockTime < 0) {
      unlockTime=0;
    }
    scheduler.schedule(() -> {
      accountCacheService.removeAccount(account.getAddress());
    }
,unlockTime,TimeUnit.SECONDS);
  }
 catch (  NulsException e) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result unlock(@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) @QueryParam("String_Node_Str") String password,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer unlockTime){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  String addr=account.getAddress().toString();
  if (accountUnlockSchedulerMap.containsKey(addr)) {
    BlockingQueue<Runnable> queue=scheduler.getQueue();
    Runnable sf=(Runnable)accountUnlockSchedulerMap.get(addr);
    if (queue.contains(sf)) {
      scheduler.remove(sf);
      accountUnlockSchedulerMap.remove(addr);
    }
  }
  try {
    account.unlock(password);
    accountCacheService.putAccount(account);
    if (null == unlockTime || unlockTime > AccountConstant.ACCOUNT_MAX_UNLOCK_TIME) {
      unlockTime=AccountConstant.ACCOUNT_MAX_UNLOCK_TIME;
    }
    if (unlockTime < 0) {
      unlockTime=0;
    }
    ScheduledFuture scheduledFuture=scheduler.schedule(() -> {
      accountCacheService.removeAccount(account.getAddress());
    }
,unlockTime,TimeUnit.SECONDS);
    accountUnlockSchedulerMap.put(addr,scheduledFuture);
  }
 catch (  NulsException e) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return Result.getSuccess();
}
Program: 35022
Project: 35022
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result lock(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  accountCacheService.removeAccount(account.getAddress());
  return Result.getSuccess();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result lock(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  accountCacheService.removeAccount(account.getAddress());
  BlockingQueue<Runnable> queue=scheduler.getQueue();
  String addr=account.getAddress().toString();
  Runnable scheduledFuture=(Runnable)accountUnlockSchedulerMap.get(addr);
  if (queue.contains(scheduledFuture)) {
    scheduler.remove(scheduledFuture);
    accountUnlockSchedulerMap.remove(addr);
  }
  return Result.getSuccess();
}
Program: 35023
Project: 35023
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",response=Result.class)}) public Result removeAccount(@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);
  }
  if (StringUtils.isNotBlank(form.getPassword()) && !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return accountService.removeAccount(address,form.getPassword());
}

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",response=Result.class)}) public Result removeAccount(@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);
  }
  return accountService.removeAccount(address,form.getPassword());
}
Program: 35032
Project: 35032
Buggy source:
/** 
 * 账户是否被锁定(是否有明文私钥) Whether the account is locked (is there a cleartext private key)
 * @return true: Locked, false: not Locked
 */
public boolean isLocked(){
  return (this.getPriKey() == null) || (this.getPriKey().length == 0);
}

Fixed version (ground truth):
/** 
 * 账户是否被锁定(是否有明文私钥) 有私钥表示解锁 Whether the account is locked (is there a cleartext private key)
 * @return true: Locked, false: not Locked
 */
public boolean isLocked(){
  return (this.getPriKey() == null) || (this.getPriKey().length == 0);
}
Program: 35033
Project: 35033
Buggy source:
/** 
 * 获取账户私钥
 * @param address
 * @param password
 * @return
 */
public Result getPrivateKey(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted() && account.isLocked()) {
    try {
      if (!account.unlock(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
      byte[] priKeyBytes=account.getPriKey();
      account.lock();
      return Result.getSuccess().setData(Hex.encode(priKeyBytes));
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
 else {
    return Result.getSuccess().setData(Hex.encode(account.getPriKey()));
  }
}

Fixed version (ground truth):
/** 
 * 获取账户私钥
 * @param address
 * @param password
 * @return
 */
public Result getPrivateKey(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted() && account.isLocked()) {
    try {
      if (StringUtils.isBlank(password) || !StringUtils.validPassword(password) || !account.unlock(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
      byte[] priKeyBytes=account.getPriKey();
      account.lock();
      return Result.getSuccess().setData(Hex.encode(priKeyBytes));
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
 else {
    return Result.getSuccess().setData(Hex.encode(account.getPriKey()));
  }
}
Program: 35034
Project: 35034
Buggy source:
@Override public Result<AccountKeyStore> exportAccountToKeyStore(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  Account account=getAccountByAddress(address);
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  AccountKeyStore accountKeyStore=new AccountKeyStore();
  if (account.isEncrypted() && account.isLocked()) {
    if (!StringUtils.validPassword(password)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
    try {
      if (!account.decrypt(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
      account.encrypt(password);
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
    EncryptedData encryptedData=new EncryptedData(account.getEncryptedPriKey());
    accountKeyStore.setEncryptedPrivateKey(Hex.encode(encryptedData.getEncryptedBytes()));
  }
 else {
    accountKeyStore.setPrikey(account.getPriKey());
  }
  accountKeyStore.setAddress(account.getAddress().toString());
  accountKeyStore.setAlias(account.getAlias());
  accountKeyStore.setPubKey(account.getPubKey());
  return Result.getSuccess().setData(accountKeyStore);
}

Fixed version (ground truth):
@Override public Result<AccountKeyStore> exportAccountToKeyStore(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  Account account=getAccountByAddress(address);
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  AccountKeyStore accountKeyStore=new AccountKeyStore();
  if (account.isEncrypted() && account.isLocked()) {
    try {
      if (StringUtils.isBlank(password) || !StringUtils.validPassword(password) || !account.decrypt(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
  if (account.isEncrypted()) {
    EncryptedData encryptedData=new EncryptedData(account.getEncryptedPriKey());
    accountKeyStore.setEncryptedPrivateKey(Hex.encode(encryptedData.getEncryptedBytes()));
  }
 else {
    accountKeyStore.setPrikey(account.getPriKey());
  }
  accountKeyStore.setAddress(account.getAddress().toString());
  accountKeyStore.setAlias(account.getAlias());
  accountKeyStore.setPubKey(account.getPubKey());
  return Result.getSuccess().setData(accountKeyStore);
}
Program: 35035
Project: 35035
Buggy source:
@Override public Result<Boolean> removeAccount(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  Account account=getAccountByAddress(address);
  if (account == null) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted() && account.isLocked()) {
    if (!StringUtils.validPassword(password)) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
    try {
      if (!account.decrypt(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
  accountStorageService.removeAccount(account.getAddress());
  LOCAL_ADDRESS_LIST.remove(address);
  return Result.getSuccess();
}

Fixed version (ground truth):
@Override public Result<Boolean> removeAccount(String address,String password){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  Account account=getAccountByAddress(address);
  if (account == null) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (account.isEncrypted() && account.isLocked()) {
    try {
      if (StringUtils.isBlank(password) || !StringUtils.validPassword(password) || !account.decrypt(password)) {
        return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
      }
    }
 catch (    NulsException e) {
      return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
    }
  }
  accountStorageService.removeAccount(account.getAddress());
  LOCAL_ADDRESS_LIST.remove(address);
  return Result.getSuccess();
}
Program: 35036
Project: 35036
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=String.class)}) public Result getPrikey(@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);
  }
  if (StringUtils.isNotBlank(form.getPassword()) && !StringUtils.validPassword(form.getPassword())) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return accountBaseService.getPrivateKey(address,form.getPassword());
}

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=String.class)}) public Result getPrikey(@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);
  }
  return accountBaseService.getPrivateKey(address,form.getPassword());
}
Program: 35037
Project: 35037
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result unlock(@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) @QueryParam("String_Node_Str") String password,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer unlockTime){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  try {
    account.unlock(password);
    accountCacheService.putAccount(account);
    if (null == unlockTime || unlockTime > AccountConstant.ACCOUNT_MAX_UNLOCK_TIME) {
      unlockTime=AccountConstant.ACCOUNT_MAX_UNLOCK_TIME;
    }
    if (unlockTime < 0) {
      unlockTime=0;
    }
    scheduler=new ScheduledThreadPoolExecutor(1);
    scheduler.schedule(() -> {
      accountCacheService.removeAccount(account.getAddress());
      scheduler.shutdown();
    }
,unlockTime,TimeUnit.SECONDS);
  }
 catch (  NulsException e) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result unlock(@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) @QueryParam("String_Node_Str") String password,@ApiParam(name="String_Node_Str",value="String_Node_Str") @QueryParam("String_Node_Str") Integer unlockTime){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  try {
    account.unlock(password);
    accountCacheService.putAccount(account);
    if (null == unlockTime || unlockTime > AccountConstant.ACCOUNT_MAX_UNLOCK_TIME) {
      unlockTime=AccountConstant.ACCOUNT_MAX_UNLOCK_TIME;
    }
    if (unlockTime < 0) {
      unlockTime=0;
    }
    scheduler.schedule(() -> {
      accountCacheService.removeAccount(account.getAddress());
    }
,unlockTime,TimeUnit.SECONDS);
  }
 catch (  NulsException e) {
    return Result.getFailed(AccountErrorCode.PASSWORD_IS_WRONG);
  }
  return Result.getSuccess();
}
Program: 35038
Project: 35038
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<String> alias(@PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(form.getAlias())) {
    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(address,form.getPassword(),form.getAlias());
}

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<String> alias(@PathParam("String_Node_Str") String address,@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) AccountAliasForm form){
  if (!Address.validAddress(address)) {
    return Result.getFailed(AccountErrorCode.ADDRESS_ERROR);
  }
  if (StringUtils.isBlank(form.getAlias())) {
    return Result.getFailed(AccountErrorCode.PARAMETER_ERROR);
  }
  return aliasService.setAlias(address,form.getPassword(),form.getAlias());
}
Program: 35039
Project: 35039
Buggy source:
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result lock(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  accountCacheService.removeAccount(account.getAddress());
  if (!scheduler.isShutdown()) {
    scheduler.shutdownNow();
  }
  return Result.getSuccess();
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value="String_Node_Str",notes="String_Node_Str") public Result lock(@ApiParam(name="String_Node_Str",value="String_Node_Str",required=true) @PathParam("String_Node_Str") String address){
  Account account=accountService.getAccount(address).getData();
  if (null == account) {
    return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  accountCacheService.removeAccount(account.getAddress());
  return Result.getSuccess();
}