Program: 65279
Project: 65279
Buggy source:
/** 
 * The worker method. It will find the container, create the file if missing or just replace its contents, and open the editor on the newly created file.
 * @param cheatSheetId
 * @param locationPath
 * @param fileName
 * @param showCheatSheet
 * @param monitor
 */
private void doFinish(IPath locationPath,String fileName,final String templateFileName,final InputStream templateStream,final String cheatSheetId,final boolean showCheatSheet,boolean isUseDefaultLibrary,LibraryHandle library,IProgressMonitor monitor){
  monitor.beginTask(CREATING + fileName,2);
  final File file=new File(locationPath.toString(),fileName);
  try {
    File container=new File(locationPath.toString());
    boolean conExists=container.exists();
    if (!conExists) {
      conExists=container.mkdirs();
    }
    if (!conExists) {
      ExceptionUtil.openError(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      return;
    }
    ReportDesignHandle handle;
    if (templateStream == null) {
      handle=SessionHandleAdapter.getInstance().getSessionHandle().createDesignFromTemplate(templateFileName);
    }
 else {
      handle=SessionHandleAdapter.getInstance().getSessionHandle().createDesignFromTemplate(templateFileName,templateStream);
    }
    if (ReportPlugin.getDefault().getEnableCommentPreference()) {
      handle.setStringProperty(ModuleHandle.COMMENTS_PROP,ReportPlugin.getDefault().getCommentPreference());
    }
    if (ReportPlugin.getDefault().getDefaultUnitPreference() != null) {
      handle.setStringProperty(ModuleHandle.UNITS_PROP,ReportPlugin.getDefault().getDefaultUnitPreference());
    }
    if (isPredifinedTemplate(templateFileName)) {
      handle.setDisplayName(null);
      handle.setDescription(null);
    }
    UIUtil.addCreateBy(handle);
    UIUtil.setDPI(handle);
    String bidiOrientation;
    if (templateChoicePage.isLTRDirection())     bidiOrientation=DesignChoiceConstants.BIDI_DIRECTION_LTR;
 else     bidiOrientation=DesignChoiceConstants.BIDI_DIRECTION_RTL;
    handle.setBidiOrientation(bidiOrientation);
    if (isUseDefaultLibrary) {
      UIUtil.includeLibrary(handle,DEUtil.DEFAULT_LIBRARY,true);
    }
    handle.saveAs(file.getAbsolutePath());
    handle.close();
  }
 catch (  Exception e) {
    ExceptionUtil.handle(e);
  }
  monitor.worked(1);
  monitor.setTaskName(OPENING_FILE_FOR_EDITING);
  getShell().getDisplay().asyncExec(new Runnable(){
    public void run(){
      IWorkbench workbench=PlatformUI.getWorkbench();
      IWorkbenchWindow window=workbench.getActiveWorkbenchWindow();
      IWorkbenchPage page=window.getActivePage();
      try {
        if (page == null) {
          throw new IllegalArgumentException();
        }
        page.openEditor(new ReportEditorInput(file),IReportEditorContants.DESIGN_EDITOR_ID,true);
        if (showCheatSheet && !cheatSheetId.equals("String_Node_Str")) {
          Display.getCurrent().getActiveShell().setData(page);
          new OpenCheatSheetAction(cheatSheetId).run();
        }
      }
 catch (      Exception e) {
        ExceptionUtil.handle(e);
      }
    }
  }
);
  monitor.worked(1);
}

Fixed version (ground truth):
/** 
 * The worker method. It will find the container, create the file if missing or just replace its contents, and open the editor on the newly created file.
 * @param cheatSheetId
 * @param locationPath
 * @param fileName
 * @param showCheatSheet
 * @param monitor
 */
private void doFinish(IPath locationPath,String fileName,final String templateFileName,final InputStream templateStream,final String cheatSheetId,final boolean showCheatSheet,boolean isUseDefaultLibrary,LibraryHandle library,IProgressMonitor monitor){
  monitor.beginTask(CREATING + fileName,2);
  final File file=new File(locationPath.toString(),fileName);
  try {
    File container=new File(locationPath.toString());
    boolean conExists=container.exists();
    if (!conExists) {
      conExists=container.mkdirs();
    }
    if (!conExists) {
      ExceptionUtil.openError(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      return;
    }
    ReportDesignHandle handle;
    if (templateStream == null) {
      handle=SessionHandleAdapter.getInstance().getSessionHandle().createDesignFromTemplate(templateFileName);
    }
 else {
      handle=SessionHandleAdapter.getInstance().getSessionHandle().createDesignFromTemplate(templateFileName,templateStream);
    }
    if (ReportPlugin.getDefault().getEnableCommentPreference()) {
      handle.setStringProperty(ModuleHandle.COMMENTS_PROP,ReportPlugin.getDefault().getCommentPreference());
    }
    if (ReportPlugin.getDefault().getDefaultUnitPreference() != null) {
      handle.setStringProperty(ModuleHandle.UNITS_PROP,ReportPlugin.getDefault().getDefaultUnitPreference());
    }
    if (isPredifinedTemplate(templateFileName)) {
      handle.setDisplayName(null);
      handle.setDescription(null);
    }
    UIUtil.addCreateBy(handle);
    UIUtil.setDPI(handle);
    String bidiOrientation;
    if (templateChoicePage.isLTRDirection())     bidiOrientation=DesignChoiceConstants.BIDI_DIRECTION_LTR;
 else     bidiOrientation=DesignChoiceConstants.BIDI_DIRECTION_RTL;
    handle.setBidiOrientation(bidiOrientation);
    if (isUseDefaultLibrary) {
      UIUtil.includeLibrary(handle,DEUtil.DEFAULT_LIBRARY,true);
    }
    handle.saveAs(file.getAbsolutePath());
    handle.close();
  }
 catch (  Exception e) {
    ExceptionUtil.handle(e);
  }
  monitor.worked(1);
  monitor.setTaskName(OPENING_FILE_FOR_EDITING);
  getShell().getDisplay().asyncExec(new Runnable(){
    public void run(){
      IWorkbench workbench=PlatformUI.getWorkbench();
      IWorkbenchWindow window=workbench.getActiveWorkbenchWindow();
      IWorkbenchPage page=window.getActivePage();
      try {
        if (page == null) {
          throw new IllegalArgumentException();
        }
        page.openEditor(new ReportEditorInput(file),IReportEditorContants.DESIGN_EDITOR_ID,true);
        if (showCheatSheet && !cheatSheetId.equals("String_Node_Str")) {
          Display.getCurrent().getActiveShell().setData(page);
          new OpenCheatSheetAction(cheatSheetId).run();
        }
        IReportResourceSynchronizer synchronizer=ReportPlugin.getDefault().getResourceSynchronizerService();
        if (synchronizer != null) {
          synchronizer.notifyResourceChanged(new ReportResourceChangeEvent(this,Path.fromOSString(file.getAbsolutePath()),IReportResourceChangeEvent.NewResource));
        }
      }
 catch (      Exception e) {
        ExceptionUtil.handle(e);
      }
    }
  }
);
  monitor.worked(1);
}