Program: 21976
Project: 21976
Buggy source:
/** 
 * remove reviews from file content
 * @param file
 * @return
 */
private String removeReviews(IFile file){
  if (!isReviewable(file))   return null;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  PrintWriter out=null;
  boolean noChange=true;
  try {
    boolean comment=false;
    BufferedReader reader=new BufferedReader(new InputStreamReader(file.getContents()));
    out=new PrintWriter(baos);
    while (reader.ready()) {
      String origLine=reader.readLine();
      String line=origLine.trim();
      int index=origLine.indexOf(PMDRuntimeConstants.PMD_STYLE_REVIEW_COMMENT);
      int quoteIndex=origLine.indexOf('"');
      if (line.startsWith("String_Node_Str")) {
        if (line.indexOf("String_Node_Str") == -1) {
          comment=true;
        }
        out.println(origLine);
      }
 else       if (comment && line.indexOf("String_Node_Str") != -1) {
        comment=false;
        out.println(origLine);
      }
 else       if (!comment && line.startsWith(PMDRuntimeConstants.PLUGIN_STYLE_REVIEW_COMMENT)) {
        noChange=false;
      }
 else       if (!comment && index != -1 && !(quoteIndex != -1 && quoteIndex < index && index < origLine.lastIndexOf('"'))) {
        noChange=false;
        out.println(origLine.substring(0,index));
      }
 else {
        out.println(origLine);
      }
    }
    out.flush();
  }
 catch (  CoreException e) {
    logError(StringKeys.ERROR_CORE_EXCEPTION,e);
  }
catch (  IOException e) {
    logError(StringKeys.ERROR_IO_EXCEPTION,e);
  }
 finally {
    IOUtil.closeQuietly(baos);
    IOUtil.closeQuietly(out);
  }
  return noChange ? null : baos.toString();
}

Fixed version (ground truth):
/** 
 * remove reviews from file content
 * @param file
 * @return
 */
private String removeReviews(IFile file){
  if (!isReviewable(file))   return null;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  PrintWriter out=null;
  boolean noChange=true;
  try {
    boolean comment=false;
    BufferedReader reader=new BufferedReader(new InputStreamReader(file.getContents()));
    out=new PrintWriter(baos);
    while (reader.ready()) {
      String origLine=reader.readLine();
      String line=origLine.trim();
      if (line == null)       break;
      int index=origLine.indexOf(PMDRuntimeConstants.PMD_STYLE_REVIEW_COMMENT);
      int quoteIndex=origLine.indexOf('"');
      if (line.startsWith("String_Node_Str")) {
        if (line.indexOf("String_Node_Str") == -1) {
          comment=true;
        }
        out.println(origLine);
      }
 else       if (comment && line.indexOf("String_Node_Str") != -1) {
        comment=false;
        out.println(origLine);
      }
 else       if (!comment && line.startsWith(PMDRuntimeConstants.PLUGIN_STYLE_REVIEW_COMMENT)) {
        noChange=false;
      }
 else       if (!comment && index != -1 && !(quoteIndex != -1 && quoteIndex < index && index < origLine.lastIndexOf('"'))) {
        noChange=false;
        out.println(origLine.substring(0,index));
      }
 else {
        out.println(origLine);
      }
    }
    out.flush();
  }
 catch (  CoreException e) {
    logError(StringKeys.ERROR_CORE_EXCEPTION,e);
  }
catch (  IOException e) {
    logError(StringKeys.ERROR_IO_EXCEPTION,e);
  }
 finally {
    IOUtil.closeQuietly(baos);
    IOUtil.closeQuietly(out);
  }
  return noChange ? null : baos.toString();
}