Program: 102016
Project: 102016
Buggy source:
/** 
 * Calculate changes to user-generated sql
 * @param file
 * @param pathPair
 * @param textFileChange
 * @throws Exception 
 */
public static void calculateModelImportsElementLChanges(IFile file,PathPair pathPair,TextFileChange textFileChange) throws Exception {
  File nativeFile=ModelUtil.getLocation(file).makeAbsolute().toFile();
  if (nativeFile == null || !nativeFile.exists())   throw new Exception(getString("String_Node_Str",file.getFullPath()));
  TextEdit fileChangeRootEdit=setRootEdit(textFileChange);
  boolean isWindows=Platform.getOS().equals(Platform.WS_WIN32);
  BufferedReader reader=null;
  String line;
  int docOffset=0;
  try {
    reader=new BufferedReader(new FileReader(nativeFile));
    while ((line=reader.readLine()) != null) {
      if (line.contains(MODEL_IMPORTS_ELEMENT_START)) {
        StringBuilder sb=new StringBuilder(line);
        if (pathPair.getSourcePath().equals(pathPair.getTargetPath())) {
          docOffset+=line.length() + 1;
          continue;
        }
        String sourcePath=pathPair.getSourcePath().replace('\\','/');
        String sourceNameOnly=pathPair.getSourceNameNoExtension();
        boolean sourcePathHasSlash=sourcePath.indexOf('/') > -1;
        int lineOffset=line.indexOf(sourcePath);
        if (lineOffset > 0) {
          if (sourcePathHasSlash || line.charAt(lineOffset - 1) == '"') {
            int offset=docOffset + lineOffset;
            ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourcePath().length(),pathPair.getTargetPath().replace('\\','/'));
            fileChangeRootEdit.addChild(edit);
          }
        }
        lineOffset=line.indexOf(sourceNameOnly);
        if (lineOffset > 0 && line.charAt(lineOffset - 1) == '"' && line.charAt(lineOffset + sourceNameOnly.length()) == '"') {
          int offset=docOffset + lineOffset;
          ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourceNameNoExtension().length(),pathPair.getTargetNameNoExtension());
          fileChangeRootEdit.addChild(edit);
        }
      }
      docOffset+=line.length() + 1;
      if (isWindows) {
        docOffset++;
      }
    }
  }
  finally {
    if (reader != null)     reader.close();
  }
}

Fixed version (ground truth):
/** 
 * Calculate changes to user-generated sql
 * @param file
 * @param pathPair
 * @param textFileChange
 * @throws Exception 
 */
public static void calculateModelImportsElementLChanges(IFile file,PathPair pathPair,TextFileChange textFileChange) throws Exception {
  File nativeFile=ModelUtil.getLocation(file).makeAbsolute().toFile();
  if (nativeFile == null || !nativeFile.exists())   throw new Exception(getString("String_Node_Str",file.getFullPath()));
  TextEdit fileChangeRootEdit=setRootEdit(textFileChange);
  boolean isWindows=hasWindowsLineTerminator(nativeFile);
  BufferedReader reader=null;
  String line;
  int docOffset=0;
  try {
    reader=new BufferedReader(new FileReader(nativeFile));
    while ((line=reader.readLine()) != null) {
      if (line.contains(MODEL_IMPORTS_ELEMENT_START)) {
        StringBuilder sb=new StringBuilder(line);
        if (pathPair.getSourcePath().equals(pathPair.getTargetPath())) {
          docOffset+=line.length() + 1;
          continue;
        }
        String sourcePath=pathPair.getSourcePath().replace('\\','/');
        String sourceNameOnly=pathPair.getSourceNameNoExtension();
        boolean sourcePathHasSlash=sourcePath.indexOf('/') > -1;
        int lineOffset=line.indexOf(sourcePath);
        if (lineOffset > 0) {
          boolean startsWithDQuote=line.charAt(lineOffset - 1) == '"';
          if (sourcePathHasSlash || startsWithDQuote) {
            int offset=docOffset + lineOffset;
            ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourcePath().length(),pathPair.getTargetPath().replace('\\','/'));
            fileChangeRootEdit.addChild(edit);
          }
        }
        lineOffset=line.indexOf(sourceNameOnly);
        boolean startsWithDQuote=false;
        boolean endsWithDQuote=false;
        if (lineOffset > 0) {
          startsWithDQuote=line.charAt(lineOffset - 1) == '"';
          endsWithDQuote=line.charAt(lineOffset + sourceNameOnly.length()) == '"';
        }
        if (lineOffset > 0 && startsWithDQuote && endsWithDQuote) {
          int offset=docOffset + lineOffset;
          ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourceNameNoExtension().length(),pathPair.getTargetNameNoExtension());
          fileChangeRootEdit.addChild(edit);
        }
      }
      docOffset+=line.length() + 1;
      if (isWindows) {
        docOffset++;
      }
    }
  }
  finally {
    if (reader != null)     reader.close();
  }
}