Program: 12050
Project: 12050
Buggy source:
/** 
 * Get the information on the methods.
 * @param javaFile
 * @return the information on the methods
 * @throws Exception
 */
public static ClassInfo getMethodNamesAlreadyExists(IFile javaFile) throws Exception {
  PreferenceLoader pref=new PreferenceLoader();
  ClassInfo classInfo=new ClassInfo();
  List<MethodInfo> methodStringInfos=new ArrayList<MethodInfo>();
  if (pref.isTestMethodGenEnabled) {
    InputStream is=null;
    InputStreamReader isr=null;
    BufferedReader br=null;
    try {
      is=FileResourceUtil.readFile(javaFile);
      String encoding=FileResourceUtil.detectEncoding(javaFile);
      is=FileResourceUtil.readFile(javaFile);
      isr=new InputStreamReader(is,encoding);
      br=new BufferedReader(isr);
      StringBuilder tmpsb=new StringBuilder();
      String line=null;
      while ((line=br.readLine()) != null) {
        tmpsb.append(line + StrConst.space);
      }
      String targetClassSourceStr=tmpsb.toString();
      String[] targets=targetClassSourceStr.split("String_Node_Str");
      for (      String target : targets) {
        target=target.replaceAll("String_Node_Str" + StrConst.comma,StrConst.comma).replaceAll(StrConst.comma + "String_Node_Str",StrConst.comma);
        target=target.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        if (target.matches(RegExp.matchesMethod)) {
          Matcher matcher=RegExp.groupMethodPattern.matcher(target);
          if (matcher.find()) {
            MethodInfo each=new MethodInfo();
            each.returnType.name=getType(matcher.group(1));
            each.returnType.nameInMethodName=getTypeAvailableInMethodName(matcher.group(1));
            each.methodName=matcher.group(2);
            each.testMethodName=each.methodName;
            String args=matcher.group(3);
            String[] argArr=args.split("String_Node_Str");
            int argArrLen=argArr.length;
            for (int i=0; i < argArrLen; i++) {
              ArgType argType=new ArgType();
              argType.name=getType(argArr[i]);
              argType.nameInMethodName=getTypeAvailableInMethodName(argArr[i]);
              each.argTypes.add(argType);
            }
            methodStringInfos.add(each);
          }
        }
      }
      if (pref.isTestMethodGenNotBlankEnabled) {
        if (methodStringInfos.size() <= 0 || methodStringInfos.get(0) == null)         methodStringInfos.add(new MethodInfo());
        String[] importLines=targetClassSourceStr.split("String_Node_Str");
        for (        String importLine : importLines) {
          if (!importLine.matches("String_Node_Str")) {
            String importedPackage=importLine.split("String_Node_Str")[0];
            classInfo.importList.add(importedPackage);
            System.out.println(importedPackage);
          }
        }
      }
    }
  finally {
      FileResourceUtil.close(br);
      FileResourceUtil.close(isr);
      FileResourceUtil.close(is);
    }
  }
  classInfo.methods=methodStringInfos;
  return classInfo;
}

Fixed version (ground truth):
/** 
 * Get the information on the methods.
 * @param javaFile
 * @return the information on the methods
 * @throws Exception
 */
public static ClassInfo getMethodNamesAlreadyExists(IFile javaFile) throws Exception {
  PreferenceLoader pref=new PreferenceLoader();
  ClassInfo classInfo=new ClassInfo();
  List<MethodInfo> methodStringInfos=new ArrayList<MethodInfo>();
  if (pref.isTestMethodGenEnabled) {
    InputStream is=null;
    InputStreamReader isr=null;
    BufferedReader br=null;
    try {
      is=FileResourceUtil.readFile(javaFile);
      String encoding=FileResourceUtil.detectEncoding(javaFile);
      is=FileResourceUtil.readFile(javaFile);
      isr=new InputStreamReader(is,encoding);
      br=new BufferedReader(isr);
      StringBuilder tmpsb=new StringBuilder();
      String line=null;
      while ((line=br.readLine()) != null) {
        tmpsb.append(line + StrConst.space);
      }
      String targetClassSourceStr=tmpsb.toString();
      String[] targets=targetClassSourceStr.split("String_Node_Str");
      for (      String target : targets) {
        target=target.replaceAll("String_Node_Str" + StrConst.comma,StrConst.comma).replaceAll(StrConst.comma + "String_Node_Str",StrConst.comma);
        target=target.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        if (target.matches(RegExp.matchesMethod)) {
          Matcher matcher=RegExp.groupMethodPattern.matcher(target);
          if (matcher.find()) {
            MethodInfo each=new MethodInfo();
            each.returnType.name=getType(matcher.group(1));
            each.returnType.nameInMethodName=getTypeAvailableInMethodName(matcher.group(1));
            each.methodName=matcher.group(2);
            each.testMethodName=each.methodName;
            String args=matcher.group(3);
            String[] argArr=args.split("String_Node_Str");
            int argArrLen=argArr.length;
            for (int i=0; i < argArrLen; i++) {
              ArgType argType=new ArgType();
              argType.name=getType(argArr[i]);
              argType.nameInMethodName=getTypeAvailableInMethodName(argArr[i]);
              each.argTypes.add(argType);
            }
            methodStringInfos.add(each);
          }
        }
      }
      if (pref.isTestMethodGenNotBlankEnabled) {
        if (methodStringInfos.size() <= 0 || methodStringInfos.get(0) == null)         methodStringInfos.add(new MethodInfo());
        String[] importLines=targetClassSourceStr.split("String_Node_Str");
        for (        String importLine : importLines) {
          importLine=importLine.replaceAll(StrConst.lineFeed,StrConst.empty);
          if (!importLine.matches("String_Node_Str") && !importLine.matches("String_Node_Str")) {
            String importedPackage=importLine.split("String_Node_Str")[0];
            classInfo.importList.add(importedPackage);
          }
        }
      }
    }
  finally {
      FileResourceUtil.close(br);
      FileResourceUtil.close(isr);
      FileResourceUtil.close(is);
    }
  }
  classInfo.methods=methodStringInfos;
  return classInfo;
}