Program: 40487
Project: 40487
Buggy source:
public static void vali(Object target){
  ValiWapper wapper=getFieldsFromCache(target.getClass());
  if (wapper.getValiModel() == null)   return;
  Class textInputLayout=null;
  try {
    textInputLayout=Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  if (textInputLayout == null)   return;
  List<ValiModel> models=wapper.getValiModel();
  Collections.sort(models,new Comparator<ValiModel>(){
    @Override public int compare(    ValiModel o1,    ValiModel o2){
      return o1.getOrder() - o2.getOrder();
    }
  }
);
  for (  ValiModel model : models) {
    try {
      Class fieldType=model.getField().getType();
      if (textInputLayout.isAssignableFrom(fieldType)) {
        TextInputLayout targetField=(TextInputLayout)model.getField().get(target);
        String result=targetField.getEditText().getText().toString();
        if (TextUtils.isEmpty(model.getReg())) {
          if (TextUtils.isEmpty(result)) {
            targetField.setError(targetField.getContext().getString(model.getError()));
            return;
          }
 else {
            targetField.setError("String_Node_Str");
          }
        }
 else         if (!result.matches(model.getReg())) {
          targetField.setError(targetField.getContext().getString(model.getError()));
          return;
        }
 else {
          targetField.setError("String_Node_Str");
        }
      }
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  if (wapper.getMethod() != null) {
    try {
      wapper.getMethod().invoke(target);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
catch (    InvocationTargetException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static void vali(Object target){
  ValiWapper wapper=getFieldsFromCache(target.getClass());
  if (wapper.getValiModel() == null)   return;
  Class textInputLayout=null;
  try {
    textInputLayout=Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  if (textInputLayout == null)   return;
  List<ValiModel> models=wapper.getValiModel();
  Collections.sort(models,new Comparator<ValiModel>(){
    @Override public int compare(    ValiModel o1,    ValiModel o2){
      return o1.getOrder() - o2.getOrder();
    }
  }
);
  for (  ValiModel model : models) {
    try {
      Class fieldType=model.getField().getType();
      if (textInputLayout.isAssignableFrom(fieldType)) {
        Field field=model.getField();
        field.setAccessible(true);
        TextInputLayout targetField=(TextInputLayout)model.getField().get(target);
        String result=targetField.getEditText().getText().toString();
        if (TextUtils.isEmpty(model.getReg())) {
          if (TextUtils.isEmpty(result)) {
            targetField.setError(targetField.getContext().getString(model.getError()));
            return;
          }
 else {
            targetField.setError("String_Node_Str");
          }
        }
 else         if (!result.matches(model.getReg())) {
          targetField.setError(targetField.getContext().getString(model.getError()));
          return;
        }
 else {
          targetField.setError("String_Node_Str");
        }
      }
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  if (wapper.getMethod() != null) {
    try {
      wapper.getMethod().invoke(target);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
catch (    InvocationTargetException e) {
      e.printStackTrace();
    }
  }
}