Program: 12075
Project: 12075
Buggy source:
public static List<GeneratingMethodInfo> getMethodNames(IFile javaFile) throws Exception {
  List<GeneratingMethodInfo> methodStringInfos=new ArrayList<GeneratingMethodInfo>();
  boolean enabled=Activator.getDefault().getPreferenceStore().getBoolean(STR.Preference.TestMethodGen.ENABLE);
  boolean enabledNotBlankMethods=Activator.getDefault().getPreferenceStore().getBoolean(STR.Preference.TestMethodGen.METHOD_SAMPLE_IMPLEMENTATION);
  if (enabled) {
    InputStream is=null;
    InputStreamReader isr=null;
    BufferedReader br=null;
    try {
      is=javaFile.getContents();
      UniversalDetector detector=new UniversalDetector(null);
      byte[] buf=new byte[4096];
      int nread;
      while ((nread=is.read(buf)) > 0 && !detector.isDone())       detector.handleData(buf,0,nread);
      detector.dataEnd();
      String encoding=detector.getDetectedCharset();
      if (encoding == null)       encoding=Charset.defaultCharset().name();
      is=javaFile.getContents();
      isr=new InputStreamReader(is,encoding);
      br=new BufferedReader(isr);
      StringBuffer tmpsb=new StringBuffer();
      String line=null;
      while ((line=br.readLine()) != null)       tmpsb.append(line + "String_Node_Str");
      String allSrc=tmpsb.toString();
      String[] publics=allSrc.split("String_Node_Str");
      for (      String publicsEach : publics) {
        publicsEach=publicsEach.replaceAll("String_Node_Str" + STR.COMMA,STR.COMMA).replaceAll(STR.COMMA + "String_Node_Str",STR.COMMA);
        publicsEach=publicsEach.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        if (publicsEach.matches(RXP_SEARCH_METHOD)) {
          Matcher matcher=PAT_SEARCH_GROUP_METHOD.matcher(publicsEach);
          if (matcher.find()) {
            GeneratingMethodInfo each=new GeneratingMethodInfo();
            each.returnTypeName=getType(matcher.group(1));
            each.returnTypeNameInMethodName=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++) {
              each.argTypeNames.add(getType(argArr[i]));
              each.argTypeNamesInMethodName.add(getTypeAvailableInMethodName(argArr[i]));
            }
            methodStringInfos.add(each);
          }
        }
      }
      if (enabledNotBlankMethods) {
        if (methodStringInfos.size() <= 0 || methodStringInfos.get(0) == null)         methodStringInfos.add(new GeneratingMethodInfo());
        String[] importStartLines=allSrc.split("String_Node_Str");
        for (        String importStartLine : importStartLines) {
          if (!importStartLine.matches("String_Node_Str")) {
            String importedPackage=importStartLine.split("String_Node_Str")[0];
            methodStringInfos.get(0).importList.add(importedPackage);
          }
        }
      }
    }
  finally {
      FileResourceUtil.close(br);
      FileResourceUtil.close(isr);
      FileResourceUtil.close(is);
    }
  }
  return methodStringInfos;
}

Fixed version (ground truth):
public static List<GeneratingMethodInfo> getMethodNames(IFile javaFile) throws Exception {
  List<GeneratingMethodInfo> methodStringInfos=new ArrayList<GeneratingMethodInfo>();
  boolean enabled=Activator.getDefault().getPreferenceStore().getBoolean(STR.Preference.TestMethodGen.ENABLE);
  boolean enabledNotBlankMethods=Activator.getDefault().getPreferenceStore().getBoolean(STR.Preference.TestMethodGen.METHOD_SAMPLE_IMPLEMENTATION);
  if (enabled) {
    InputStream is=null;
    InputStreamReader isr=null;
    BufferedReader br=null;
    try {
      is=javaFile.getContents();
      String encoding=FileResourceUtil.detectEncoding(javaFile);
      is=javaFile.getContents();
      isr=new InputStreamReader(is,encoding);
      br=new BufferedReader(isr);
      StringBuffer tmpsb=new StringBuffer();
      String line=null;
      while ((line=br.readLine()) != null)       tmpsb.append(line + "String_Node_Str");
      String allSrc=tmpsb.toString();
      String[] publics=allSrc.split("String_Node_Str");
      for (      String publicsEach : publics) {
        publicsEach=publicsEach.replaceAll("String_Node_Str" + STR.COMMA,STR.COMMA).replaceAll(STR.COMMA + "String_Node_Str",STR.COMMA);
        publicsEach=publicsEach.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
        if (publicsEach.matches(RXP_SEARCH_METHOD)) {
          Matcher matcher=PAT_SEARCH_GROUP_METHOD.matcher(publicsEach);
          if (matcher.find()) {
            GeneratingMethodInfo each=new GeneratingMethodInfo();
            each.returnTypeName=getType(matcher.group(1));
            each.returnTypeNameInMethodName=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++) {
              each.argTypeNames.add(getType(argArr[i]));
              each.argTypeNamesInMethodName.add(getTypeAvailableInMethodName(argArr[i]));
            }
            methodStringInfos.add(each);
          }
        }
      }
      if (enabledNotBlankMethods) {
        if (methodStringInfos.size() <= 0 || methodStringInfos.get(0) == null)         methodStringInfos.add(new GeneratingMethodInfo());
        String[] importStartLines=allSrc.split("String_Node_Str");
        for (        String importStartLine : importStartLines) {
          if (!importStartLine.matches("String_Node_Str")) {
            String importedPackage=importStartLine.split("String_Node_Str")[0];
            methodStringInfos.get(0).importList.add(importedPackage);
          }
        }
      }
    }
  finally {
      FileResourceUtil.close(br);
      FileResourceUtil.close(isr);
      FileResourceUtil.close(is);
    }
  }
  return methodStringInfos;
}