nus-yam/ex-repair huggingface dataset:
Program: 39333
Project: 39333
Buggy source:
public String[] outputLabels(){
  if (!preyEvolve)   return Parameters.parameters.booleanParameter("String_Node_Str") ? new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  return Parameters.parameters.booleanParameter("String_Node_Str") ? new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}

Fixed version (ground truth):
public String[] outputLabels(){
  if (!preyEvolve) {
    return Parameters.parameters.booleanParameter("String_Node_Str") ? new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  }
  return Parameters.parameters.booleanParameter("String_Node_Str") ? new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}
Program: 39334
Project: 39334
Buggy source:
/** 
 * @param preyEvolve if true prey are being evolved; if false predators are being evolved
 */
public TorusPredPreyTask(boolean preyEvolve){
  super();
  this.preyEvolve=preyEvolve;
}

Fixed version (ground truth):
/** 
 * @param preyEvolve if true prey are being evolved; if false predators arebeing evolved
 */
public TorusPredPreyTask(boolean preyEvolve){
  super();
  this.preyEvolve=preyEvolve;
}
Program: 39335
Project: 39335
Buggy source:
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  TorusPredPreyController[] predAgents=getPredAgents(individual);
  TorusPredPreyController[] preyAgents=getPreyAgents(individual);
  exec=new TorusWorldExec();
  TorusPredPreyGame game;
  if (CommonConstants.watch) {
    game=exec.runGameTimed(predAgents,preyAgents,true);
  }
 else {
    game=exec.runExperiment(predAgents,preyAgents);
  }
  double[] oneTrialFitness;
  if (preyEvolve)   oneTrialFitness=new double[]{game.getTime()};
 else   oneTrialFitness=new double[]{-game.getTime()};
  double[] otherStats=new double[0];
  return new Pair<double[],double[]>(oneTrialFitness,otherStats);
}

Fixed version (ground truth):
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  TorusPredPreyController[] predAgents=getPredAgents(individual);
  TorusPredPreyController[] preyAgents=getPreyAgents(individual);
  exec=new TorusWorldExec();
  TorusPredPreyGame game;
  if (CommonConstants.watch) {
    game=exec.runGameTimed(predAgents,preyAgents,true);
  }
 else {
    game=exec.runExperiment(predAgents,preyAgents);
  }
  double[] oneTrialFitness;
  if (preyEvolve) {
    oneTrialFitness=new double[]{game.getTime()};
  }
 else {
    oneTrialFitness=new double[]{-game.getTime()};
  }
  double[] otherStats=new double[0];
  return new Pair<double[],double[]>(oneTrialFitness,otherStats);
}
Program: 39336
Project: 39336
Buggy source:
public String[] sensorLabels(){
  if (!preyEvolve)   return NNTorusPredPreyController.sensorLabels(Parameters.parameters.integerParameter("String_Node_Str"));
  return NNTorusPredPreyController.sensorLabels(Parameters.parameters.integerParameter("String_Node_Str"));
}

Fixed version (ground truth):
public String[] sensorLabels(){
  if (!preyEvolve) {
    return NNTorusPredPreyController.sensorLabels(Parameters.parameters.integerParameter("String_Node_Str"),"String_Node_Str");
  }
 else {
    return NNTorusPredPreyController.sensorLabels(Parameters.parameters.integerParameter("String_Node_Str"),"String_Node_Str");
  }
}
Program: 39340
Project: 39340
Buggy source:
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  TorusAgent target=me.closestAgent(prey);
  double[] moveDistances=new double[actions.length];
  for (int i=0; i < actions.length; i++) {
    moveDistances[i]=target.distance(me.getPosition().add(new Tuple2D(actions[i][0],actions[i][1])));
  }
  return actions[StatisticsUtilities.argmin(moveDistances)];
}

Fixed version (ground truth):
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  TorusAgent target=me.closestAgent(prey);
  double[] moveDistances=new double[PREDATOR_ACTIONS.length];
  for (int i=0; i < PREDATOR_ACTIONS.length; i++) {
    moveDistances[i]=target.distance(me.getPosition().add(new Tuple2D(PREDATOR_ACTIONS[i][0],PREDATOR_ACTIONS[i][1])));
  }
  return PREDATOR_ACTIONS[StatisticsUtilities.argmin(moveDistances)];
}
Program: 39341
Project: 39341
Buggy source:
/** 
 * The getAction method takes in the controlled agent, the world and predators and prey as arrays. The prey moves away from all the predators in a sequence depending on how close each predator is.
 */
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] moveDistances=new double[actions.length];
  for (int j=0; j < preds.length; j++) {
    for (int i=0; i < actions.length; i++) {
      double distance=preds[j].distance(me.getPosition().add(new Tuple2D(actions[i][0],actions[i][1])));
      moveDistances[i]+=distance;
    }
  }
  return actions[StatisticsUtilities.argmax(moveDistances)];
}

Fixed version (ground truth):
/** 
 * The getAction method takes in the controlled agent, the world and predators and prey as arrays. The prey moves away from all the predators in a sequence depending on how close each predator is.
 */
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] moveDistances=new double[PREY_ACTIONS.length];
  for (int j=0; j < preds.length; j++) {
    for (int i=0; i < PREY_ACTIONS.length; i++) {
      double distance=preds[j].distance(me.getPosition().add(new Tuple2D(PREY_ACTIONS[i][0],PREY_ACTIONS[i][1])));
      moveDistances[i]+=distance;
    }
  }
  return PREY_ACTIONS[StatisticsUtilities.argmax(moveDistances)];
}
Program: 39343
Project: 39343
Buggy source:
/** 
 * Uses the genotype to finish the set up of the brain/controller. It accesses the network to do this.
 * @param genotype
 */
public NNTorusPredPreyAgent(Genotype<T> genotype){
  super(genotype);
  Network net=(Network)this.getGenotype().getPhenotype();
  controller=new NNTorusPredPreyController(net);
}

