nus-yam/ex-repair huggingface dataset:
Program: 28349
Project: 28349
Buggy source:
/** 
 * 将多个集合排序并显示不同的段落（分页）
 * @param < T > 集合元素类型
 * @param pageNo 页码
 * @param numPerPage 每页的条目数
 * @param comparator 比较器
 * @param colls 集合数组
 * @return 分业后的段落内容
 */
@SafeVarargs public static <T>List<T> sortPageAll2(int pageNo,int numPerPage,Comparator<T> comparator,Collection<T>... colls){
  BoundedPriorityQueue<T> queue=new BoundedPriorityQueue<T>(pageNo * numPerPage);
  for (  Collection<T> coll : colls) {
    queue.addAll(coll);
  }
  int resultSize=queue.size();
  if (resultSize <= numPerPage) {
    return queue.toList();
  }
  final int[] startEnd=PageUtil.transToStartEnd(pageNo,numPerPage);
  if (startEnd[1] > resultSize) {
    return new ArrayList<>();
  }
  return queue.toList().subList(startEnd[0],startEnd[1]);
}

Fixed version (ground truth):
/** 
 * 将多个集合排序并显示不同的段落（分页）
 * @param < T > 集合元素类型
 * @param pageNo 页码
 * @param numPerPage 每页的条目数
 * @param comparator 比较器
 * @param colls 集合数组
 * @return 分业后的段落内容
 */
@SafeVarargs public static <T>List<T> sortPageAll2(int pageNo,int numPerPage,Comparator<T> comparator,Collection<T>... colls){
  BoundedPriorityQueue<T> queue=new BoundedPriorityQueue<>(pageNo * numPerPage,comparator);
  for (  Collection<T> coll : colls) {
    queue.addAll(coll);
  }
  int resultSize=queue.size();
  if (resultSize <= numPerPage) {
    return queue.toList();
  }
  final int[] startEnd=PageUtil.transToStartEnd(pageNo,numPerPage);
  if (startEnd[1] > resultSize) {
    return new ArrayList<>();
  }
  return queue.toList().subList(startEnd[0],startEnd[1]);
}
Program: 28350
Project: 28350
Buggy source:
/** 
 * 将多个集合排序并显示不同的段落（分页）
 * @param < T > 集合元素类型
 * @param pageNo 页码，从1开始
 * @param numPerPage 每页的条目数
 * @param comparator 比较器
 * @param colls 集合数组
 * @return 分页后的段落内容
 */
@SafeVarargs public static <T>List<T> sortPageAll(int pageNo,int numPerPage,Comparator<T> comparator,Collection<T>... colls){
  final List<T> result=new ArrayList<T>();
  for (  Collection<T> coll : colls) {
    result.addAll(coll);
  }
  Collections.sort(result,comparator);
  int resultSize=result.size();
  if (resultSize <= numPerPage) {
    return result;
  }
  final int[] startEnd=PageUtil.transToStartEnd(pageNo,numPerPage);
  if (startEnd[1] > resultSize) {
    return new ArrayList<>();
  }
  return result.subList(startEnd[0],startEnd[1]);
}

Fixed version (ground truth):
/** 
 * 将多个集合排序并显示不同的段落（分页）
 * @param < T > 集合元素类型
 * @param pageNo 页码，从1开始
 * @param numPerPage 每页的条目数
 * @param comparator 比较器
 * @param colls 集合数组
 * @return 分页后的段落内容
 */
@SafeVarargs public static <T>List<T> sortPageAll(int pageNo,int numPerPage,Comparator<T> comparator,Collection<T>... colls){
  final List<T> result=new ArrayList<>();
  for (  Collection<T> coll : colls) {
    result.addAll(coll);
  }
  Collections.sort(result,comparator);
  int resultSize=result.size();
  if (resultSize <= numPerPage) {
    return result;
  }
  final int[] startEnd=PageUtil.transToStartEnd(pageNo,numPerPage);
  if (startEnd[1] > resultSize) {
    return new ArrayList<>();
  }
  return result.subList(startEnd[0],startEnd[1]);
}
Program: 28351
Project: 28351
Buggy source:
/** 
 * 将power和值与11取模获得余数进行校验码判断
 * @param iSum
 * @return 校验位
 */
private static char getCheckCode18(int iSum){
  char sCode=StrUtil.C_SPACE;
switch (iSum % 11) {
case 10:
    sCode='2';
  break;
case 9:
sCode='3';
break;
case 8:
sCode='4';
break;
case 7:
sCode='5';
break;
case 6:
sCode='6';
break;
case 5:
sCode='7';
break;
case 4:
sCode='8';
break;
case 3:
sCode='9';
break;
case 2:
sCode='x';
break;
case 1:
sCode='0';
break;
case 0:
sCode='1';
break;
}
return sCode;
}

Fixed version (ground truth):
/** 
 * 将power和值与11取模获得余数进行校验码判断
 * @param iSum
 * @return 校验位
 */
private static char getCheckCode18(int iSum){
switch (iSum % 11) {
case 10:
    return '2';
case 9:
  return '3';
case 8:
return '4';
case 7:
return '5';
case 6:
return '6';
case 5:
return '7';
case 4:
return '8';
case 3:
return '9';
case 2:
return 'x';
case 1:
return '0';
case 0:
return '1';
default :
return StrUtil.C_SPACE;
}
}
Program: 28352
Project: 28352
Buggy source:
/** 
 * 验证10位身份编码是否合法
 * @param idCard 身份编码
 * @return 身份证信息数组<p> [0] - 台湾、澳门、香港 [1] - 性别(男M,女F,未知N) [2] - 是否合法(合法true,不合法false) 若不是身份证件号码则返回null </p>
 */
public static String[] isValidCard10(String idCard){
  String[] info=new String[3];
  String card=idCard.replaceAll("String_Node_Str","String_Node_Str");
  if (card.length() != 8 && card.length() != 9 && idCard.length() != 10) {
    return null;
  }
  if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    System.out.println("String_Node_Str");
    String char2=idCard.substring(1,2);
    if (char2.equals("String_Node_Str")) {
      info[1]="String_Node_Str";
      System.out.println("String_Node_Str");
    }
 else     if (char2.equals("String_Node_Str")) {
      info[1]="String_Node_Str";
      System.out.println("String_Node_Str");
    }
 else {
      info[1]="String_Node_Str";
      info[2]="String_Node_Str";
      System.out.println("String_Node_Str");
      return info;
    }
    info[2]=isValidTWCard(idCard) ? "String_Node_Str" : "String_Node_Str";
  }
 else   if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    info[1]="String_Node_Str";
  }
 else   if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    info[1]="String_Node_Str";
    info[2]=isValidHKCard(idCard) ? "String_Node_Str" : "String_Node_Str";
  }
 else {
    return null;
  }
  return info;
}

