Program: 102029
Project: 102029
Buggy source:
/** 
 * Calculates a   {@link TextFileChange} for all the substitutions that need to take place in thegiven file based on the collection of path pairs.
 * @param file
 * @param pathPairs
 * @return text file change
 * @throws Exception
 */
public static TextFileChange calculateTextChanges(IFile file,Collection<PathPair> pathPairs) throws Exception {
  File nativeFile=ModelUtil.getLocation(file).makeAbsolute().toFile();
  if (nativeFile == null || !nativeFile.exists())   throw new Exception(getString("String_Node_Str",file.getFullPath()));
  TextFileChange textFileChange=new TextFileChange(file.getName(),file);
  TextEdit fileChangeRootEdit=setRootEdit(textFileChange);
  if (pathPairs.isEmpty()) {
    return textFileChange;
  }
  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)) {
        for (        PathPair pathPair : pathPairs) {
          if (pathPair.getSourcePath().equals(pathPair.getTargetPath())) {
            continue;
          }
          int lineOffset=line.indexOf(pathPair.getSourcePath());
          if (lineOffset < 0)           continue;
          int offset=docOffset + lineOffset;
          ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourcePath().length(),pathPair.getTargetPath());
          fileChangeRootEdit.addChild(edit);
        }
      }
      docOffset+=line.length() + 1;
      if (Platform.getOS().equalsIgnoreCase(Platform.WS_WIN32)) {
        docOffset++;
      }
    }
  }
  finally {
    if (reader != null)     reader.close();
  }
  return textFileChange;
}

Fixed version (ground truth):
/** 
 * Calculates a   {@link TextFileChange} for all the substitutions that need to take place in thegiven file based on the collection of path pairs.
 * @param file
 * @param pathPairs
 * @return text file change
 * @throws Exception
 */
public static TextFileChange calculateTextChanges(IFile file,Collection<PathPair> pathPairs) throws Exception {
  File nativeFile=ModelUtil.getLocation(file).makeAbsolute().toFile();
  if (nativeFile == null || !nativeFile.exists())   throw new Exception(getString("String_Node_Str",file.getFullPath()));
  TextFileChange textFileChange=new TextFileChange(file.getName(),file);
  TextEdit fileChangeRootEdit=setRootEdit(textFileChange);
  if (pathPairs.isEmpty()) {
    return textFileChange;
  }
  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)) {
        for (        PathPair pathPair : pathPairs) {
          if (pathPair.getSourcePath().equals(pathPair.getTargetPath())) {
            continue;
          }
          int lineOffset=line.indexOf(pathPair.getSourcePath().replace('\\','/'));
          if (lineOffset < 0)           continue;
          int offset=docOffset + lineOffset;
          ReplaceEdit edit=new ReplaceEdit(offset,pathPair.getSourcePath().length(),pathPair.getTargetPath().replace('\\','/'));
          fileChangeRootEdit.addChild(edit);
        }
      }
      docOffset+=line.length() + 1;
      if (Platform.getOS().equalsIgnoreCase(Platform.WS_WIN32)) {
        docOffset++;
      }
    }
  }
  finally {
    if (reader != null)     reader.close();
  }
  return textFileChange;
}