Fixed version (ground truth):
/** 
 * Uses the genotype to finish the set up of the brain/controller. It accesses the network to do this.
 * @param genotype
 */
public NNTorusPredPreyAgent(Genotype<T> genotype,boolean isPredator){
  super(genotype);
  Network net=(Network)this.getGenotype().getPhenotype();
  controller=new NNTorusPredPreyController(net,isPredator);
}
Program: 39344
Project: 39344
Buggy source:
/** 
 * Takes in all agents (me, world, preds, prey) to allow agent me to return best possible actions
 * @param all agents (me, world, preds, prey)
 * @return actions array
 */
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] inputs=inputs(me,world,preds,prey);
  double[] outputs=nn.process(inputs);
  return actions[StatisticsUtilities.argmax(outputs)];
}

Fixed version (ground truth):
/** 
 * Takes in all agents (me, world, preds, prey) to allow agent me to return best possible actions
 * @param all agents (me, world, preds, prey)
 * @return actions array
 */
@Override public int[] getAction(TorusAgent me,TorusWorld world,TorusAgent[] preds,TorusAgent[] prey){
  double[] inputs=inputs(me,world,preds,prey);
  double[] outputs=nn.process(inputs);
  return isPredator ? PREDATOR_ACTIONS[StatisticsUtilities.argmax(outputs)] : PREY_ACTIONS[StatisticsUtilities.argmax(outputs)];
}
Program: 39345
Project: 39345
Buggy source:
/** 
 * Takes in network and connects it to the controller
 * @param nn
 */
public NNTorusPredPreyController(Network nn){
  this.nn=nn;
}

Fixed version (ground truth):
/** 
 * Takes in network and connects it to the controller
 * @param nn
 * @param isPredator
 */
public NNTorusPredPreyController(Network nn,boolean isPredator){
  this.nn=nn;
  this.isPredator=isPredator;
}
Program: 39346
Project: 39346
Buggy source:
/** 
 * Accesses the outputs that will be used by an agent, i.e. the movement directions.
 */
public String[] outputLabels(){
  return new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}

Fixed version (ground truth):
/** 
 * Accesses the outputs that will be used by an agent, i.e. the movement directions.
 */
public String[] outputLabels(){
  return Parameters.parameters.booleanParameter("String_Node_Str") ? new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
}
Program: 39347
Project: 39347
Buggy source:
/** 
 * Used to evaluated the fitness score of the brain agent genotype. Additionally, initializes the game to do this.
 * @param genotype and num (evaluation being performed)
 * @return pair of fitness and states from evaluation
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  NNTorusPredPreyAgent<T> agent=new NNTorusPredPreyAgent<T>(individual);
  brain=agent.getController();
  exec=new TorusWorldExec();
  TorusPredPreyGame game;
  if (CommonConstants.watch) {
    game=exec.runGameTimed(staticAgents,new TorusPredPreyController[]{brain},true);
  }
 else {
    game=exec.runExperiment(staticAgents,new TorusPredPreyController[]{brain});
  }
  double[] oneTrialFitness=new double[]{game.getTime()};
  double[] otherStats=new double[0];
  return new Pair<double[],double[]>(oneTrialFitness,otherStats);
}

Fixed version (ground truth):
/** 
 * Used to evaluated the fitness score of the brain agent genotype. Additionally, initializes the game to do this. one prey is evolved while predators are static
 * @param genotype and num (evaluation being performed)
 * @return pair of fitness and states from evaluation
 */
@Override public Pair<double[],double[]> oneEval(Genotype<T> individual,int num){
  NNTorusPredPreyAgent<T> agent=new NNTorusPredPreyAgent<T>(individual,false);
  brain=agent.getController();
  exec=new TorusWorldExec();
  TorusPredPreyGame game;
  if (CommonConstants.watch) {
    game=exec.runGameTimed(staticAgents,new TorusPredPreyController[]{brain},true);
  }
 else {
    game=exec.runExperiment(staticAgents,new TorusPredPreyController[]{brain});
  }
  double[] oneTrialFitness=new double[]{game.getTime()};
  double[] otherStats=new double[0];
  return new Pair<double[],double[]>(oneTrialFitness,otherStats);
}
Program: 39348
Project: 39348
Buggy source:
public static void main(String args[]){
}

Fixed version (ground truth):
public static void main(String args[]){
  System.out.println("String_Node_Str");
}
Program: 39349
Project: 39349
Buggy source:
public static BigInteger factorial(int n){
  BigInteger p=new BigInteger("String_Node_Str");
  if (n == 1 || n == 0)   return BigInteger.valueOf(1);
  p=BigInteger.valueOf(n).multiply(fact(n - 1));
  return p;
}

Fixed version (ground truth):
public static BigInteger factorial(int n){
  BigInteger p=new BigInteger("String_Node_Str");
  if (n == 1 || n == 0)   return BigInteger.valueOf(1);
  p=BigInteger.valueOf(n).multiply(factorial(n - 1));
  return p;
}
Program: 39350
Project: 39350
Buggy source:
public static void main(String[] args){
  Scanner s=new Scanner(System.out);
  System.out.println("String_Node_Str");
  String input=s.next();
  String[] answer=permutationOfString(input);
  for (int i=0; i < answer.length; i++) {
    System.out.println(answer[i]);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Scanner s=new Scanner(System.in);
  System.out.println("String_Node_Str");
  String input=s.next();
  String[] answer=permutationOfString(input);
  for (int i=0; i < answer.length; i++) {
    System.out.println(answer[i]);
  }
}
Program: 39351
Project: 39351
Buggy source:
public static void main(String[] args){
  Scanner s=new Scanner(System.out);
  System.out.println("String_Node_Str");
  String input=s.next();
  String[] answer=subsequence(input);
  for (int i=0; i < answer.length; i++) {
    System.out.println(answer[i]);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Scanner s=new Scanner(System.in);
  System.out.println("String_Node_Str");
  String input=s.next();
  String[] answer=subsequence(input);
  for (int i=0; i < answer.length; i++) {
    System.out.println(answer[i]);
  }
}
Program: 39352
Project: 39352
Buggy source:
private void addNewRecord(final View view){
  view.setClickable(false);
  String recordName=mEtRecordName.getText().toString();
  if (TextUtils.isEmpty(recordName)) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.please_enter_record_type_name));
    return;
  }
  if (recordName.length() > 4) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.record_type_name_too_long));
    return;
  }
  recordName=recordName.trim();
  RecordType recordType=new RecordType();
  recordType.setRecordType(mRecordType);
  recordType.setRecordTypeID(System.currentTimeMillis());
  recordType.setRecordIcon(mCurrentIcon);
  recordType.setRecordDesc(recordName);
  recordType.setIsDel(false);
  recordManager.createNewRecordType(recordType,new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      if (msg.what == Constant.MSG_ERROR) {
        view.setClickable(true);
        SnackBarUtil.showSnackInfo(view,CreateNewRecordTypeActivity.this,getString(R.string.please_not_enter_same_record_type_name));
      }
 else {
        setResult(RESULT_OK);
        finish();
      }
    }
  }
);
}