Fixed version (ground truth):
/** 
 * 验证10位身份编码是否合法
 * @param idCard 身份编码
 * @return 身份证信息数组<p> [0] - 台湾、澳门、香港 [1] - 性别(男M,女F,未知N) [2] - 是否合法(合法true,不合法false) 若不是身份证件号码则返回null </p>
 */
public static String[] isValidCard10(String idCard){
  String[] info=new String[3];
  String card=idCard.replaceAll("String_Node_Str","String_Node_Str");
  if (card.length() != 8 && card.length() != 9 && idCard.length() != 10) {
    return null;
  }
  if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    String char2=idCard.substring(1,2);
    if (char2.equals("String_Node_Str")) {
      info[1]="String_Node_Str";
    }
 else     if (char2.equals("String_Node_Str")) {
      info[1]="String_Node_Str";
    }
 else {
      info[1]="String_Node_Str";
      info[2]="String_Node_Str";
      return info;
    }
    info[2]=isValidTWCard(idCard) ? "String_Node_Str" : "String_Node_Str";
  }
 else   if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    info[1]="String_Node_Str";
  }
 else   if (idCard.matches("String_Node_Str")) {
    info[0]="String_Node_Str";
    info[1]="String_Node_Str";
    info[2]=isValidHKCard(idCard) ? "String_Node_Str" : "String_Node_Str";
  }
 else {
    return null;
  }
  return info;
}
Program: 28353
Project: 28353
Buggy source:
/** 
 * 验证香港身份证号码(存在Bug，部份特殊身份证无法检查) <p> 身份证前2位为英文字符，如果只出现一个英文字符则表示第一位是空格，对应数字58 前2位英文字符A-Z分别对应数字10-35 最后一位校验码为0-9的数字加上字符"A"，"A"代表10 </p> <p> 将身份证号码全部转换为数字，分别对应乘9-1相加的总和，整除11则证件号码有效 </p>
 * @param idCard 身份证号码
 * @return 验证码是否符合
 */
public static boolean isValidHKCard(String idCard){
  String card=idCard.replaceAll("String_Node_Str","String_Node_Str");
  Integer sum=0;
  if (card.length() == 9) {
    sum=(Integer.valueOf(card.substring(0,1).toUpperCase().toCharArray()[0]) - 55) * 9 + (Integer.valueOf(card.substring(1,2).toUpperCase().toCharArray()[0]) - 55) * 8;
    card=card.substring(1,9);
  }
 else {
    sum=522 + (Integer.valueOf(card.substring(0,1).toUpperCase().toCharArray()[0]) - 55) * 8;
  }
  String mid=card.substring(1,7);
  String end=card.substring(7,8);
  char[] chars=mid.toCharArray();
  Integer iflag=7;
  for (  char c : chars) {
    sum=sum + Integer.valueOf(String.valueOf(c)) * iflag;
    iflag--;
  }
  if (end.toUpperCase().equals("String_Node_Str")) {
    sum+=10;
  }
 else {
    sum+=Integer.valueOf(end);
  }
  return (sum % 11 == 0) ? true : false;
}

Fixed version (ground truth):
/** 
 * 验证香港身份证号码(存在Bug，部份特殊身份证无法检查) <p> 身份证前2位为英文字符，如果只出现一个英文字符则表示第一位是空格，对应数字58 前2位英文字符A-Z分别对应数字10-35 最后一位校验码为0-9的数字加上字符"A"，"A"代表10 </p> <p> 将身份证号码全部转换为数字，分别对应乘9-1相加的总和，整除11则证件号码有效 </p>
 * @param idCard 身份证号码
 * @return 验证码是否符合
 */
public static boolean isValidHKCard(String idCard){
  String card=idCard.replaceAll("String_Node_Str","String_Node_Str");
  Integer sum=0;
  if (card.length() == 9) {
    sum=(Integer.valueOf(card.substring(0,1).toUpperCase().toCharArray()[0]) - 55) * 9 + (Integer.valueOf(card.substring(1,2).toUpperCase().toCharArray()[0]) - 55) * 8;
    card=card.substring(1,9);
  }
 else {
    sum=522 + (Integer.valueOf(card.substring(0,1).toUpperCase().toCharArray()[0]) - 55) * 8;
  }
  String mid=card.substring(1,7);
  String end=card.substring(7,8);
  char[] chars=mid.toCharArray();
  Integer iflag=7;
  for (  char c : chars) {
    sum=sum + Integer.valueOf(String.valueOf(c)) * iflag;
    iflag--;
  }
  if ("String_Node_Str".equals(end.toUpperCase())) {
    sum+=10;
  }
 else {
    sum+=Integer.valueOf(end);
  }
  return (sum % 11 == 0) ? true : false;
}
Program: 28354
Project: 28354
Buggy source:
/** 
 * 根据long值获取ip v4地址
 * @param longIP IP的long表示形式
 * @return IP V4 地址
 */
