Program: 122430
Project: 122430
Buggy source:
/** 
 * change .sh & .bat file's contents
 * @throws FileNotFoundException
 */
private void changeScriptFile(File file){
  BufferedReader br=null;
  BufferedWriter bw=null;
  try {
    br=new BufferedReader(new FileReader(file));
    StringBuffer changedContent=new StringBuffer();
    String line=br.readLine();
    while (line != null && !line.contains("String_Node_Str")) {
      changedContent.append(line + "String_Node_Str");
      line=br.readLine();
    }
    if (line == null)     line="String_Node_Str";
    String line1=line.trim();
    String[] strs=line1.split("String_Node_Str");
    int pos=-1;
    for (int i=0; i < strs.length; i++) {
      if ("String_Node_Str".equalsIgnoreCase(strs[i]) || "String_Node_Str".equalsIgnoreCase(strs[i])) {
        pos=i;
      }
    }
    if (pos != -1) {
      if (file.getName().endsWith("String_Node_Str")) {
        strs[pos + 1]=CLASSPATH_JAR + "String_Node_Str";
      }
      if (file.getName().endsWith("String_Node_Str")) {
        needModuleJarStrs=strs[pos + 1];
        strs[pos + 1]=CLASSPATH_JAR + "String_Node_Str";
      }
    }
    for (    String s : strs) {
      changedContent.append(s).append("String_Node_Str");
    }
    String line2=br.readLine();
    while (line2 != null) {
      changedContent.append(('\n')).append(line2);
      line2=br.readLine();
    }
    bw=new BufferedWriter(new FileWriter(file));
    bw.write(changedContent.toString());
    bw.flush();
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (br != null) {
      try {
        br.close();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * change .sh & .bat file's contents
 * @throws FileNotFoundException
 */
private void changeScriptFile(File file){
  BufferedReader br=null;
  BufferedWriter bw=null;
  try {
    br=new BufferedReader(new FileReader(file));
    StringBuffer changedContent=new StringBuffer();
    String line=br.readLine();
    while (line != null && !line.contains("String_Node_Str")) {
      changedContent.append(line + "String_Node_Str");
      line=br.readLine();
    }
    if (line == null) {
      line="String_Node_Str";
    }
    String line1=line.trim();
    String[] strs=line1.split("String_Node_Str");
    int pos=-1;
    for (int i=0; i < strs.length; i++) {
      if ("String_Node_Str".equalsIgnoreCase(strs[i]) || "String_Node_Str".equalsIgnoreCase(strs[i])) {
        pos=i;
      }
    }
    if (pos != -1) {
      if (file.getName().endsWith(FileConstants.SH_FILE_SUFFIX)) {
        strs[pos + 1]=CLASSPATH_JAR + "String_Node_Str";
      }
      if (file.getName().endsWith(FileConstants.BAT_FILE_SUFFIX)) {
        needModuleJarStrs=strs[pos + 1];
        strs[pos + 1]=CLASSPATH_JAR + "String_Node_Str";
      }
    }
    for (    String s : strs) {
      changedContent.append(s).append("String_Node_Str");
    }
    String line2=br.readLine();
    while (line2 != null) {
      changedContent.append(('\n')).append(line2);
      line2=br.readLine();
    }
    bw=new BufferedWriter(new FileWriter(file));
    bw.write(changedContent.toString());
    bw.flush();
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (br != null) {
      try {
        br.close();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
  }
}