Fixed version (ground truth):
private void addNewRecord(final View view){
  view.setClickable(false);
  String recordName=mEtRecordName.getText().toString();
  if (TextUtils.isEmpty(recordName)) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.please_enter_record_type_name));
    view.setClickable(true);
    return;
  }
  if (recordName.length() > 4) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.record_type_name_too_long));
    view.setClickable(true);
    return;
  }
  recordName=recordName.trim();
  RecordType recordType=new RecordType();
  recordType.setRecordType(mRecordType);
  recordType.setRecordTypeID(System.currentTimeMillis());
  recordType.setRecordIcon(mCurrentIcon);
  recordType.setRecordDesc(recordName);
  recordType.setIsDel(false);
  recordManager.createNewRecordType(recordType,new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      if (msg.what == Constant.MSG_ERROR) {
        view.setClickable(true);
        SnackBarUtil.showSnackInfo(view,CreateNewRecordTypeActivity.this,getString(R.string.please_not_enter_same_record_type_name));
      }
 else {
        setResult(RESULT_OK);
        finish();
      }
    }
  }
);
}
Program: 39354
Project: 39354
Buggy source:
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
  String tmp=s.toString();
  if (tmp.contains("String_Node_Str")) {
    String[] strs=tmp.split("String_Node_Str");
    if (strs.length > 1 && strs[1].length() > 2) {
      eEtInMoney.setText(tmp.substring(0,tmp.length() - 1));
      eEtInMoney.setSelection(tmp.length() - 1);
    }
  }
  if (!TextUtils.isEmpty(tmp)) {
    double money=Double.parseDouble(tmp);
    if (money > Double.parseDouble(mTvOutAccountLeftMoney.getText().toString())) {
      KeyBoardUtils.closeKeybord(eEtInMoney,AccountsTransferActivity.this);
      SnackBarUtil.showSnackInfo(floatingActionButton,AccountsTransferActivity.this,getResources().getString(R.string.not_have_enough_money));
      eEtInMoney.setText(mTvOutAccountLeftMoney.getText());
    }
  }
}

Fixed version (ground truth):
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
  String tmp=s.toString();
  if (tmp.contains("String_Node_Str")) {
    String[] strs=tmp.split("String_Node_Str");
    if (strs.length > 1 && strs[1].length() > 2) {
      eEtOutMoney.setText(tmp.substring(0,tmp.length() - 1));
      eEtOutMoney.setSelection(tmp.length() - 1);
    }
  }
  if (!TextUtils.isEmpty(tmp)) {
    double money=0.00;
    try {
      money=Double.parseDouble(tmp);
    }
 catch (    Exception e) {
    }
    if (money > Double.parseDouble(mTvOutAccountLeftMoney.getText().toString())) {
      KeyBoardUtils.closeKeybord(eEtOutMoney,AccountsTransferActivity.this);
      SnackBarUtil.showSnackInfo(floatingActionButton,AccountsTransferActivity.this,getResources().getString(R.string.not_have_enough_money));
      eEtOutMoney.setText(mTvOutAccountLeftMoney.getText());
    }
  }
}
Program: 39356
Project: 39356
Buggy source:
@Override public void afterTextChanged(Editable s){
  if (eEtOutMoney.isFocused())   return;
  eEtOutMoney.setText(eEtInMoney.getText());
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable s){
  if (!eEtOutMoney.isFocused())   return;
  eEtInMoney.setText(eEtOutMoney.getText());
}
Program: 39359
Project: 39359
Buggy source:
public RecordType getRecordTypeById(Context context,long id){
  RecordTypeDao recordTypeDao=getDaoSession(context).getRecordTypeDao();
  RecordType recordType=getSingleData(recordTypeDao.queryBuilder().where(RecordTypeDao.Properties.RecordTypeID.eq(id)).build().list());
  if (recordType == null)   recordType=new RecordType(null,0L,"String_Node_Str",Constant.RecordType.ZUICHU.getId(),true,Constant.RecordTypeConstant.ICON_TYPE_YI_BAN,0,Constant.Sex.ALL.getId(),Constant.Occupation.ALL.getId(),true,false,"String_Node_Str");
  return recordType;
}