public static String longToIpv4(long longIP){
  StringBuffer sb=new StringBuffer();
  sb.append(String.valueOf(longIP >>> 24));
  sb.append("String_Node_Str");
  sb.append(String.valueOf((longIP & 0x00FFFFFF) >>> 16));
  sb.append("String_Node_Str");
  sb.append(String.valueOf((longIP & 0x0000FFFF) >>> 8));
  sb.append("String_Node_Str");
  sb.append(String.valueOf(longIP & 0x000000FF));
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * 根据long值获取ip v4地址
 * @param longIP IP的long表示形式
 * @return IP V4 地址
 */
public static String longToIpv4(long longIP){
  final StringBuilder sb=new StringBuilder();
  sb.append(String.valueOf(longIP >>> 24));
  sb.append("String_Node_Str");
  sb.append(String.valueOf((longIP & 0x00FFFFFF) >>> 16));
  sb.append("String_Node_Str");
  sb.append(String.valueOf((longIP & 0x0000FFFF) >>> 8));
  sb.append("String_Node_Str");
  sb.append(String.valueOf(longIP & 0x000000FF));
  return sb.toString();
}
Program: 28355
Project: 28355
Buggy source:
/** 
 * 获得一个随机的字符串
 * @param baseString 随机字符选取的样本
 * @param length 字符串的长度
 * @return 随机字符串
 */
public static String randomString(String baseString,int length){
  Random random=new Random();
  StringBuffer sb=new StringBuffer();
  if (length < 1) {
    length=1;
  }
  int baseLength=baseString.length();
  for (int i=0; i < length; i++) {
    int number=random.nextInt(baseLength);
    sb.append(baseString.charAt(number));
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * 获得一个随机的字符串
 * @param baseString 随机字符选取的样本
 * @param length 字符串的长度
 * @return 随机字符串
 */
public static String randomString(String baseString,int length){
  final Random random=new Random();
  final StringBuilder sb=new StringBuilder();
  if (length < 1) {
    length=1;
  }
  int baseLength=baseString.length();
  for (int i=0; i < length; i++) {
    int number=random.nextInt(baseLength);
    sb.append(baseString.charAt(number));
  }
  return sb.toString();
}
Program: 28356
Project: 28356
Buggy source:
public X509Certificate[] getAcceptedIssuers(){
  return null;
}

Fixed version (ground truth):
@Override public X509Certificate[] getAcceptedIssuers(){
  return null;
}
Program: 28357
Project: 28357
Buggy source:
public boolean verify(String hostname,SSLSession session){
  return true;
}

Fixed version (ground truth):
@Override public boolean verify(String hostname,SSLSession session){
  return true;
}
Program: 28358
Project: 28358
Buggy source:
/** 
 * Get the "null" string value. 获得“null”字符串
 * @return The string "null".
 */
public String toString(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Get the "null" string value. 获得“null”字符串
 * @return The string "null".
 */
@Override public String toString(){
  return "String_Node_Str";
}
Program: 28359
Project: 28359
Buggy source:
/** 
 * Make a printable string of this JSONTokener.
 * @return " at {index} [character {character} line {line}]"
 */
public String toString(){
  return "String_Node_Str" + this.index + "String_Node_Str"+ this.character+ "String_Node_Str"+ this.line+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Make a printable string of this JSONTokener.
 * @return " at {index} [character {character} line {line}]"
 */
@Override public String toString(){
  return "String_Node_Str" + this.index + "String_Node_Str"+ this.character+ "String_Node_Str"+ this.line+ "String_Node_Str";
}
Program: 28360
Project: 28360
Buggy source:
/** 
 * Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known.
 * @return The error message.
 */
public String getMessage(){
  String ret=super.getMessage();
  if (fileName != null) {
    ret+=("String_Node_Str" + fileName);
    if (lineNumber != -1) {
      ret+="String_Node_Str" + lineNumber;
    }
    if (columnNumber != -1) {
      ret+="String_Node_Str" + columnNumber;
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Returns a message containing the String passed to a constructor as well as line and column numbers and filename if any of these are known.
 * @return The error message.
 */
@Override public String getMessage(){
  String ret=super.getMessage();
  if (fileName != null) {
    ret+=("String_Node_Str" + fileName);
    if (lineNumber != -1) {
      ret+="String_Node_Str" + lineNumber;
    }
    if (columnNumber != -1) {
      ret+="String_Node_Str" + columnNumber;
    }
  }
  return ret;
}
Program: 28361
Project: 28361
Buggy source:
/** 
 * 将当前主机的信息转换成字符串。
 * @return 主机信息的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getAddress());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将当前主机的信息转换成字符串。
 * @return 主机信息的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getAddress());
  return builder.toString();
}
Program: 28362
Project: 28362
Buggy source:
/** 
 * 将Java Implementation的信息转换成字符串。
 * @return JVM impl.的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  SystemUtil.append(builder,"String_Node_Str",getVendorURL());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将Java Implementation的信息转换成字符串。
 * @return JVM impl.的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  SystemUtil.append(builder,"String_Node_Str",getVendorURL());
  return builder.toString();
}
Program: 28363
Project: 28363
Buggy source:
/** 
 * 将当前运行的JRE信息转换成字符串。
 * @return JRE信息的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getHomeDir());
  SystemUtil.append(builder,"String_Node_Str",getExtDirs());
  SystemUtil.append(builder,"String_Node_Str",getEndorsedDirs());
  SystemUtil.append(builder,"String_Node_Str",getClassPath());
  SystemUtil.append(builder,"String_Node_Str",getClassVersion());
  SystemUtil.append(builder,"String_Node_Str",getLibraryPath());
  SystemUtil.append(builder,"String_Node_Str",getProtocolPackages());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将当前运行的JRE信息转换成字符串。
 * @return JRE信息的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getHomeDir());
  SystemUtil.append(builder,"String_Node_Str",getExtDirs());
  SystemUtil.append(builder,"String_Node_Str",getEndorsedDirs());
  SystemUtil.append(builder,"String_Node_Str",getClassPath());
  SystemUtil.append(builder,"String_Node_Str",getClassVersion());
  SystemUtil.append(builder,"String_Node_Str",getLibraryPath());
  SystemUtil.append(builder,"String_Node_Str",getProtocolPackages());
  return builder.toString();
}
Program: 28364
Project: 28364
Buggy source:
/** 
 * 将Java Specification的信息转换成字符串。
 * @return JVM spec.的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将Java Specification的信息转换成字符串。
 * @return JVM spec.的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  return builder.toString();
}
Program: 28365
Project: 28365
Buggy source:
/** 
 * 将Java Virutal Machine Implementation的信息转换成字符串。
 * @return JVM impl.的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  SystemUtil.append(builder,"String_Node_Str",getInfo());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将Java Virutal Machine Implementation的信息转换成字符串。
 * @return JVM impl.的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  SystemUtil.append(builder,"String_Node_Str",getInfo());
  return builder.toString();
}
Program: 28366
Project: 28366
Buggy source:
/** 
 * 将Java Virutal Machine Specification的信息转换成字符串。
 * @return JVM spec.的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将Java Virutal Machine Specification的信息转换成字符串。
 * @return JVM spec.的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getVendor());
  return builder.toString();
}
Program: 28367
Project: 28367
Buggy source:
/** 
 * 将OS的信息转换成字符串。
 * @return OS的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getArch());
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getFileSeparator());
  SystemUtil.append(builder,"String_Node_Str",getLineSeparator());
  SystemUtil.append(builder,"String_Node_Str",getPathSeparator());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将OS的信息转换成字符串。
 * @return OS的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getArch());
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getVersion());
  SystemUtil.append(builder,"String_Node_Str",getFileSeparator());
  SystemUtil.append(builder,"String_Node_Str",getLineSeparator());
  SystemUtil.append(builder,"String_Node_Str",getPathSeparator());
  return builder.toString();
}
Program: 28368
Project: 28368
Buggy source:
/** 
 * 将当前用户的信息转换成字符串。
 * @return 用户信息的字符串表示
 */
public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getHomeDir());
  SystemUtil.append(builder,"String_Node_Str",getCurrentDir());
  SystemUtil.append(builder,"String_Node_Str",getTempDir());
  SystemUtil.append(builder,"String_Node_Str",getLanguage());
  SystemUtil.append(builder,"String_Node_Str",getCountry());
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * 将当前用户的信息转换成字符串。
 * @return 用户信息的字符串表示
 */
@Override public final String toString(){
  StringBuilder builder=new StringBuilder();
  SystemUtil.append(builder,"String_Node_Str",getName());
  SystemUtil.append(builder,"String_Node_Str",getHomeDir());
  SystemUtil.append(builder,"String_Node_Str",getCurrentDir());
  SystemUtil.append(builder,"String_Node_Str",getTempDir());
  SystemUtil.append(builder,"String_Node_Str",getLanguage());
  SystemUtil.append(builder,"String_Node_Str",getCountry());
  return builder.toString();
}
Program: 28369
Project: 28369
Buggy source:
/** 
 * base64编码
 * @param source 被编码的base64字符串
 * @param charset 字符集
 * @return 被加密后的字符串
 */
public static String encode(byte[] source,Charset charset){
  return StrUtil.str(encode(source,false),charset);
}

Fixed version (ground truth):
/** 
 * 编码为Base64<br> 如果isMultiLine为<code>true</code>，则每76个字符一个换行符，否则在一行显示
 * @param arr 被编码的数组
 * @param isMultiLine 在76个char之后是CRLF还是EOF
 * @param isUrlSafe 是否使用URL安全字符，一般为<code>false</code>
 * @return 编码后的bytes
 */
public static byte[] encode(byte[] arr,boolean isMultiLine,boolean isUrlSafe){
  if (null == arr) {
    return null;
  }
  int len=arr.length;
  if (len == 0) {
    return new byte[0];
  }
  int evenlen=(len / 3) * 3;
  int cnt=((len - 1) / 3 + 1) << 2;
  int destlen=cnt + (isMultiLine ? (cnt - 1) / 76 << 1 : 0);
  byte[] dest=new byte[destlen];
  byte[] encodeTable=isUrlSafe ? URL_SAFE_ENCODE_TABLE : STANDARD_ENCODE_TABLE;
  for (int s=0, d=0, cc=0; s < evenlen; ) {
    int i=(arr[s++] & 0xff) << 16 | (arr[s++] & 0xff) << 8 | (arr[s++] & 0xff);
    dest[d++]=encodeTable[(i >>> 18) & 0x3f];
    dest[d++]=encodeTable[(i >>> 12) & 0x3f];
    dest[d++]=encodeTable[(i >>> 6) & 0x3f];
    dest[d++]=encodeTable[i & 0x3f];
    if (isMultiLine && ++cc == 19 && d < destlen - 2) {
      dest[d++]='\r';
      dest[d++]='\n';
      cc=0;
    }
  }
  int left=len - evenlen;
  if (left > 0) {
    int i=((arr[evenlen] & 0xff) << 10) | (left == 2 ? ((arr[len - 1] & 0xff) << 2) : 0);
    dest[destlen - 4]=encodeTable[i >> 12];
    dest[destlen - 3]=encodeTable[(i >>> 6) & 0x3f];
    if (isUrlSafe) {
      int urlSafeLen=destlen - 2;
      if (2 == left) {
        dest[destlen - 2]=encodeTable[i & 0x3f];
        urlSafeLen+=1;
      }
      byte[] urlSafeDest=new byte[urlSafeLen];
      System.arraycopy(dest,0,urlSafeDest,0,urlSafeLen);
      return urlSafeDest;
    }
 else {
      dest[destlen - 2]=left == 2 ? encodeTable[i & 0x3f] : (byte)'=';
      dest[destlen - 1]='=';
    }
  }
  return dest;
}
Program: 28370
Project: 28370
Buggy source:
/** 
 * 等级数量是否有效<br> 有效的定义是：levelMaxCount大于0（被设置），当前等级数量没有超过这个最大值
 * @param levelCount 登记数量
 * @return 是否有效
 */
private boolean isLevelCountValid(int levelCount){
  return this.levelMaxCount > 0 && levelCount < this.levelMaxCount;
}

Fixed version (ground truth):
/** 
 * 等级数量是否有效<br> 有效的定义是：levelMaxCount大于0（被设置），当前等级数量没有超过这个最大值
 * @param levelCount 登记数量
 * @return 是否有效
 */
private boolean isLevelCountValid(int levelCount){
  return this.levelMaxCount <= 0 || levelCount < this.levelMaxCount;
}
Program: 28372
Project: 28372
Buggy source:
/** 
 * 获得自定义转换器
 * @param < T >
 * @param type 类型
 * @return 转换器
 */
@SuppressWarnings("String_Node_Str") public <T>Converter<T> getCustomConverter(Class<T> type){
  return (null == customConverter) ? null : (Converter<T>)customConverter.get(type);
}

Fixed version (ground truth):
/** 
 * 获得自定义转换器
 * @param < T >
 * @param type 类型
 * @return 转换器
 */
@SuppressWarnings("String_Node_Str") public <T>Converter<T> getCustomConverter(Class<T> type){
  return (null == customConverterMap) ? null : (Converter<T>)customConverterMap.get(type);
}
Program: 28373
Project: 28373
Buggy source:
/** 
 * 登记自定义转换器
 * @param converter 转换器
 * @return {@link ConverterRegistry}
 */
public ConverterRegistry putCustom(Class<?> clazz,Converter<?> converter){
  if (null == customConverter) {
synchronized (this) {
      if (null == customConverter) {
        customConverter=new ConcurrentHashMap<>();
      }
    }
  }
  customConverter.put(clazz,converter);
  return this;
}

Fixed version (ground truth):
/** 
 * 登记自定义转换器
 * @param converter 转换器
 * @return {@link ConverterRegistry}
 */
public ConverterRegistry putCustom(Class<?> clazz,Converter<?> converter){
  if (null == customConverterMap) {
synchronized (this) {
      if (null == customConverterMap) {
        customConverterMap=new ConcurrentHashMap<>();
      }
    }
  }
  customConverterMap.put(clazz,converter);
  return this;
}
Program: 28374
Project: 28374
Buggy source:
/** 
 * 获得转换器<br> 自定义转换器优先级高于默认转换器
 * @param < T >
 * @param type 类型
 * @return 转换器
 */
@SuppressWarnings("String_Node_Str") public <T>Converter<T> getConverter(Class<T> type){
  Converter<T> converter=this.getCustomConverter(type);
  if (null == converter) {
    converter=(Converter<T>)defaultConverter.get(type);
  }
  return converter;
}

Fixed version (ground truth):
/** 
 * 获得转换器<br>
 * @param < T > 转换的目标类型
 * @param type 类型
 * @param isCustomFirst 是否自定义转换器优先
 * @return 转换器
 */
public <T>Converter<T> getConverter(Class<T> type,boolean isCustomFirst){
  Converter<T> converter=null;
  if (isCustomFirst) {
    converter=this.getCustomConverter(type);
    if (null == converter) {
      converter=this.getDefaultConverter(type);
    }
  }
 else {
    converter=this.getDefaultConverter(type);
    if (null == converter) {
      converter=this.getCustomConverter(type);
    }
  }
  return converter;
}
Program: 28375
Project: 28375
Buggy source:
@Override protected T[] convertInternal(Object value){
  return value.getClass().isArray() ? convertObjectToArray(value) : convertArrayToArray(value);
}

Fixed version (ground truth):
@Override protected T[] convertInternal(Object value){
  return value.getClass().isArray() ? convertArrayToArray(value) : convertObjectToArray(value);
}
Program: 28376
Project: 28376
Buggy source:
/** 
 * @param dsFactory 数据源工厂
 * @return 自定义的数据源工厂
 */
public static DSFactory setCurrentDSFactory(DSFactory dsFactory){
  log.debug("String_Node_Str",dsFactory.dataSourceName);
  currentDSFactory=dsFactory;
  return currentDSFactory;
}

Fixed version (ground truth):
/** 
 * @param dsFactory 数据源工厂
 * @return 自定义的数据源工厂
 */
public static DSFactory setCurrentDSFactory(DSFactory dsFactory){
  if (null != currentDSFactory) {
    currentDSFactory.destroy();
  }
  log.debug("String_Node_Str",dsFactory.dataSourceName);
  currentDSFactory=dsFactory;
  return currentDSFactory;
}
Program: 28377
Project: 28377
Buggy source:
/** 
 * 填充class 到 classes
 * @param className 类名
 * @param packageName 包名
 * @param classes 类集合
 * @param classFilter 类过滤器
 */
private static void fillClass(String className,String packageName,Set<Class<?>> classes,ClassFilter classFilter){
  if (className.startsWith(packageName)) {
    try {
      final Class<?> clazz=Class.forName(className,false,getClassLoader());
      if (classFilter == null || classFilter.accept(clazz)) {
        classes.add(clazz);
      }
    }
 catch (    Throwable ex) {
    }
  }
}

Fixed version (ground truth):
/** 
 * 填充class 到 classes
 * @param className 类名
 * @param packageName 包名
 * @param classes 类集合
 * @param classFilter 类过滤器
 */
private static void fillClass(String className,String packageName,Set<Class<?>> classes,ClassFilter classFilter){
  if (className.startsWith(packageName)) {
    try {
      final Class<?> clazz=Class.forName(className,false,getClassLoader());
      if (classFilter == null || classFilter.accept(clazz)) {
        classes.add(clazz);
      }
    }
 catch (    Exception ex) {
    }
  }
}
Program: 28378
Project: 28378
Buggy source:
/** 
 * 处理为jar文件的情况，填充满足条件的class 到 classes
 * @param file jar文件
 * @param packageName 包名
 * @param classFilter 类过滤器
 * @param classes 类集合
 */
private static void processJarFile(File file,String packageName,ClassFilter classFilter,Set<Class<?>> classes){
  try {
    for (    JarEntry entry : Collections.list(new JarFile(file).entries())) {
      if (isClass(entry.getName())) {
        final String className=entry.getName().replace(StrUtil.SLASH,StrUtil.DOT).replace(FileUtil.CLASS_EXT,StrUtil.EMPTY);
        fillClass(className,packageName,classes,classFilter);
      }
    }
  }
 catch (  Throwable ex) {
    log.error(ex.getMessage(),ex);
  }
}

Fixed version (ground truth):
/** 
 * 处理为jar文件的情况，填充满足条件的class 到 classes
 * @param file jar文件
 * @param packageName 包名
 * @param classFilter 类过滤器
 * @param classes 类集合
 */
private static void processJarFile(File file,String packageName,ClassFilter classFilter,Set<Class<?>> classes){
  try {
    for (    JarEntry entry : Collections.list(new JarFile(file).entries())) {
      if (isClass(entry.getName())) {
        final String className=entry.getName().replace(StrUtil.SLASH,StrUtil.DOT).replace(FileUtil.CLASS_EXT,StrUtil.EMPTY);
        fillClass(className,packageName,classes,classFilter);
      }
    }
  }
 catch (  Exception ex) {
    log.error(ex.getMessage(),ex);
  }
}
Program: 28379
Project: 28379
Buggy source:
/** 
 * @return 获得日志，自动判定日志发出者
 */
public static Log get(){
  return getLog(new Exception().getStackTrace()[2].getClassName());
}

Fixed version (ground truth):
/** 
 * @return 获得调用者的日志
 */
public static Log get(){
  return getLog(new Exception().getStackTrace()[1].getClassName());
}
Program: 28380
Project: 28380
Buggy source:
/** 
 * @return 获得日志，自动判定日志发出者
 */
public static Log get(){
  return LogFactory.get();
}

Fixed version (ground truth):
/** 
 * @return 获得日志，自动判定日志发出者
 */
public static Log get(){
  return LogFactory.indirectGet();
}
Program: 28381
Project: 28381
Buggy source:
/** 
 * 偏移月
 * @param date 日期
 * @param offsite 偏移月数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteMonth(Date date,int offsite){
  return offsiteDate(new DateTime(),Calendar.MONTH,offsite);
}

Fixed version (ground truth):
/** 
 * 偏移月
 * @param date 日期
 * @param offsite 偏移月数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteMonth(Date date,int offsite){
  return offsiteDate(date,Calendar.MONTH,offsite);
}
Program: 28382
Project: 28382
Buggy source:
/** 
 * 偏移天
 * @param date 日期
 * @param offsite 偏移天数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteDay(Date date,int offsite){
  return offsiteDate(new DateTime(),Calendar.DAY_OF_YEAR,offsite);
}

Fixed version (ground truth):
/** 
 * 偏移天
 * @param date 日期
 * @param offsite 偏移天数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteDay(Date date,int offsite){
  return offsiteDate(date,Calendar.DAY_OF_YEAR,offsite);
}
Program: 28383
Project: 28383
Buggy source:
/** 
 * 偏移周
 * @param date 日期
 * @param offsite 偏移周数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteWeek(Date date,int offsite){
  return offsiteDate(new DateTime(),Calendar.WEEK_OF_YEAR,offsite);
}

Fixed version (ground truth):
/** 
 * 偏移周
 * @param date 日期
 * @param offsite 偏移周数，正数向未来偏移，负数向历史偏移
 * @return 偏移后的日期
 */
public static DateTime offsiteWeek(Date date,int offsite){
  return offsiteDate(date,Calendar.WEEK_OF_YEAR,offsite);
}
Program: 28384
Project: 28384
Buggy source:
/** 
 * 格式化文本
 * @param template 文本模板，被替换的部分用 {key} 表示
 * @param map 参数值对
 * @return 格式化后的文本
 */
public static String format(String template,Map<String,Object> map){
  if (null == map || map.isEmpty()) {
    return template;
  }
  for (  Entry<String,Object> entry : map.entrySet()) {
    template.replace("String_Node_Str" + entry.getKey() + "String_Node_Str",entry.getValue().toString());
  }
  return template;
}

Fixed version (ground truth):
/** 
 * 格式化文本
 * @param template 文本模板，被替换的部分用 {key} 表示
 * @param map 参数值对
 * @return 格式化后的文本
 */
public static String format(String template,Map<?,?> map){
  if (null == map || map.isEmpty()) {
    return template;
  }
  for (  Entry<?,?> entry : map.entrySet()) {
    template=template.replace("String_Node_Str" + entry.getKey() + "String_Node_Str",entry.getValue().toString());
  }
  return template;
}
Program: 28385
Project: 28385
Buggy source:
/** 
 * 转换为Map
 * @param model 模型
 * @param isOnlyBasicType 是否只允许基本类型，包括String
 */
public static void toMap(Object model,boolean isOnlyBasicType){
  Map<String,Object> map=new HashMap<String,Object>();
  final Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    final String methodName=method.getName();
    if (!methodName.startsWith("String_Node_Str")) {
      continue;
    }
    final String fieldName=StrUtil.lowerFirst(methodName.substring(3));
    Object value=null;
    try {
      value=method.invoke(model);
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",fieldName),e);
    }
    if (value != null) {
      if (value instanceof String) {
        map.put(fieldName,value);
      }
 else       if (isOnlyBasicType) {
        if (value.getClass().isPrimitive() == false) {
          map.put(fieldName,value);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * 转换为Map
 * @param model 模型
 * @param isOnlyBasicType 是否只允许基本类型，包括String
 */
public static Map<String,Object> toMap(Object model,boolean isOnlyBasicType){
  Map<String,Object> map=new HashMap<String,Object>();
  final Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    final String methodName=method.getName();
    if (false == methodName.startsWith("String_Node_Str")) {
      continue;
    }
    final String fieldName=StrUtil.getGeneralField(methodName);
    Object value=null;
    try {
      value=method.invoke(model);
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",fieldName),e);
    }
    if (value != null) {
      if (value instanceof String || value.getClass().isPrimitive() || false == isOnlyBasicType) {
        map.put(fieldName,value);
      }
    }
  }
  return map;
}
Program: 28386
Project: 28386
Buggy source:
/** 
 * 从Map注入
 * @param model 模型
 * @param map map对象
 */
public static void injectFromMap(Object model,Map<?,?> map){
  Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    String methodName=method.getName();
    if (!methodName.startsWith("String_Node_Str")) {
      continue;
    }
    Class<?>[] types=method.getParameterTypes();
    if (types.length != 1) {
      continue;
    }
    String fieldName=StrUtil.lowerFirst(methodName.substring(3));
    Object value=map.get(fieldName);
    if (value == null) {
      continue;
    }
    try {
      method.invoke(model,ClassUtil.parse(types[0],value));
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",fieldName),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * 从Map注入
 * @param model 模型
 * @param map map对象
 */
public static void injectFromMap(Object model,Map<?,?> map){
  Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    String methodName=method.getName();
    if (!methodName.startsWith("String_Node_Str")) {
      continue;
    }
    Class<?>[] types=method.getParameterTypes();
    if (types.length != 1) {
      continue;
    }
    String fieldName=StrUtil.getGeneralField(methodName);
    Object value=map.get(fieldName);
    if (value == null) {
      continue;
    }
    try {
      method.invoke(model,ClassUtil.parse(types[0],value));
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",fieldName),e);
    }
  }
}
Program: 28387
Project: 28387
Buggy source:
/** 
 * 注入Request参数
 * @param model 模型
 * @param modelName 模型名称
 * @param request 请求对象
 * @param isWithModelName 参数是否包含模型名称
 */
public static void injectFromRequest(Object model,String modelName,HttpServletRequest request,boolean isWithModelName){
  Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    String methodName=method.getName();
    if (!methodName.startsWith("String_Node_Str")) {
      continue;
    }
    Class<?>[] types=method.getParameterTypes();
    if (types.length != 1) {
      continue;
    }
    String fieldName=StrUtil.lowerFirst(methodName.substring(3));
    String paramName=isWithModelName ? (modelName + StrUtil.DOT + fieldName) : fieldName;
    String value=request.getParameter(paramName);
    if (StrUtil.isEmpty(value)) {
      continue;
    }
    try {
      method.invoke(model,ClassUtil.parse(types[0],value));
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",paramName),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * 注入Request参数
 * @param model 模型
 * @param modelName 模型名称
 * @param request 请求对象
 * @param isWithModelName 参数是否包含模型名称
 */
public static void injectFromRequest(Object model,String modelName,javax.servlet.ServletRequest request,boolean isWithModelName){
  Method[] methods=model.getClass().getMethods();
  for (  Method method : methods) {
    String methodName=method.getName();
    if (!methodName.startsWith("String_Node_Str")) {
      continue;
    }
    Class<?>[] types=method.getParameterTypes();
    if (types.length != 1) {
      continue;
    }
    final String fieldName=StrUtil.getGeneralField(methodName);
    final String paramName=isWithModelName ? (modelName + StrUtil.DOT + fieldName) : fieldName;
    final String value=request.getParameter(paramName);
    if (StrUtil.isEmpty(value)) {
      continue;
    }
    try {
      method.invoke(model,ClassUtil.parse(types[0],value));
    }
 catch (    Exception e) {
      throw new UtilException(StrUtil.format("String_Node_Str",paramName),e);
    }
  }
}
Program: 28388
Project: 28388
Buggy source:
/** 
 * 获得自增键的值
 * @param ps PreparedStatement
 * @return 自增键的值
 * @throws SQLException
 */
public static Long getGeneratedKey(PreparedStatement ps) throws SQLException {
  ResultSet rs=null;
  try {
    ps.executeUpdate();
    rs=ps.getGeneratedKeys();
    Long generatedKey=null;
    if (rs != null && rs.next()) {
      generatedKey=rs.getLong(1);
    }
    return generatedKey;
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    close(rs);
  }
}

Fixed version (ground truth):
/** 
 * 获得自增键的值
 * @param ps PreparedStatement
 * @return 自增键的值
 * @throws SQLException
 */
public static Long getGeneratedKey(PreparedStatement ps) throws SQLException {
  ResultSet rs=null;
  try {
    rs=ps.getGeneratedKeys();
    Long generatedKey=null;
    if (rs != null && rs.next()) {
      generatedKey=rs.getLong(1);
    }
    return generatedKey;
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    close(rs);
  }
}
Program: 28389
Project: 28389
Buggy source:
/** 
 * 实例化一个新的SQL运行对象
 * @param ds 数据源
 * @return SQL执行类
 */
public static SqlRunner newSqlRunner(DataSource ds){
  return new SqlRunner(ds);
}

Fixed version (ground truth):
/** 
 * 实例化一个新的SQL运行对象
 * @param ds 数据源
 * @param dialect SQL方言
 * @return SQL执行类
 */
public static SqlRunner newSqlRunner(DataSource ds,Dialect dialect){
  return new SqlRunner(ds,dialect);
}
Program: 28390
Project: 28390
Buggy source:
/** 
 * 构件相等条件的where语句<br> 如果没有条件语句，泽返回空串，表示没有条件
 * @param entity 条件实体
 * @param paramValues 条件值得存放List
 * @return 带where关键字的SQL部分
 */
public static String buildEqualsWhere(Entity entity,List<Object> paramValues){
  if (null == entity || entity.isEmpty()) {
    return StrUtil.EMPTY;
  }
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  for (  Entry<String,Object> entry : entity.entrySet()) {
    if (paramValues.size() > 0) {
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str").append("String_Node_Str");
    paramValues.add(entry.getValue());
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * 构件相等条件的where语句<br> 如果没有条件语句，泽返回空串，表示没有条件
 * @param entity 条件实体
 * @param paramValues 条件值得存放List
 * @return 带where关键字的SQL部分
 */
public static String buildEqualsWhere(Entity entity,List<Object> paramValues){
  if (null == entity || entity.isEmpty()) {
    return StrUtil.EMPTY;
  }
  final StringBuilder sb=new StringBuilder("String_Node_Str");
  boolean isNotFirst=false;
  for (  Entry<String,Object> entry : entity.entrySet()) {
    if (isNotFirst) {
      sb.append("String_Node_Str");
    }
 else {
      isNotFirst=true;
    }
    sb.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str").append("String_Node_Str");
    paramValues.add(entry.getValue());
  }
  return sb.toString();
}
Program: 28391
Project: 28391
Buggy source:
/** 
 * 设置表名
 * @param tableName 表名
 */
public void setTableName(String tableName){
  this.tableName=tableName;
}

Fixed version (ground truth):
/** 
 * 设置表名
 * @param tableName 表名
 * @return 本身
 */
public Entity setTableName(String tableName){
  this.tableName=tableName;
  return this;
}
Program: 28392
Project: 28392
Buggy source:
/** 
 * 结果的条目数
 * @param conn 数据库连接对象
 * @param where 查询条件
 * @return 复合条件的结果数
 * @throws SQLException
 */
public int count(Connection conn,Entity where) throws SQLException {
  PreparedStatement ps=null;
  ResultSet rs=null;
  try {
    ps=dialect.psForCount(conn,where);
    rs=ps.executeQuery();
    return new NumberHandler().handle(rs).intValue();
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    DbUtil.close(rs,ps);
  }
}

Fixed version (ground truth):
/** 
 * 结果的条目数
 * @param where 查询条件
 * @return 复合条件的结果数
 * @throws SQLException
 */
public int count(Entity where) throws SQLException {
  Connection conn=null;
  try {
    conn=ds.getConnection();
    return count(conn,where);
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    DbUtil.close(conn);
  }
}
Program: 28393
Project: 28393
Buggy source:
/** 
 * 分页查询<br/>
 * @param fields 返回的字段列表，null则返回所有字段
 * @param where 条件实体类（包含表名）
 * @param page 页码
 * @param numPerPage 每页条目数
 * @param rsh 结果集处理对象
 * @return 结果对象
 * @throws SQLException
 */
public <T>T page(Collection<String> fields,Entity where,int page,int numPerPage,RsHandler<T> rsh) throws SQLException {
  Connection conn=null;
  try {
    conn=ds.getConnection();
    return page(fields,where,page,numPerPage,rsh);
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    DbUtil.close(conn);
  }
}

Fixed version (ground truth):
/** 
 * 分页查询<br/>
 * @param fields 返回的字段列表，null则返回所有字段
 * @param where 条件实体类（包含表名）
 * @param page 页码
 * @param numPerPage 每页条目数
 * @param rsh 结果集处理对象
 * @return 结果对象
 * @throws SQLException
 */
public <T>T page(Collection<String> fields,Entity where,int page,int numPerPage,RsHandler<T> rsh) throws SQLException {
  Connection conn=null;
  try {
    conn=ds.getConnection();
    return page(conn,fields,where,page,numPerPage,rsh);
  }
 catch (  SQLException e) {
    throw e;
  }
 finally {
    DbUtil.close(conn);
  }
}
Program: 28394
Project: 28394
Buggy source:
/** 
 * 构件查询语句
 * @param fields 返回的字段，空则返回所有字段
 * @param where 条件
 * @param paramValues 存放值的列表
 * @return 查询语句
 */
protected StringBuilder buildSelectQuery(Collection<String> fields,Entity where,List<Object> paramValues){
  final StringBuilder sql=new StringBuilder("String_Node_Str");
  if (CollectionUtil.isEmpty(fields)) {
    sql.append("String_Node_Str");
  }
 else {
    sql.append(CollectionUtil.join(fields,"String_Node_Str"));
  }
  sql.append("String_Node_Str").append(where.getTableName()).append(DbUtil.buildEqualsWhere(where,paramValues));
  return sql;
}

Fixed version (ground truth):
/** 
 * 构件查询语句
 * @param fields 返回的字段，空则返回所有字段
 * @param where 条件
 * @param paramValues 存放值的列表
 * @return 查询语句
 */
protected StringBuilder buildSelectQuery(Collection<String> fields,Entity where,List<Object> paramValues){
  final StringBuilder sql=new StringBuilder("String_Node_Str");
  if (CollectionUtil.isEmpty(fields)) {
    sql.append("String_Node_Str");
  }
 else {
    sql.append(CollectionUtil.join(fields,"String_Node_Str"));
  }
  sql.append("String_Node_Str").append(where.getTableName()).append("String_Node_Str").append(DbUtil.buildEqualsWhere(where,paramValues));
  return sql;
}
Program: 28395
Project: 28395
Buggy source:
@Override public PreparedStatement psForDelete(Connection conn,Entity entity) throws SQLException {
  if (null == entity || entity.isEmpty()) {
    throw new SQLException("String_Node_Str");
  }
  final List<Object> paramValues=new ArrayList<Object>(entity.size());
  final StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str").append(entity.getTableName()).append(DbUtil.buildEqualsWhere(entity,paramValues));
  final PreparedStatement ps=conn.prepareStatement(sql.toString());
  DbUtil.fillParams(ps,paramValues.toArray(new Object[paramValues.size()]));
  return ps;
}

Fixed version (ground truth):
@Override public PreparedStatement psForDelete(Connection conn,Entity entity) throws SQLException {
  if (null == entity || entity.isEmpty()) {
    throw new SQLException("String_Node_Str");
  }
  final List<Object> paramValues=new ArrayList<Object>(entity.size());
  final StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str").append(entity.getTableName()).append("String_Node_Str").append(DbUtil.buildEqualsWhere(entity,paramValues));
  final PreparedStatement ps=conn.prepareStatement(sql.toString());
  DbUtil.fillParams(ps,paramValues.toArray(new Object[paramValues.size()]));
  return ps;
}
Program: 28396
Project: 28396
Buggy source:
@Override public PreparedStatement psForUpdate(Connection conn,Entity entity,Entity where) throws SQLException {
  if (null == entity || entity.isEmpty()) {
    throw new SQLException("String_Node_Str");
  }
  final List<Object> paramValues=new ArrayList<Object>(entity.size());
  final StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str").append(entity.getTableName()).append("String_Node_Str");
  for (  Entry<String,Object> entry : entity.entrySet()) {
    if (paramValues.size() > 0) {
      sql.append("String_Node_Str");
    }
    sql.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str");
    paramValues.add(entry.getValue());
  }
  sql.append(DbUtil.buildEqualsWhere(entity,paramValues));
  final PreparedStatement ps=conn.prepareStatement(sql.toString());
  DbUtil.fillParams(ps,paramValues.toArray(new Object[paramValues.size()]));
  return ps;
}

Fixed version (ground truth):
@Override public PreparedStatement psForUpdate(Connection conn,Entity entity,Entity where) throws SQLException {
  if (null == entity || entity.isEmpty()) {
    throw new SQLException("String_Node_Str");
  }
  final List<Object> paramValues=new ArrayList<Object>(entity.size());
  final StringBuilder sql=new StringBuilder();
  sql.append("String_Node_Str").append(entity.getTableName()).append("String_Node_Str");
  for (  Entry<String,Object> entry : entity.entrySet()) {
    if (paramValues.size() > 0) {
      sql.append("String_Node_Str");
    }
    sql.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str");
    paramValues.add(entry.getValue());
  }
  sql.append(DbUtil.buildEqualsWhere(where,paramValues));
  System.out.println(sql);
  final PreparedStatement ps=conn.prepareStatement(sql.toString());
  DbUtil.fillParams(ps,paramValues.toArray(new Object[paramValues.size()]));
  return ps;
}
Program: 28397
Project: 28397
Buggy source:
public static void main(String[] args){
}

Fixed version (ground truth):
public static void main(String[] args) throws SQLException {
  SqlRunner runner=DbUtil.newSqlRunner(DruidDS.getDataSource("String_Node_Str"),DialectFactory.newDialect(DialectFactory.DRIVER_MYSQL));
  Entity e=Entity.create("String_Node_Str").add("String_Node_Str",1);
  List<Entity> list=runner.page(null,e,0,5,new EntityHandler());
  for (  Entity entity : list) {
    System.out.println(entity);
  }
}