Fixed version (ground truth):
public RecordType getRecordTypeById(Context context,long id){
  RecordTypeDao recordTypeDao=getDaoSession(context).getRecordTypeDao();
  RecordType recordType=getSingleData(recordTypeDao.queryBuilder().where(RecordTypeDao.Properties.RecordTypeID.eq(id)).build().list());
  if (recordType == null)   recordType=new RecordType(0L,0L,"String_Node_Str",Constant.RecordType.ZUICHU.getId(),true,Constant.RecordTypeConstant.ICON_TYPE_YI_BAN,0,Constant.Sex.ALL.getId(),Constant.Occupation.ALL.getId(),true,false,"String_Node_Str");
  return recordType;
}
Program: 39361
Project: 39361
Buggy source:
private void setCurRecordType(int index,RecordType recordType){
  if (recordType == null) {
    mCurRecordType=recordTypes.get(index);
  }
 else {
    mCurRecordType=recordType;
  }
  Account account=accountManager.getSuitAccount(mCurRecordType.getRecordTypeID());
  newRecord.setAccountID(account.getAccountID());
  mAccountTv.setText(account.getAccountName());
  if (recordTypes != null) {
    tvTypeTitle.setText(mCurRecordType.getRecordDesc());
    typeIcon.setImageResource(IconTypeUtil.getTypeIcon(mCurRecordType.getRecordIcon()));
  }
}

Fixed version (ground truth):
private void setCurRecordType(int index,RecordType recordType){
  if (recordType == null) {
    mCurRecordType=recordTypes.get(index);
  }
 else {
    mCurRecordType=recordType;
  }
  if (recordType == null) {
    Account account=accountManager.getSuitAccount(mCurRecordType.getRecordTypeID());
    newRecord.setAccountID(account.getAccountID());
    mAccountTv.setText(account.getAccountName());
  }
  if (recordTypes != null) {
    tvTypeTitle.setText(mCurRecordType.getRecordDesc());
    typeIcon.setImageResource(IconTypeUtil.getTypeIcon(mCurRecordType.getRecordIcon()));
  }
}
Program: 39365
Project: 39365
Buggy source:
/** 
 * 创建新新记录类型
 */
public void createNewRecordType(final RecordType recordType,final Handler handler){
  recordType.setIndex(recordTypeDao.getMaxIndexByRecordType(_context,recordType.getRecordType()));
  recordType.setSexProp(Constant.Sex.ALL.getId());
  recordType.setOccupation(Constant.Occupation.ALL.getId());
  recordType.setSysType(false);
  if (canSync()) {
    final AVRecordType avRecordType=DataConvertUtil.convertRecordType2AVRecordType(recordType);
    avRecordType.setRecordTypeIsDel(false);
    avRecordType.saveInBackground(new SaveCallback(){
      @Override public void done(      AVException e){
        getAvEx(e);
        if (e == null) {
          recordType.setSyncStatus(true);
        }
 else {
          recordType.setSyncStatus(false);
        }
        recordTypeDao.createNewRecordType(_context,recordType);
        updateRecordTypeIndex(handler);
      }
    }
);
  }
 else {
    recordType.setSyncStatus(false);
    recordTypeDao.createNewRecordType(_context,recordType);
    handler.sendEmptyMessage(Constant.MSG_SUCCESS);
  }
}

Fixed version (ground truth):
/** 
 * 创建新新记录类型
 */
public void createNewRecordType(final RecordType recordType,final Handler handler){
  if (recordTypeDao.haveCreate(_context,recordType.getRecordDesc(),recordType.getRecordType())) {
    handler.sendEmptyMessage(Constant.MSG_ERROR);
    return;
  }
  recordType.setIndex(recordTypeDao.getMaxIndexByRecordType(_context,recordType.getRecordType()));
  recordType.setSexProp(Constant.Sex.ALL.getId());
  recordType.setOccupation(Constant.Occupation.ALL.getId());
  recordType.setSysType(false);
  if (canSync()) {
    final AVRecordType avRecordType=DataConvertUtil.convertRecordType2AVRecordType(recordType);
    avRecordType.setRecordTypeIsDel(false);
    avRecordType.saveInBackground(new SaveCallback(){
      @Override public void done(      AVException e){
        getAvEx(e);
        if (e == null) {
          recordType.setSyncStatus(true);
        }
 else {
          recordType.setSyncStatus(false);
        }
        recordTypeDao.createNewRecordType(_context,recordType);
        updateRecordTypeIndex(handler);
      }
    }
);
  }
 else {
    recordType.setSyncStatus(false);
    recordTypeDao.createNewRecordType(_context,recordType);
    handler.sendEmptyMessage(Constant.MSG_SUCCESS);
  }
}
Program: 39366
Project: 39366
Buggy source:
private void addNewRecord(View view){
  String recordName=mEtRecordName.getText().toString();
  if (TextUtils.isEmpty(recordName)) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.please_enter_record_type_name));
    return;
  }
  RecordType recordType=new RecordType();
  recordType.setRecordType(mRecordType);
  recordType.setRecordTypeID(System.currentTimeMillis());
  recordType.setRecordIcon(mCurrentIcon);
  recordType.setRecordDesc(recordName);
  recordType.setIsDel(false);
  recordManager.createNewRecordType(recordType,new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      setResult(RESULT_OK);
      finish();
    }
  }
);
}

Fixed version (ground truth):
private void addNewRecord(final View view){
  String recordName=mEtRecordName.getText().toString();
  if (TextUtils.isEmpty(recordName)) {
    SnackBarUtil.showSnackInfo(view,this,getString(R.string.please_enter_record_type_name));
    return;
  }
  recordName=recordName.trim();
  RecordType recordType=new RecordType();
  recordType.setRecordType(mRecordType);
  recordType.setRecordTypeID(System.currentTimeMillis());
  recordType.setRecordIcon(mCurrentIcon);
  recordType.setRecordDesc(recordName);
  recordType.setIsDel(false);
  recordManager.createNewRecordType(recordType,new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      if (msg.what == Constant.MSG_ERROR) {
        SnackBarUtil.showSnackInfo(view,CreateNewRecordTypeActivity.this,getString(R.string.please_not_enter_same_record_type_name));
      }
 else {
        setResult(RESULT_OK);
        finish();
      }
    }
  }
);
}
Program: 39367
Project: 39367
Buggy source:
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  setResult(RESULT_OK);
  finish();
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  if (msg.what == Constant.MSG_ERROR) {
    SnackBarUtil.showSnackInfo(view,CreateNewRecordTypeActivity.this,getString(R.string.please_not_enter_same_record_type_name));
  }
 else {
    setResult(RESULT_OK);
    finish();
  }
}
Program: 39368
Project: 39368
Buggy source:
@Override protected void initWidget(){
  findViewById(R.id.background).setBackgroundColor(getColor(this,getMainTheme().getMainColorID()));
}

Fixed version (ground truth):
@Override protected void initWidget(){
  ((TextView)findViewById(R.id.tv_version)).setText("String_Node_Str" + AppUtil.getAppInfo(this).versionName);
  findViewById(R.id.background).setBackgroundColor(getColor(this,getMainTheme().getMainColorID()));
}
Program: 39369
Project: 39369
Buggy source:
private void refreshLineChart(){
  final LineData data=new LineData(xLineVals1);
  mRecordManager.getYearRecordDetail(2016,new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      List<LineChartDo> list=(List<LineChartDo>)msg.obj;
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_red),0));
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_green),1));
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_blue),2));
      mLineChart.setData(data);
      mLineChart.animateXY(500,500);
    }
  }
);
}

Fixed version (ground truth):
private void refreshLineChart(){
  final LineData data=new LineData(xLineVals1);
  Calendar calendar=Calendar.getInstance();
  mRecordManager.getYearRecordDetail(calendar.get(Calendar.YEAR),new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      List<LineChartDo> list=(List<LineChartDo>)msg.obj;
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_red),0));
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_green),1));
      data.addDataSet(getLineDateSet(list,"String_Node_Str",getResources().getColor(R.color.accent_blue),2));
      mLineChart.setData(data);
      mLineChart.animateXY(500,500);
    }
  }
);
}
Program: 39370
Project: 39370
Buggy source:
@Override public void onClick(View v){
  if (optDO.getId() == 4) {
    checkForUpdate();
  }
 else   if (optDO.getId() == 6) {
    context.finish();
  }
 else {
    if (MyAVUser.getCurrentUser() == null && (optDO.getAct() == MonthReportActivity.class || optDO.getAct() == UserLinkActivity.class)) {
      SnackBarUtil.showSnackInfo(v,context,"String_Node_Str");
      return;
    }
    if (!NetworkUtil.checkNetwork(context)) {
      SnackBarUtil.showSnackInfo(v,context,"String_Node_Str");
      return;
    }
    Intent intent=new Intent(context,optDO.getAct());
    if (optDO.getAct() == EditThemeActivity.class) {
      ((MainActivity)context).startActivityForResult(intent,MainActivity.REQUEST_EDIT_THEME);
    }
 else     context.startActivity(intent);
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  if (optDO.getId() == 4) {
    checkForUpdate();
  }
 else   if (optDO.getId() == 6) {
    context.finish();
  }
 else {
    if (MyAVUser.getCurrentUser() == null && (optDO.getAct() == MonthReportActivity.class || optDO.getAct() == UserLinkActivity.class)) {
      SnackBarUtil.showSnackInfo(v,context,"String_Node_Str");
      return;
    }
    if (!NetworkUtil.checkNetwork(context) && optDO.getAct() == UserLinkActivity.class) {
      SnackBarUtil.showSnackInfo(v,context,"String_Node_Str");
      return;
    }
    Intent intent=new Intent(context,optDO.getAct());
    if (optDO.getAct() == EditThemeActivity.class) {
      ((MainActivity)context).startActivityForResult(intent,MainActivity.REQUEST_EDIT_THEME);
    }
 else     context.startActivity(intent);
  }
}
Program: 39372
Project: 39372
Buggy source:
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
  String tmp=s.toString();
  if (tmp.contains("String_Node_Str")) {
    String[] strs=tmp.split("String_Node_Str");
    if (strs.length > 1 && strs[1].length() > 2) {
      eEtInMoney.setText(tmp.substring(0,tmp.length() - 1));
      eEtInMoney.setSelection(tmp.length() - 1);
    }
  }
  if (!TextUtils.isEmpty(tmp)) {
    double money=Double.parseDouble(tmp);
    if (money > Double.parseDouble(mTvOutAccountLeftMoney.getText().toString())) {
      KeyBoardUtils.closeKeybord(eEtInMoney,AccountsTransferActivity.this);
      SnackBarUtil.showSnackInfo(floatingActionButton,AccountsTransferActivity.this,"String_Node_Str");
      eEtInMoney.setText(mTvOutAccountLeftMoney.getText());
    }
  }
}

Fixed version (ground truth):
@Override public void onTextChanged(CharSequence s,int start,int before,int count){
  String tmp=s.toString();
  if (tmp.contains("String_Node_Str")) {
    String[] strs=tmp.split("String_Node_Str");
    if (strs.length > 1 && strs[1].length() > 2) {
      eEtInMoney.setText(tmp.substring(0,tmp.length() - 1));
      eEtInMoney.setSelection(tmp.length() - 1);
    }
  }
  if (!TextUtils.isEmpty(tmp)) {
    double money=Double.parseDouble(tmp);
    if (money > Double.parseDouble(mTvOutAccountLeftMoney.getText().toString())) {
      KeyBoardUtils.closeKeybord(eEtInMoney,AccountsTransferActivity.this);
      SnackBarUtil.showSnackInfo(floatingActionButton,AccountsTransferActivity.this,getResources().getString(R.string.not_have_enough_money));
      eEtInMoney.setText(mTvOutAccountLeftMoney.getText());
    }
  }
}
Program: 39373
Project: 39373
Buggy source:
@Override public void onClick(View v){
  editOut=false;
}

Fixed version (ground truth):
@Override public void onClick(View v){
  KeyBoardUtils.closeKeybord(eEtOutMoney,AccountsTransferActivity.this);
  KeyBoardUtils.closeKeybord(eEtInMoney,AccountsTransferActivity.this);
  selectItem=1;
  Intent intent=new Intent(AccountsTransferActivity.this,SelectAccountActivity.class);
  if (inAccountID > 0)   intent.putExtra(IntentConstant.ACCOUNT_ID,inAccountID);
  startActivityForResult(intent,0);
}
Program: 39374
Project: 39374
Buggy source:
private void submit(){
  if (inAccountID == 0) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,"String_Node_Str");
    return;
  }
  if (TextUtils.isEmpty(eEtInMoney.getText())) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,"String_Node_Str");
    return;
  }
  if (Double.parseDouble(eEtInMoney.getText().toString()) == 0) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,"String_Node_Str");
    return;
  }
  circleProgressBar.setVisibility(View.VISIBLE);
  circleProgressBar.setColorSchemeResources(android.R.color.holo_blue_light,android.R.color.holo_red_light,android.R.color.holo_orange_light);
  recordManager.moneyTransFer(outAccountID,inAccountID,TextUtil.gwtFormatNum(Double.parseDouble(eEtInMoney.getText().toString())),new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      setResult(RESULT_OK);
      finish();
    }
  }
);
}

Fixed version (ground truth):
private void submit(){
  if (inAccountID == 0) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,getResources().getString(R.string.select_in_account));
    return;
  }
  if (TextUtils.isEmpty(eEtInMoney.getText())) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,getResources().getString(R.string.enter_account_trans_money));
    return;
  }
  if (Double.parseDouble(eEtInMoney.getText().toString()) == 0) {
    SnackBarUtil.showSnackInfo(floatingActionButton,this,getResources().getString(R.string.enter_account_trans_money));
    return;
  }
  circleProgressBar.setVisibility(View.VISIBLE);
  circleProgressBar.setColorSchemeResources(android.R.color.holo_blue_light,android.R.color.holo_red_light,android.R.color.holo_orange_light);
  recordManager.moneyTransFer(outAccountID,inAccountID,TextUtil.gwtFormatNum(Double.parseDouble(eEtInMoney.getText().toString())),new Handler(){
    @Override public void handleMessage(    Message msg){
      super.handleMessage(msg);
      setResult(RESULT_OK);
      finish();
    }
  }
);
}
Program: 39376
Project: 39376
Buggy source:
@Override public void afterTextChanged(Editable s){
  if (editOut)   return;
  eEtOutMoney.setText(eEtInMoney.getText());
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable s){
  if (eEtOutMoney.isFocused())   return;
  eEtOutMoney.setText(eEtInMoney.getText());
}
Program: 39380
Project: 39380
Buggy source:
@Override public void onClick(View v){
  lastSelOpt=-1;
  resetOptBt();
}

Fixed version (ground truth):
@Override public void onClick(View v){
  resetOptStatus();
}
Program: 39382
Project: 39382
Buggy source:
@Override public void onClick(View v){
  Intent intent=new Intent(getActivity(),CreateOrEditRecordActivity.class);
  getActivity().startActivityForResult(intent,MainActivity.REQUEST_RECORD);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  mRecordAdapter.resetOptStatus();
  Intent intent=new Intent(getActivity(),CreateOrEditRecordActivity.class);
  getActivity().startActivityForResult(intent,MainActivity.REQUEST_RECORD);
}
Program: 39384
Project: 39384
Buggy source:
@Override protected void onResume(){
  if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
  }
  super.onResume();
  MobclickAgent.onResume(this);
  mainColor=this.getResources().getColor(ThemeUtil.getTheme(this).getMainColorID());
  mainDarkColor=this.getResources().getColor(ThemeUtil.getTheme(this).getMainDarkColorID());
  textColor=this.getResources().getColor(ThemeUtil.getTheme(this).getTextColorID());
  if (getSupportActionBar() != null) {
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(mainColor));
    StatusBarCompat.compat(this,mainDarkColor);
  }
  if (headView != null)   headView.setBackgroundColor(mainColor);
}

Fixed version (ground truth):
@Override protected void onResume(){
  if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
  }
  super.onResume();
  MobclickAgent.onResume(this);
  mainColor=this.getResources().getColor(ThemeUtil.getTheme(this).getMainColorID());
  mainDarkColor=this.getResources().getColor(ThemeUtil.getTheme(this).getMainDarkColorID());
  textColor=this.getResources().getColor(ThemeUtil.getTheme(this).getTextColorID());
  if (getSupportActionBar() != null) {
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(mainColor));
    if ((boolean)SPUtils.get(this,true,getResources().getString(R.string.immersive_status_bar),false))     StatusBarCompat.compat(this,mainColor);
 else     StatusBarCompat.compat(this,mainDarkColor);
  }
  if (headView != null)   headView.setBackgroundColor(mainColor);
}
Program: 39385
Project: 39385
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  AlarmUtil.createAlarm(this);
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  if ((boolean)SPUtils.get(this,true,Constant.SP_ALARM_EVERY_DAY,false))   AlarmUtil.createAlarm(this);
}
Program: 39386
Project: 39386
Buggy source:
@Override protected void onResume(){
  super.onResume();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mSubmitButton.setBackgroundTintList(getResources().getColorStateList(getMainTheme().getMainColorID()));
}
Program: 39387
Project: 39387
Buggy source:
@Override protected void initWidget(){
  mEtRecordName=(EditText)findViewById(R.id.record_name);
  mIvRecordIcon=(ImageView)findViewById(R.id.record_icon);
  mAddFab=(FloatingActionButton)findViewById(R.id.fab);
  mAddFab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      addNewRecord(view);
    }
  }
);
  mIonsGV=(GridView)findViewById(R.id.record_icon_gv);
  mIconsList=new ArrayList<>();
  for (int i=0; i < Constant.RecordTypeConstant.ICON_TYPE_COUNT; i++) {
    mIconsList.add(i);
  }
  mCurrentIcon=0;
  mIvRecordIcon.setImageResource(getTypeIconId(mCurrentIcon));
  mIonsGV.setAdapter(new RecordTypeIconAdapter(this,mIconsList));
  mIonsGV.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mCurrentIcon=mIconsList.get(position);
      mIvRecordIcon.setImageResource(getTypeIconId(mCurrentIcon));
    }
  }
);
}

Fixed version (ground truth):
@Override protected void initWidget(){
  mEtRecordName=(EditText)findViewById(R.id.record_name);
  mIvRecordIcon=(ImageView)findViewById(R.id.record_icon);
  mAddFab=(FloatingActionButton)findViewById(R.id.fab);
  mAddFab.setBackgroundTintList(getResources().getColorStateList(getMainTheme().getMainColorID()));
  mAddFab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      addNewRecord(view);
    }
  }
);
  mIonsGV=(GridView)findViewById(R.id.record_icon_gv);
  mIconsList=new ArrayList<>();
  for (int i=0; i < Constant.RecordTypeConstant.ICON_TYPE_COUNT; i++) {
    mIconsList.add(i);
  }
  mCurrentIcon=0;
  mIvRecordIcon.setImageResource(getTypeIconId(mCurrentIcon));
  mIonsGV.setAdapter(new RecordTypeIconAdapter(this,mIconsList));
  mIonsGV.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mCurrentIcon=mIconsList.get(position);
      mIvRecordIcon.setImageResource(getTypeIconId(mCurrentIcon));
    }
  }
);
}
Program: 39388
Project: 39388
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  mGestureLockCheck=(CheckBoxPreference)findPreference(GESTURE_LOCK);
  mRemindCheck=(CheckBoxPreference)findPreference(REMIND_SETTING);
  mRemindCheck.setOnPreferenceChangeListener(this);
  mGestureLockCheck.setOnPreferenceChangeListener(this);
  long alarmTime=SPUtils.gets(context,Constant.SP_ALARM_TIME,0l);
  if (alarmTime > 0) {
    Date date=new Date(alarmTime);
    mRemindCheck.setSummaryOn("String_Node_Str" + format.format(date) + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  mGestureLockCheck=(CheckBoxPreference)findPreference(GESTURE_LOCK);
  mRemindCheck=(CheckBoxPreference)findPreference(REMIND_SETTING);
  mImmersiveCheck=(CheckBoxPreference)findPreference(IMMERSIVE_STATUS_BAR);
  mCommonCateGory=(MyPreferenceCategory)findPreference("String_Node_Str");
  mRemindCheck.setOnPreferenceChangeListener(this);
  mGestureLockCheck.setOnPreferenceChangeListener(this);
  if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
    mCommonCateGory.removePreference(mImmersiveCheck);
  }
 else {
    mImmersiveCheck.setOnPreferenceChangeListener(this);
  }
  long alarmTime=SPUtils.gets(context,Constant.SP_ALARM_TIME,0l);
  if (alarmTime > 0) {
    Date date=new Date(alarmTime);
    mRemindCheck.setSummaryOn("String_Node_Str" + format.format(date) + "String_Node_Str");
  }
}
Program: 39391
Project: 39391
Buggy source:
public static void createAlarm(Context context){
  long alarmTime=SPUtils.gets(context,Constant.SP_ALARM_TIME,0l);
  Calendar calendarOld=Calendar.getInstance();
  calendarOld.setTimeInMillis(alarmTime);
  long curTime=System.currentTimeMillis();
  Intent intent=new Intent(context,AlarmReceiver.class);
  PendingIntent sender=PendingIntent.getBroadcast(context,0,intent,0);
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeInMillis(curTime);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,0);
  calendar.set(Calendar.HOUR_OF_DAY,calendarOld.get(Calendar.HOUR_OF_DAY));
  calendar.set(Calendar.MINUTE,calendarOld.get(Calendar.MINUTE));
  if (calendar.getTimeInMillis() < curTime) {
    calendar.add(Calendar.DATE,1);
  }
  DateFormat format=new SimpleDateFormat("String_Node_Str");
  LogUtils.d("String_Node_Str","String_Node_Str" + format.format(calendar.getTime()));
  AlarmManager manager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  manager.cancel(sender);
  manager.set(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),sender);
}

Fixed version (ground truth):
public static void createAlarm(Context context){
  createAlarmOrCancel(context,true);
}
Program: 39395
Project: 39395
Buggy source:
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  if (msg.what == Constant.MSG_SUCCESS) {
    User user=(User)msg.obj;
    Glide.with(GestureLockActivity.this.getApplicationContext()).load(user.getHeadImage()).placeholder(R.mipmap.suda).into(mHeadImg);
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  if (msg.what == Constant.MSG_SUCCESS) {
    User user=(User)msg.obj;
    Glide.with(GestureLockActivity.this.getApplicationContext()).load(user.getHeadImage()).error(R.mipmap.suda).into(mHeadImg);
  }
}
Program: 39396
Project: 39396
Buggy source:
private void initRecordData(){
  recordDetailDOs.clear();
  MyAVUser myAVUser=new MyAVUser();
  myAVUser.setObjectId(otherUser.getUserId());
  AVQuery<AVRecord> query=AVObject.getQuery(AVRecord.class);
  query.whereEqualTo(AVRecord.USER,myAVUser);
  query.whereEqualTo(AVRecord.RECORD_TYPE,-1);
  query.whereEqualTo(AVRecord.RECORD_IS_DEL,false);
  query.orderByDescending(AVRecord.RECORD_ID);
  query.findInBackground(new FindCallback<AVRecord>(){
    @Override public void done(    List<AVRecord> list,    AVException e){
      if (e == null) {
        for (        AVRecord avRecord : list) {
          RecordDetailDO recordDetailDO=new RecordDetailDO();
          recordDetailDO.setRecordID(-100);
          recordDetailDO.setIconId(avRecord.getIconID());
          recordDetailDO.setRecordDate(avRecord.getRecordDate());
          recordDetailDO.setRecordMoney(avRecord.getRecordMoney());
          recordDetailDO.setRemark(avRecord.getRemark());
          recordDetailDO.setIconId(avRecord.getIconID());
          recordDetailDO.setRecordDesc(avRecord.getRecordName());
          if (avRecord.getRecordTypeId() < 1000) {
            RecordType recordType=recordTypeLocalDao.getRecordTypeById(UserLinkActivity.this,avRecord.getRecordTypeId());
            recordDetailDO.setIconId(recordType.getRecordIcon());
            recordDetailDO.setRecordDesc(recordType.getRecordDesc());
          }
          recordDetailDOs.add(recordDetailDO);
        }
        accountRecordAdapter.notifyDataSetChanged();
      }
    }
  }
);
}

Fixed version (ground truth):
private void initRecordData(){
  recordDetailDOs.clear();
  MyAVUser myAVUser=new MyAVUser();
  myAVUser.setObjectId(otherUser.getUserId());
  AVQuery<AVRecord> query=AVObject.getQuery(AVRecord.class);
  query.whereEqualTo(AVRecord.USER,myAVUser);
  query.whereEqualTo(AVRecord.RECORD_TYPE,-1);
  query.whereEqualTo(AVRecord.RECORD_IS_DEL,false);
  query.orderByDescending(AVRecord.RECORD_DATE);
  query.addDescendingOrder(AVRecord.RECORD_ID);
  query.findInBackground(new FindCallback<AVRecord>(){
    @Override public void done(    List<AVRecord> list,    AVException e){
      if (e == null) {
        for (        AVRecord avRecord : list) {
          RecordDetailDO recordDetailDO=new RecordDetailDO();
          recordDetailDO.setRecordID(-100);
          recordDetailDO.setIconId(avRecord.getIconID());
          recordDetailDO.setRecordDate(avRecord.getRecordDate());
          recordDetailDO.setRecordMoney(avRecord.getRecordMoney());
          recordDetailDO.setRemark(avRecord.getRemark());
          recordDetailDO.setIconId(avRecord.getIconID());
          recordDetailDO.setRecordDesc(avRecord.getRecordName());
          if (avRecord.getRecordTypeId() < 1000) {
            RecordType recordType=recordTypeLocalDao.getRecordTypeById(UserLinkActivity.this,avRecord.getRecordTypeId());
            recordDetailDO.setIconId(recordType.getRecordIcon());
            recordDetailDO.setRecordDesc(recordType.getRecordDesc());
          }
          recordDetailDOs.add(recordDetailDO);
        }
        accountRecordAdapter.notifyDataSetChanged();
      }
    }
  }
);
}
Program: 39398
Project: 39398
Buggy source:
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  mTypePieChart.clear();
  xPieVals1.clear();
  yPieVals1.clear();
  ArrayList<Integer> colors=new ArrayList<Integer>();
  List<ChartRecordDo> list=(List<ChartRecordDo>)msg.obj;
  allOutOrInMoney=0;
  int i=0;
  for (  ChartRecordDo chartRecordDo : list) {
    allOutOrInMoney+=Math.abs(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney()));
    yPieVals1.add(new Entry(Math.abs(new Double(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney())).floatValue()),i));
    xPieVals1.add(chartRecordDo.getRecordDesc());
    colors.add(IconTypeUtil.getTypeIconOrColor(chartRecordDo.getIconId(),false));
    i++;
  }
  PieDataSet dataSet=new PieDataSet(yPieVals1,"String_Node_Str");
  dataSet.setSliceSpace(2f);
  dataSet.setSelectionShift(4f);
  dataSet.setColors(colors);
  PieData data=new PieData(xPieVals1,dataSet);
  data.setDrawValues(false);
  mTypePieChart.setData(data);
  if (list.size() == 0) {
    mTypePieChart.setCenterText("String_Node_Str" + (pieOut ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    mTypePieChart.setCenterTextColor(Color.RED);
  }
 else {
    mTypePieChart.setCenterTextColor(mainColor);
    mTypePieChart.setCenterText((pieOut ? "String_Node_Str" : "String_Node_Str") + TextUtil.getFormatMoney(allOutOrInMoney));
  }
  mTypePieChart.animateXY(500,500);
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
  mTypePieChart.clear();
  xPieVals1.clear();
  yPieVals1.clear();
  ArrayList<Integer> colors=new ArrayList<Integer>();
  List<ChartRecordDo> list=(List<ChartRecordDo>)msg.obj;
  allOutOrInMoney=0;
  int i=0;
  double min=Double.MAX_VALUE;
  for (  ChartRecordDo chartRecordDo : list) {
    if (Math.abs(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney())) < min)     min=Math.abs(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney()));
    allOutOrInMoney+=Math.abs(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney()));
    yPieVals1.add(new Entry(Math.abs(new Double(TextUtil.gwtFormatNum(chartRecordDo.getRecordMoney())).floatValue()),i));
    xPieVals1.add(chartRecordDo.getRecordDesc());
    colors.add(IconTypeUtil.getTypeIconOrColor(chartRecordDo.getIconId(),false));
    i++;
  }
  PieDataSet dataSet=new PieDataSet(yPieVals1,"String_Node_Str");
  if (min / allOutOrInMoney > 0.001) {
    dataSet.setSliceSpace(1f);
  }
  dataSet.setSelectionShift(2f);
  dataSet.setColors(colors);
  PieData data=new PieData(xPieVals1,dataSet);
  data.setDrawValues(false);
  mTypePieChart.setData(data);
  if (list.size() == 0) {
    mTypePieChart.setCenterText("String_Node_Str" + (pieOut ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    mTypePieChart.setCenterTextColor(Color.RED);
  }
 else {
    mTypePieChart.setCenterTextColor(mainColor);
    mTypePieChart.setCenterText((pieOut ? "String_Node_Str" : "String_Node_Str") + TextUtil.getFormatMoney(allOutOrInMoney));
  }
  mTypePieChart.animateXY(500,500);
}