nus-yam/ex-repair huggingface dataset:
Program: 78603
Project: 78603
Buggy source:
/** 
 * processes after pressing ok button
 */
private void okPressedProcess(){
  Utility.setPreferenceStoredMap(JdbcPlugin.JAR_MAP_PREFERENCE_KEY,jarMap);
  Utility.setPreferenceStoredMap(JdbcPlugin.DRIVER_MAP_PREFERENCE_KEY,driverMap);
  Iterator jarsCopyIterator=jarsToBeCopied.values().iterator();
  while (jarsCopyIterator.hasNext()) {
    JarFile jar=(JarFile)jarsCopyIterator.next();
    jar.copyJarToODADir();
    Utility.removeMapEntryFromPreferenceStoredMap(JdbcPlugin.DELETED_JAR_MAP_PREFERENCE_KEY,jar.getFileName());
  }
  Iterator jarsDeleteIterator=jarsToBeDeleted.values().iterator();
  while (jarsDeleteIterator.hasNext()) {
    JarFile jar=(JarFile)jarsDeleteIterator.next();
    jar.deleteJarFromODADir();
    Utility.putPreferenceStoredMapValue(JdbcPlugin.DELETED_JAR_MAP_PREFERENCE_KEY,jar.getFileName(),jar);
  }
  refreshDriverPage();
  JdbcToolKit.resetJdbcDriverNames();
  super.okPressed();
}

Fixed version (ground truth):
/** 
 * processes after pressing ok button
 */
private void okPressedProcess(){
  Utility.setPreferenceStoredMap(JdbcPlugin.JAR_MAP_PREFERENCE_KEY,jarMap);
  Utility.setPreferenceStoredMap(JdbcPlugin.DRIVER_MAP_PREFERENCE_KEY,driverMap);
  Iterator jarsCopyIterator=jarsToBeCopied.values().iterator();
  while (jarsCopyIterator.hasNext()) {
    JarFile jar=(JarFile)jarsCopyIterator.next();
    jar.copyJarToODADir();
    Utility.removeMapEntryFromPreferenceStoredMap(JdbcPlugin.DELETED_JAR_MAP_PREFERENCE_KEY,jar.getFileName());
  }
  Iterator jarsDeleteIterator=jarsToBeDeleted.values().iterator();
  while (jarsDeleteIterator.hasNext()) {
    JarFile jar=(JarFile)jarsDeleteIterator.next();
    jar.deleteJarFromODADir();
    Utility.putPreferenceStoredMapValue(JdbcPlugin.DELETED_JAR_MAP_PREFERENCE_KEY,jar.getFileName(),jar);
  }
  refreshDriverPage();
  super.okPressed();
}
Program: 78604
Project: 78604
Buggy source:
protected void cancelPressed(){
  JdbcToolKit.resetJdbcDriverNames();
  super.cancelPressed();
}

Fixed version (ground truth):
protected void cancelPressed(){
  super.cancelPressed();
}
Program: 78605
Project: 78605
Buggy source:
/** 
 * actions of Edit Driver in Driver Page
 */
private void editDriver(){
  if (driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount()) {
    EditJdbcDriverDialog dlg=new EditJdbcDriverDialog(getShell());
    Object obj=driverViewer.getTable().getItem(driverViewer.getTable().getSelectionIndex()).getData();
    DriverInfo driverInfo=(DriverInfo)((Map.Entry)obj).getValue();
    if (obj instanceof Map.Entry) {
      dlg.setDriverClassName(((Map.Entry)obj).getKey().toString());
      dlg.setDisplayName(driverInfo.getDisplayName());
      dlg.setUrlTemplate(driverInfo.getUrlTemplate());
    }
    if (dlg.open() == Window.OK) {
      if (obj instanceof Map.Entry && (!dlg.getDisplayName().trim().equals(driverInfo.getDisplayName().trim()) || !dlg.getUrlTemplate().trim().equals(driverInfo.getUrlTemplate().trim()))) {
        driverInfo.setDisplayName(dlg.getDisplayName());
        driverInfo.setUrlTemplate(dlg.getUrlTemplate());
        driverMap.put(((Map.Entry)obj).getKey(),driverInfo);
        jarChanged=true;
      }
      refreshDriverViewer();
      updateDriverButtons();
    }
  }
}

Fixed version (ground truth):
/** 
 * actions of Edit Driver in Driver Page
 */
private void editDriver(){
  if (driverViewer.getTable().getSelectionIndex() >= 0 && driverViewer.getTable().getSelectionIndex() < driverViewer.getTable().getItemCount()) {
    EditJdbcDriverDialog dlg=new EditJdbcDriverDialog(getShell());
    Object obj=driverViewer.getTable().getItem(driverViewer.getTable().getSelectionIndex()).getData();
    DriverInfo driverInfo=(DriverInfo)((Map.Entry)obj).getValue();
    if (obj instanceof Map.Entry) {
      dlg.setDriverClassName(((Map.Entry)obj).getKey().toString());
      dlg.setDisplayName(driverInfo.getDisplayName());
      dlg.setUrlTemplate(driverInfo.getUrlTemplate());
    }
    if (dlg.open() == Window.OK) {
      if (obj instanceof Map.Entry && (!dlg.getDisplayName().trim().equals(driverInfo.getDisplayName().trim()) || !dlg.getUrlTemplate().trim().equals(driverInfo.getUrlTemplate().trim()))) {
        driverInfo.setDisplayName(dlg.getDisplayName());
        driverInfo.setUrlTemplate(dlg.getUrlTemplate());
        driverMap.put(((Map.Entry)obj).getKey(),driverInfo);
        Utility.setPreferenceStoredMap(JdbcPlugin.DRIVER_MAP_PREFERENCE_KEY,driverMap);
        driverChanged=true;
      }
      refreshDriverViewer();
      updateDriverButtons();
    }
  }
}
Program: 78607
Project: 78607
Buggy source:
protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  createToolbar(composite);
  createExpressionField(composite);
  if (provider == null) {
    provider=new ExpressionProvider();
  }
  createOperatorsBar(composite);
  createListArea(composite);
  return composite;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  createToolbar(composite);
  createExpressionField(composite);
  if (provider == null) {
    provider=new ExpressionProvider();
  }
  createOperatorsBar(composite);
  createMessageLine(composite);
  createListArea(composite);
  return composite;
}
Program: 78608
Project: 78608
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  IStructuredSelection selection=(IStructuredSelection)event.getSelection();
  if (selection.isEmpty()) {
    return;
  }
  TableViewer target=null;
  if (event.getSource() == categoryTable) {
    target=subCategoryTable;
  }
 else   if (event.getSource() == subCategoryTable) {
    target=functionTable;
  }
  if (target != null) {
    target.setInput(selection.getFirstElement());
  }
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  IStructuredSelection selection=(IStructuredSelection)event.getSelection();
  if (selection.isEmpty()) {
    return;
  }
  TableViewer target=null;
  if (event.getSource() == categoryTable) {
    target=subCategoryTable;
  }
 else   if (event.getSource() == subCategoryTable) {
    target=functionTable;
  }
  if (target != null) {
    target.setInput(selection.getFirstElement());
  }
  if (event.getSource() == functionTable) {
    Table table=functionTable.getTable();
    if (table.getSelectionCount() == 1) {
      messageLine.setText(table.getSelection()[0].getText());
    }
 else {
      messageLine.setText("String_Node_Str");
    }
  }
}
Program: 78609
Project: 78609
Buggy source:
protected void loadDesign(){
  ReportDesignHandle reportDesign=executionContext.getDesign();
  Iterator iter=reportDesign.includeScriptsIterator();
  while (iter.hasNext()) {
    String fileName=(String)iter.next();
    executionContext.loadScript(fileName);
  }
  ReportScriptExecutor.handleInitialize(reportDesign,executionContext);
}

Fixed version (ground truth):
protected void loadDesign(){
  ReportDesignHandle reportDesign=executionContext.getDesign();
  Iterator iter=reportDesign.includeScriptsIterator();
  while (iter.hasNext()) {
    IncludeScriptHandle includeScript=(IncludeScriptHandle)iter.next();
    String fileName=includeScript.getFileName();
    executionContext.loadScript(fileName);
  }
  ReportScriptExecutor.handleInitialize(reportDesign,executionContext);
}
Program: 78610
Project: 78610
Buggy source:
/** 
 * Loads scripts that are stored in an external file. Used to support include-script. Each script file should be load only once. and the script in the file must be encoded in UTF-8.
 * @param fileName script file name
 */
public void loadScript(String fileName){
  File script=new File(report.getBasePath(),fileName);
  try {
    FileInputStream in=new FileInputStream(script);
    byte[] buffer=new byte[in.available()];
    in.read(buffer);
    execute(new String(buffer,"String_Node_Str"),fileName,1);
    in.close();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str" + fileName + "String_Node_Str",ex);
    addException(new EngineException(MessageConstants.SCRIPT_FILE_LOAD_ERROR,script.getAbsolutePath(),ex));
  }
}

Fixed version (ground truth):
/** 
 * Loads scripts that are stored in an external file. Used to support include-script. Each script file should be load only once. and the script in the file must be encoded in UTF-8.
 * @param fileName script file name
 */
public void loadScript(String fileName){
  ReportDesignHandle reportDesign=this.getDesign();
  if (reportDesign != null) {
    URL url=reportDesign.findResource(fileName,IResourceLocator.LIBRARY);
    if (url != null) {
      fileName=url.getFile();
    }
  }
  File scriptFile=new File(fileName);
  try {
    FileInputStream in=new FileInputStream(scriptFile);
    ByteArrayOutputStream out=new ByteArrayOutputStream();
    byte[] buffer=new byte[1024];
    int size=in.read(buffer);
    while (size != -1) {
      out.write(buffer,0,size);
      size=in.read(buffer);
    }
    byte[] script=out.toByteArray();
    execute(new String(script,"String_Node_Str"),fileName,1);
    in.close();
  }
 catch (  IOException ex) {
    log.log(Level.SEVERE,"String_Node_Str" + fileName + "String_Node_Str",ex);
    addException(new EngineException(MessageConstants.SCRIPT_FILE_LOAD_ERROR,scriptFile.getAbsolutePath(),ex));
  }
}
Program: 78611
Project: 78611
Buggy source:
/** 
 * The same behavior as RandomAccessFile.readInt(). <br> Reads a signed 32-bit integer from this file. This method reads 4  bytes from the file, starting at the current file pointer.  If the bytes read, in order, are <code>b1</code>, <code>b2</code>, <code>b3</code>, and <code>b4</code>, where  <code>0&nbsp;&lt;=&nbsp;b1, b2, b3, b4&nbsp;&lt;=&nbsp;255</code>,  then the result is equal to: <blockquote><pre> (b1 &lt;&lt; 24) | (b2 &lt;&lt; 16) + (b3 &lt;&lt; 8) + b4 </pre></blockquote> <p> This method blocks until the four bytes are read, the end of the  stream is detected, or an exception is thrown. 
 * @return     the next four bytes of this stream, interpreted as an<code>int</code>.
 * @exception EOFException  if this stream reaches the end before readingfour bytes.
 * @exception IOException   if an I/O error occurs.
 */
public int readInt() throws IOException {
  int ch1=this.read();
  int ch2=this.read();
  int ch3=this.read();
  int ch4=this.read();
  if ((ch1 | ch2 | ch3| ch4) < 0)   throw new EOFException();
  return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8)+ (ch4 << 0));
}

Fixed version (ground truth):
/** 
 * The same behavior as RandomAccessFile.readInt(). <br> Reads a signed 32-bit integer from this file. This method reads 4  bytes from the file, starting at the current file pointer.  If the bytes read, in order, are <code>b1</code>, <code>b2</code>, <code>b3</code>, and <code>b4</code>, where  <code>0&nbsp;&lt;=&nbsp;b1, b2, b3, b4&nbsp;&lt;=&nbsp;255</code>,  then the result is equal to: <blockquote><pre> (b1 &lt;&lt; 24) | (b2 &lt;&lt; 16) + (b3 &lt;&lt; 8) + b4 </pre></blockquote> <p> This method blocks until the four bytes are read, the end of the  stream is detected, or an exception is thrown. 
 * @return     the next four bytes of this stream, interpreted as an<code>int</code>.
 * @exception EOFException  if this stream reaches the end before readingfour bytes.
 * @exception IOException   if an I/O error occurs.
 */
public int readInt() throws IOException {
  byte ch[]=new byte[4];
  this.readFully(ch,0,4);
  int ret=0;
  for (int i=0; i < ch.length; i++)   ret=((ret << 8) & 0xFFFFFF00) | (ch[i] & 0x000000FF);
  return ret;
}
Program: 78612
Project: 78612
Buggy source:
public void widgetSelected(SelectionEvent e){
  intervalRange.setEnabled(intervalType.getSelectionIndex() != 0);
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  intervalBaseText.setEnabled(intervalBaseButton.getSelection());
}
Program: 78614
Project: 78614
Buggy source:
protected boolean initDialog(){
  if (inputGroup.getName() != null) {
    nameEditor.setText(inputGroup.getName());
  }
  columnList=DataSetManager.getCurrentInstance().getColumns(dataSetList);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((DataSetItemModel)itor.next()).getDisplayName());
  }
  setKeyExpression(inputGroup.getKeyExpr());
  int index=getIntervalTypeIndex(inputGroup.getInterval());
  intervalType.select(index);
  if (index == 0) {
    intervalRange.setEnabled(false);
  }
 else {
    intervalRange.setSelection(inputGroup.getIntervalRange());
  }
  if (inputGroup instanceof TableGroupHandle) {
    includeHeader.setSelection(inputGroup.hasHeader());
    includeFooter.setSelection(inputGroup.hasFooter());
  }
 else {
    includeHeader.setSelection(false);
    includeFooter.setSelection(false);
  }
  if (DesignChoiceConstants.SORT_DIRECTION_ASC.equals(inputGroup.getSortDirection())) {
    ascending.setSelection(true);
  }
 else {
    descending.setSelection(true);
  }
  List list=new ArrayList(1);
  list.add(inputGroup);
  tocEditor.setText(UIUtil.convertToGUIString(inputGroup.getTocExpression()));
  return true;
}

Fixed version (ground truth):
protected boolean initDialog(){
  if (inputGroup.getName() != null) {
    nameEditor.setText(inputGroup.getName());
  }
  columnList=DataSetManager.getCurrentInstance().getColumns(dataSetList);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((DataSetItemModel)itor.next()).getDisplayName());
  }
  setKeyExpression(inputGroup.getKeyExpr());
  int index=getIntervalTypeIndex(inputGroup.getInterval());
  intervalType.select(index);
  if (index == 0) {
    intervalRange.setEnabled(false);
    intervalBaseButton.setEnabled(false);
    intervalBaseText.setEnabled(false);
  }
 else {
    intervalRange.setSelection(inputGroup.getIntervalRange());
    intervalBaseButton.setSelection(inputGroup.getIntervalBase() != null);
    intervalBaseText.setEnabled(intervalBaseButton.getSelection());
    if (inputGroup.getIntervalBase() != null) {
      intervalBaseText.setText(inputGroup.getIntervalBase());
    }
  }
  if (inputGroup instanceof TableGroupHandle) {
    includeHeader.setSelection(inputGroup.hasHeader());
    includeFooter.setSelection(inputGroup.hasFooter());
  }
 else {
    includeHeader.setSelection(false);
    includeFooter.setSelection(false);
  }
  if (DesignChoiceConstants.SORT_DIRECTION_ASC.equals(inputGroup.getSortDirection())) {
    ascending.setSelection(true);
  }
 else {
    descending.setSelection(true);
  }
  List list=new ArrayList(1);
  list.add(inputGroup);
  tocEditor.setText(UIUtil.convertToGUIString(inputGroup.getTocExpression()));
  return true;
}
Program: 78616
Project: 78616
Buggy source:
/** 
 * @param pageNumber
 * @throws EngineException
 */
public abstract void render(long pageNumber) throws EngineException ;

Fixed version (ground truth):
/** 
 * Render the page from startPageNumber to endPageNumber in the Report Doucment to an output format.
 * @throws EngineException
 */
public abstract void render(String pageRange) throws EngineException ;
Program: 78617
Project: 78617
Buggy source:
/** 
 * @param pageNumber the page to be rendered
 * @throws EngineException throws exception if there is a rendering error
 */
protected void doRender(long pageNumber) throws EngineException {
  try {
    ReportContentLoader loader=new ReportContentLoader(executionContext);
    ReportExecutor executor=new ReportExecutor(executionContext);
    executionContext.setExecutor(executor);
    IContentEmitter emitter=createContentEmitter(executor);
    startRender();
    loader.loadPage(pageNumber,emitter);
    closeRender();
  }
 catch (  Exception ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
}

Fixed version (ground truth):
/** 
 * @param pageNumber the page to be rendered
 * @throws EngineException throws exception if there is a rendering error
 */
protected void doRender(List pageSequences) throws EngineException {
  if (pageSequences.size() == 0) {
    return;
  }
  try {
    ReportContentLoader loader=new ReportContentLoader(executionContext);
    ReportExecutor executor=new ReportExecutor(executionContext);
    executionContext.setExecutor(executor);
    IContentEmitter emitter=createContentEmitter(executor);
    startRender();
    loader.loadPageRange(pageSequences,emitter);
    closeRender();
  }
 catch (  Exception ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
}
Program: 78618
Project: 78618
Buggy source:
public void render(long pageNumber) throws EngineException {
  long totalPage=reportDoc.getPageCount();
  if (pageNumber <= 0 || pageNumber > totalPage) {
    throw new EngineException("String_Node_Str",new Long(pageNumber));
  }
  if (renderOptions == null) {
    throw new EngineException("String_Node_Str");
  }
  doRender(pageNumber);
}

Fixed version (ground truth):
public void render(String pageRange) throws EngineException {
  long totalPage=reportDoc.getPageCount();
  if (renderOptions == null) {
    throw new EngineException("String_Node_Str");
  }
  List ps=parsePageSequence(pageRange,totalPage);
  doRender(ps);
}
Program: 78620
Project: 78620
Buggy source:
public void run() throws EngineException {
  ReportDesignHandle reportDesign=executionContext.getDesign();
  if (!validateParameters()) {
    throw new EngineException(MessageConstants.INVALID_PARAMETER_EXCEPTION);
  }
  loadDesign();
  prepareDesign();
  startFactory();
  startRender();
  try {
    ReportExecutor executor=new ReportExecutor(executionContext);
    executionContext.setExecutor(executor);
    IContentEmitter emitter=createContentEmitter(executor);
    executor.execute(reportDesign,emitter);
    closeRender();
    closeFactory();
  }
 catch (  Exception ex) {
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException("String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",t);
    new EngineException("String_Node_Str",t);
  }
}

Fixed version (ground truth):
public void run() throws EngineException {
  ReportDesignHandle reportDesign=executionContext.getDesign();
  if (!validateParameters()) {
    throw new EngineException(MessageConstants.INVALID_PARAMETER_EXCEPTION);
  }
  loadDesign();
  prepareDesign();
  startFactory();
  startRender();
  try {
    ReportExecutor executor=new ReportExecutor(executionContext);
    executionContext.setExecutor(executor);
    IContentEmitter emitter=createContentEmitter(executor);
    executor.execute(reportDesign,emitter);
    closeRender();
    closeFactory();
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    log.log(Level.SEVERE,"String_Node_Str",ex);
    throw new EngineException("String_Node_Str",ex);
  }
catch (  OutOfMemoryError err) {
    err.printStackTrace();
    log.log(Level.SEVERE,"String_Node_Str");
    throw err;
  }
catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",t);
    new EngineException("String_Node_Str",t);
  }
}
Program: 78621
Project: 78621
Buggy source:
/** 
 * Return the value of the i:th expression in the current row. Null will be return if the i:th expression doesn't exist.
 */
public Object getExpressionValue(int i);

Fixed version (ground truth):
/** 
 * Return the value of the i:th expression in the current row. Null will be return if the i:th expression doesn't exist.
 * @throws ScriptException 
 */
public Object getExpressionValue(int i) throws ScriptException ;
Program: 78622
Project: 78622
Buggy source:
public void onCreate(ICellInstance cellInstance,IRowData rowData,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(ICellInstance cellInstance,IReportContext reportContext){
}
Program: 78623
Project: 78623
Buggy source:
public void onCreate(IRowInstance rowInstance,IRowData rowData,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IRowInstance rowInstance,IReportContext reportContext){
}
Program: 78624
Project: 78624
Buggy source:
/** 
 * Handle the onCreate event
 */
void onCreate(ICellInstance cellInstance,IRowData rowData,IReportContext reportContext);

Fixed version (ground truth):
/** 
 * Handle the onCreate event
 */
void onCreate(ICellInstance cellInstance,IReportContext reportContext);
Program: 78625
Project: 78625
Buggy source:
/** 
 * Handle the onCreate event
 */
void onCreate(IRowInstance rowInstance,IRowData rowData,IReportContext reportContext);

Fixed version (ground truth):
/** 
 * Handle the onCreate event
 */
void onCreate(IRowInstance rowInstance,IReportContext reportContext);
Program: 78626
Project: 78626
Buggy source:
private ModuleHandle getReportDesignHandle(){
  return SessionHandleAdapter.getInstance().getReportDesignHandle();
}

Fixed version (ground truth):
private ModuleHandle getReportDesignHandle(){
  if (handle == null) {
    handle=SessionHandleAdapter.getInstance().getReportDesignHandle();
  }
  return handle;
}
Program: 78627
Project: 78627
Buggy source:
private GraphicalViewer createRulerContainer(int orientation){
  ScrollingGraphicalViewer viewer=new RulerViewer();
  final boolean isHorizontal=orientation == PositionConstants.NORTH || orientation == PositionConstants.SOUTH;
  viewer.setRootEditPart(new EditorRulerRootEditPart(isHorizontal));
  viewer.setEditPartFactory(new EditorRulerEditPartFactory(diagramViewer));
  viewer.createControl(this);
  ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().setBorder(new RulerBorder(isHorizontal));
  viewer.setProperty(GraphicalViewer.class.toString(),diagramViewer);
  FigureCanvas canvas=(FigureCanvas)viewer.getControl();
  canvas.setScrollBarVisibility(FigureCanvas.NEVER);
  if (font == null) {
    FontData[] data=canvas.getFont().getFontData();
    for (int i=0; i < data.length; i++) {
      data[i].setHeight(data[i].getHeight() - 1);
    }
    font=new Font(Display.getCurrent(),data);
  }
  canvas.setFont(font);
  if (isHorizontal) {
    canvas.getViewport().setHorizontalRangeModel(editor.getViewport().getHorizontalRangeModel());
  }
 else {
    canvas.getViewport().setVerticalRangeModel(editor.getViewport().getVerticalRangeModel());
  }
  if (rulerEditDomain == null) {
    rulerEditDomain=new EditDomain();
    rulerEditDomain.setCommandStack(diagramViewer.getEditDomain().getCommandStack());
  }
  rulerEditDomain.addViewer(viewer);
  return viewer;
}

Fixed version (ground truth):
private GraphicalViewer createRulerContainer(int orientation){
  ScrollingGraphicalViewer viewer=new RulerViewer();
  final boolean isHorizontal=orientation == PositionConstants.NORTH || orientation == PositionConstants.SOUTH;
  viewer.setRootEditPart(new EditorRulerRootEditPart(isHorizontal));
  viewer.setEditPartFactory(new EditorRulerEditPartFactory(diagramViewer));
  viewer.createControl(this);
  ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().setBorder(new RulerBorder(isHorizontal));
  viewer.setProperty(GraphicalViewer.class.toString(),diagramViewer);
  FigureCanvas canvas=(FigureCanvas)viewer.getControl();
  canvas.setScrollBarVisibility(FigureCanvas.NEVER);
  if (font == null) {
    FontData[] data=canvas.getFont().getFontData();
    for (int i=0; i < data.length; i++) {
      data[i].setHeight(data[i].getHeight() - 1);
    }
    font=new Font(Display.getCurrent(),data);
  }
  canvas.setFont(font);
  if (isHorizontal) {
    canvas.getViewport().setHorizontalRangeModel(new RulerDefaultRangeModel(editor.getViewport().getHorizontalRangeModel()));
  }
 else {
    canvas.getViewport().setVerticalRangeModel(new RulerDefaultRangeModel(editor.getViewport().getVerticalRangeModel()));
  }
  if (rulerEditDomain == null) {
    rulerEditDomain=new EditDomain();
    rulerEditDomain.setCommandStack(diagramViewer.getEditDomain().getCommandStack());
  }
  rulerEditDomain.addViewer(viewer);
  return viewer;
}
Program: 78628
Project: 78628
Buggy source:
/** 
 * Constructor
 */
public RulerViewer(){
  super();
  init();
}

Fixed version (ground truth):
/** 
 * Constructor
 */
public RulerViewer(){
  super();
}
Program: 78629
Project: 78629
Buggy source:
private void disposeRulerViewer(GraphicalViewer viewer){
  if (viewer == null)   return;
  RangeModel rModel=new DefaultRangeModel();
  Viewport port=((FigureCanvas)viewer.getControl()).getViewport();
  port.setHorizontalRangeModel(rModel);
  port.setVerticalRangeModel(rModel);
  rulerEditDomain.removeViewer(viewer);
  viewer.getControl().dispose();
}

Fixed version (ground truth):
private void disposeRulerViewer(GraphicalViewer viewer){
  if (viewer == null)   return;
  RangeModel rModel=new DefaultRangeModel();
  Viewport port=((FigureCanvas)viewer.getControl()).getViewport();
  port.setHorizontalRangeModel(new RulerDefaultRangeModel(rModel));
  port.setVerticalRangeModel(new RulerDefaultRangeModel(rModel));
  rulerEditDomain.removeViewer(viewer);
  viewer.getControl().dispose();
}
Program: 78630
Project: 78630
Buggy source:
private void disposeResources(){
  if (diagramViewer != null)   diagramViewer.removePropertyChangeListener(propertyListener);
  getZoomManager().removeZoomListener(zoomListener);
  if (font != null)   font.dispose();
  if (getReportDesignHandle() != null) {
    getReportDesignHandle().removeListener(designListener);
  }
  if (getMasterPageHandle() != null) {
    getMasterPageHandle().removeListener(designListener);
  }
}

Fixed version (ground truth):
private void disposeResources(){
  left=null;
  top=null;
  editor=null;
  if (diagramViewer != null) {
    diagramViewer.removePropertyChangeListener(propertyListener);
    diagramViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER,null);
    diagramViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER,null);
  }
  getZoomManager().removeZoomListener(zoomListener);
  if (font != null)   font.dispose();
  if (getReportDesignHandle() != null) {
    getReportDesignHandle().removeListener(designListener);
  }
  if (getMasterPageHandle() != null) {
    getMasterPageHandle().removeListener(designListener);
  }
  rulerEditDomain=null;
}
Program: 78631
Project: 78631
Buggy source:
private MasterPageHandle getMasterPageHandle(){
  return SessionHandleAdapter.getInstance().getMasterPageHandle();
}

Fixed version (ground truth):
private MasterPageHandle getMasterPageHandle(){
  return SessionHandleAdapter.getInstance().getMasterPageHandle(getReportDesignHandle());
}
Program: 78632
Project: 78632
Buggy source:
/** 
 * visit content of a row
 */
protected void handleRow(RowDesign row,Object value){
  if (row.getVisibility() != null) {
    for (int i=0; i < row.getVisibility().count(); i++)     addExpression(row.getVisibility().getRule(i).getExpression());
  }
  addExpression(row.getBookmark());
  for (int i=0; i < row.getCellCount(); i++) {
    CellDesign cell=row.getCell(i);
    if (cell != null) {
      handleCell(cell,value);
    }
  }
}

Fixed version (ground truth):
/** 
 * visit content of a row
 */
protected void handleRow(RowDesign row,Object value){
  if (row.getVisibility() != null) {
    for (int i=0; i < row.getVisibility().count(); i++)     addExpression(row.getVisibility().getRule(i).getExpression());
  }
  addExpression(row.getTOC());
  addExpression(row.getBookmark());
  for (int i=0; i < row.getCellCount(); i++) {
    CellDesign cell=row.getCell(i);
    if (cell != null) {
      handleCell(cell,value);
    }
  }
}
Program: 78633
Project: 78633
Buggy source:
/** 
 * create a table group using the DE's TableGroup.
 * @param handle De's table group
 * @return engine's table group
 */
public void visitTableGroup(TableGroupHandle handle){
  TableGroupDesign tableGroup=new TableGroupDesign();
  setupGroup(tableGroup,handle);
  TableBandDesign header=createTableBand(handle.getHeader());
  tableGroup.setHeader(header);
  TableBandDesign footer=createTableBand(handle.getFooter());
  tableGroup.setFooter(footer);
  currentElement=tableGroup;
}

Fixed version (ground truth):
/** 
 * create a table group using the DE's TableGroup.
 * @param handle De's table group
 * @return engine's table group
 */
public void visitTableGroup(TableGroupHandle handle){
  TableGroupDesign tableGroup=new TableGroupDesign();
  setupGroup(tableGroup,handle);
  TableBandDesign header=createTableBand(handle.getHeader());
  tableGroup.setHeader(header);
  String toc=handle.getTocExpression();
  if (null != toc && !"String_Node_Str".equals(toc)) {
    if (header.getRowCount() > 0) {
      RowDesign row=header.getRow(0);
      row.setTOC(new Expression(toc));
    }
  }
  TableBandDesign footer=createTableBand(handle.getFooter());
  tableGroup.setFooter(footer);
  currentElement=tableGroup;
}
Program: 78634
Project: 78634
Buggy source:
/** 
 * create a list group using the DE's ListGroup.
 * @param handle De's list group
 * @return engine's list group
 */
public void visitListGroup(ListGroupHandle handle){
  ListGroupDesign listGroup=new ListGroupDesign();
  setupGroup(listGroup,handle);
  ListBandDesign header=createListBand(handle.getHeader());
  listGroup.setHeader(header);
  ListBandDesign footer=createListBand(handle.getFooter());
  listGroup.setFooter(footer);
  currentElement=listGroup;
}

Fixed version (ground truth):
/** 
 * create a list group using the DE's ListGroup.
 * @param handle De's list group
 * @return engine's list group
 */
public void visitListGroup(ListGroupHandle handle){
  ListGroupDesign listGroup=new ListGroupDesign();
  setupGroup(listGroup,handle);
  ListBandDesign header=createListBand(handle.getHeader());
  listGroup.setHeader(header);
  String tocExpr=handle.getTocExpression();
  if (null != tocExpr && !"String_Node_Str".equals(tocExpr)) {
    if (header.getContentCount() > 0) {
      ReportItemDesign item=(ReportItemDesign)header.getContent(0);
      item.setTOC(new Expression(tocExpr));
    }
  }
  ListBandDesign footer=createListBand(handle.getFooter());
  listGroup.setFooter(footer);
  currentElement=listGroup;
}
Program: 78635
Project: 78635
Buggy source:
public void elementChanged(DesignElementHandle element,NotificationEvent ev){
switch (ev.getEventType()) {
case NotificationEvent.CONTENT_EVENT:
case NotificationEvent.ELEMENT_DELETE_EVENT:
case NotificationEvent.PROPERTY_EVENT:
case NotificationEvent.STYLE_EVENT:
{
      markDirty(true);
      refresh();
      for (Iterator it=getChildren().iterator(); it.hasNext(); ) {
        ((AbstractEditPart)it.next()).refresh();
      }
    }
}
}

Fixed version (ground truth):
public void elementChanged(DesignElementHandle element,NotificationEvent ev){
switch (ev.getEventType()) {
case NotificationEvent.CONTENT_EVENT:
case NotificationEvent.ELEMENT_DELETE_EVENT:
case NotificationEvent.PROPERTY_EVENT:
case NotificationEvent.STYLE_EVENT:
case NotificationEvent.THEME_EVENT:
case NotificationEvent.TEMPLATE_TRANSFORM_EVENT:
{
      markDirty(true);
      refresh();
      for (Iterator it=getChildren().iterator(); it.hasNext(); ) {
        ((AbstractEditPart)it.next()).refresh();
      }
    }
}
}
Program: 78636
Project: 78636
Buggy source:
private void populateColumnsMap(){
  if (resultMeta == null)   return;
  for (int i=0; i < selectedColumns.length; i++) {
    for (int j=1; j <= resultMeta.getColumnCount(); j++) {
      try {
        String colName=resultMeta.getColumnName(j);
        String newColName="String_Node_Str" + colName + "String_Node_Str";
        if (selectedColumns[i].equalsIgnoreCase(newColName)) {
          if (columnsMap == null)           columnsMap=new HashMap();
          columnsMap.put(new Integer(i),new Integer(j));
        }
      }
 catch (      BirtException be) {
        be.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
private void populateColumnsMap(){
  if (resultMeta == null)   return;
  for (int i=0; i < selectedColumns.length; i++) {
    for (int j=1; j <= resultMeta.getColumnCount(); j++) {
      try {
        String colName=resultMeta.getColumnName(j);
        if (colName.matches("String_Node_Str")) {
          colName=colName.replaceAll("String_Node_Str","String_Node_Str");
        }
        String newColName="String_Node_Str" + colName + "String_Node_Str";
        if (selectedColumns[i].equalsIgnoreCase(newColName)) {
          if (columnsMap == null)           columnsMap=new HashMap();
          columnsMap.put(new Integer(i),new Integer(j));
          break;
        }
      }
 catch (      BirtException be) {
        be.printStackTrace();
      }
    }
  }
}
Program: 78637
Project: 78637
Buggy source:
public void setExtensionProperty(String name,String value){
  Map m=dataSet.getPublicProperties();
  if (m == null)   return;
  Set s=(Set)m.get(name);
  if (s == null)   s=new HashSet();
  s.add(value);
  m.put(name,value);
}

Fixed version (ground truth):
public void setExtensionProperty(String name,String value){
  Map m=dataSet.getPublicProperties();
  if (m == null)   return;
  Set s=(Set)m.get(name);
  if (s == null)   s=new HashSet();
  s.add(value);
  m.put(name,s);
}
Program: 78639
Project: 78639
Buggy source:
protected boolean initDialog(){
  if (inputGroup.getName() != null) {
    nameEditor.setText(inputGroup.getName());
  }
  columnList=DataSetManager.getCurrentInstance().getColumns(dataSetList);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((DataSetItemModel)itor.next()).getDisplayName());
  }
  String groupKey=inputGroup.getKeyExpr();
  int index=-1;
  if (groupKey != null) {
    for (int i=0; i < columnList.size(); i++) {
      if (groupKey.equals(DEUtil.getExpression(columnList.get(i)))) {
        index=i;
        break;
      }
    }
    if (index != -1) {
      keyChooser.select(index);
    }
  }
  index=getIntervalTypeIndex(inputGroup.getInterval());
  intervalType.select(index);
  if (index == 0) {
    intervalRange.setEnabled(false);
  }
 else {
    intervalRange.setSelection(inputGroup.getIntervalRange());
  }
  if (inputGroup instanceof TableGroupHandle) {
    includeHeader.setSelection(inputGroup.hasHeader());
    includeFooter.setSelection(inputGroup.hasFooter());
  }
 else {
    includeHeader.setSelection(false);
    includeFooter.setSelection(false);
  }
  if (DesignChoiceConstants.SORT_DIRECTION_ASC.equals(inputGroup.getSortDirection())) {
    ascending.setSelection(true);
  }
 else {
    descending.setSelection(true);
  }
  List list=new ArrayList(1);
  list.add(inputGroup);
  tocEditor.setText(UIUtil.convertToGUIString(inputGroup.getTocExpression()));
  return true;
}

Fixed version (ground truth):
protected boolean initDialog(){
  if (inputGroup.getName() != null) {
    nameEditor.setText(inputGroup.getName());
  }
  columnList=DataSetManager.getCurrentInstance().getColumns(dataSetList);
  Iterator itor=columnList.iterator();
  while (itor.hasNext()) {
    keyChooser.add(((DataSetItemModel)itor.next()).getDisplayName());
  }
  setKeyExpression(inputGroup.getKeyExpr());
  int index=getIntervalTypeIndex(inputGroup.getInterval());
  intervalType.select(index);
  if (index == 0) {
    intervalRange.setEnabled(false);
  }
 else {
    intervalRange.setSelection(inputGroup.getIntervalRange());
  }
  if (inputGroup instanceof TableGroupHandle) {
    includeHeader.setSelection(inputGroup.hasHeader());
    includeFooter.setSelection(inputGroup.hasFooter());
  }
 else {
    includeHeader.setSelection(false);
    includeFooter.setSelection(false);
  }
  if (DesignChoiceConstants.SORT_DIRECTION_ASC.equals(inputGroup.getSortDirection())) {
    ascending.setSelection(true);
  }
 else {
    descending.setSelection(true);
  }
  List list=new ArrayList(1);
  list.add(inputGroup);
  tocEditor.setText(UIUtil.convertToGUIString(inputGroup.getTocExpression()));
  return true;
}
Program: 78641
Project: 78641
Buggy source:
protected Request insertElement() throws Exception {
  Request request=new Request(IRequestConstants.REQUEST_TYPE_INSERT);
  Map extendsData=new HashMap();
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_SLOT,slotHandle);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_TYPE,insertType);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_POSITION,InsertAction.BELOW);
  request.setExtendedData(extendsData);
  ProviderFactory.createProvider(slotHandle.getElementHandle()).performRequest(model,request);
  return request;
}

Fixed version (ground truth):
protected Request insertElement() throws Exception {
  Request request=new Request(IRequestConstants.REQUEST_TYPE_INSERT);
  Map extendsData=new HashMap();
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_SLOT,slotHandle);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_TYPE,insertType);
  extendsData.put(IRequestConstants.REQUEST_KEY_INSERT_POSITION,InsertAction.BELOW);
  request.setExtendedData(extendsData);
  if (ProviderFactory.createProvider(slotHandle.getElementHandle()).performRequest(model,request)) {
    return request;
  }
  return null;
}
Program: 78642
Project: 78642
Buggy source:
public void run(){
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
  stack.startTrans(STACK_MSG_INSERT_ELEMENT);
  try {
    final Request req=insertElement();
    stack.commit();
    selectElement(req.getExtendedData().get(IRequestConstants.REQUEST_KEY_RESULT),true);
  }
 catch (  Exception e) {
    stack.rollbackAll();
    ExceptionHandler.handle(e);
  }
}

Fixed version (ground truth):
public void run(){
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
  stack.startTrans(STACK_MSG_INSERT_ELEMENT);
  try {
    final Request req=insertElement();
    if (req != null) {
      stack.commit();
      selectElement(req.getExtendedData().get(IRequestConstants.REQUEST_KEY_RESULT),true);
      return;
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
  }
  stack.rollback();
}
Program: 78645
Project: 78645
Buggy source:
public boolean isEnabled(){
  if (getSelectedElement() == null) {
    return false;
  }
  return super.isEnabled() && ((getSelectedElement() instanceof TemplateReportItemHandle && ((TemplateReportItemHandle)getSelectedElement()).canTransformToTemplate()) || (getSelectedElement().isTemplateParameterValue()));
}

Fixed version (ground truth):
public boolean isEnabled(){
  if (getSelectedElement() == null) {
    return false;
  }
  return super.isEnabled() && (getSelectedElement().isTemplateParameterValue());
}
Program: 78646
Project: 78646
Buggy source:
protected boolean doAction() throws Exception {
  if (getSelectedElement() == null) {
    return false;
  }
  if (getSelectedElement() instanceof TemplateReportItemHandle && ((TemplateReportItemHandle)getSelectedElement()).canTransformToTemplate()) {
    return ProviderFactory.createProvider(getSelectedElement()).performRequest(getSelectedElement(),new Request(IRequestConstants.REQUEST_TRANSFER_PLACEHOLDER));
  }
 else   if (getSelectedElement().isTemplateParameterValue()) {
    return ProviderFactory.createProvider(getSelectedElement()).performRequest(getSelectedElement(),new Request(IRequestConstants.REQUST_REVERT_TO_REPORTITEM));
  }
  return false;
}

Fixed version (ground truth):
protected boolean doAction() throws Exception {
  if (getSelectedElement() == null) {
    return false;
  }
  if (getSelectedElement().isTemplateParameterValue()) {
    if (getSelectedElement() instanceof TemplateReportItemHandle) {
      return ProviderFactory.createProvider(getSelectedElement()).performRequest(getSelectedElement(),new Request(IRequestConstants.REQUEST_TRANSFER_PLACEHOLDER));
    }
    return ProviderFactory.createProvider(getSelectedElement()).performRequest(getSelectedElement(),new Request(IRequestConstants.REQUST_REVERT_TO_REPORTITEM));
  }
  return false;
}
Program: 78647
Project: 78647
Buggy source:
public boolean performFinish(){
  String templateFolderPath=ReportPlugin.getDefault().getTemplatePreference();
  String filePath=SessionHandleAdapter.getInstance().getReportDesignHandle().getFileName();
  String fileName=filePath.substring(filePath.lastIndexOf(File.separator));
  String targetPath=templateFolderPath + fileName;
  int overwrite=0;
  try {
    if (new File(targetPath).exists()) {
      String[] buttons=new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL,IDialogConstants.CANCEL_LABEL};
      String question=Messages.getFormattedString("String_Node_Str",new Object[]{targetPath});
      MessageDialog d=new MessageDialog(getShell(),Messages.getString("String_Node_Str"),null,question,MessageDialog.QUESTION,buttons,0);
      overwrite=d.open();
    }
    if (overwrite == 0) {
      copyFile(filePath,templateFolderPath + fileName);
    }
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
  try {
    setDesignFile(templateFolderPath + fileName);
  }
 catch (  DesignFileException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  IOException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return overwrite != 1;
}

Fixed version (ground truth):
public boolean performFinish(){
  String templateFolderPath=ReportPlugin.getDefault().getTemplatePreference();
  String filePath=SessionHandleAdapter.getInstance().getReportDesignHandle().getFileName();
  String fileName=filePath.substring(filePath.lastIndexOf(File.separator));
  String targetPath=templateFolderPath + fileName;
  if (ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(targetPath)) != null) {
    ExceptionHandler.openErrorMessageBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    return true;
  }
  int overwrite=0;
  try {
    if (new File(targetPath).exists()) {
      String[] buttons=new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL,IDialogConstants.CANCEL_LABEL};
      String question=Messages.getFormattedString("String_Node_Str",new Object[]{targetPath});
      MessageDialog d=new MessageDialog(getShell(),Messages.getString("String_Node_Str"),null,question,MessageDialog.QUESTION,buttons,0);
      overwrite=d.open();
    }
    if (overwrite == 0) {
      copyFile(filePath,templateFolderPath + fileName);
    }
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
  try {
    setDesignFile(templateFolderPath + fileName);
  }
 catch (  DesignFileException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  IOException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return overwrite != 1;
}
Program: 78648
Project: 78648
Buggy source:
/** 
 * get the report design handle
 * @return report design object.
 */
public Object getDesign(){
  return scriptContext.eval("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * get the report design handle
 * @return report design object.
 */
public IReportDesign getDesign(){
  Object design=scriptContext.eval("String_Node_Str");
  if (design instanceof IReportDesign) {
    return (IReportDesign)design;
  }
  return null;
}
Program: 78649
Project: 78649
Buggy source:
/** 
 * returns the metadata corresponding to the data stored in the report document, for the specific extraction level, i.e., report, daat set, report item, or report item instance levels. To get the metadata for the extracted data, use the getResultMetaData method from the IDataIterator interface.
 * @return a List of IResultMetaData. The list usually has one result setmeta data, but could have more if data extraction is based on the whole report
 */
public List getMetaData();

Fixed version (ground truth):
/** 
 * returns the metadata corresponding to the data stored in the report document, for the specific extraction level, i.e., report, daat set, report item, or report item instance levels. To get the metadata for the extracted data, use the getResultMetaData method from the IDataIterator interface.
 * @return a List of IResultMetaData. The list usually has one result setmeta data, but could have more if data extraction is based on the whole report
 */
public List getMetaData() throws EngineException ;
Program: 78650
Project: 78650
Buggy source:
public List getMetaData(){
  if (resultMetaList == null) {
    resultMetaList=new ArrayList();
    ResultMetaData metaData=null;
    if (selectedColumns == null && instanceId != null) {
      try {
        currentResult=extract();
        resultMetaList.add(currentResult.getResultMetaData());
      }
 catch (      BirtException e) {
        e.printStackTrace();
      }
    }
    if (selectedColumns == null) {
      return null;
    }
 else {
      metaData=new ResultMetaData(null,selectedColumns);
      resultMetaList.add(metaData);
    }
  }
  return resultMetaList;
}

Fixed version (ground truth):
public List getMetaData() throws EngineException {
  if (resultMetaList == null) {
    resultMetaList=new ArrayList();
    ResultMetaData metaData=null;
    if (selectedColumns == null && instanceId != null) {
      currentResult=extract();
      try {
        resultMetaList.add(currentResult.getResultMetaData());
      }
 catch (      BirtException be) {
        be.printStackTrace();
      }
    }
    if (selectedColumns == null) {
      return null;
    }
 else {
      metaData=new ResultMetaData(null,selectedColumns);
      resultMetaList.add(metaData);
    }
  }
  return resultMetaList;
}
Program: 78651
Project: 78651
Buggy source:
/** 
 * Gets the first MasterPageHandle
 */
public MasterPageHandle getMasterPageHandle(){
  SlotHandle slotHandle=getReportDesignHandle().getMasterPages();
  Iterator iter=slotHandle.iterator();
  return (MasterPageHandle)iter.next();
}

Fixed version (ground truth):
/** 
 * Gets the first MasterPageHandle
 * @param handle
 * @return
 */
public MasterPageHandle getMasterPageHandle(ModuleHandle handle){
  SlotHandle slotHandle=handle.getMasterPages();
  Iterator iter=slotHandle.iterator();
  return (MasterPageHandle)iter.next();
}
Program: 78652
Project: 78652
Buggy source:
public boolean performFinish(){
  String templateFolderPath=ReportPlugin.getDefault().getTemplatePreference();
  String filePath=SessionHandleAdapter.getInstance().getReportDesignHandle().getFileName();
  String fileName=filePath.substring(filePath.lastIndexOf(File.separator));
  try {
    copyFile(filePath,templateFolderPath + fileName);
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
  try {
    setDesignFile(templateFolderPath + fileName);
  }
 catch (  DesignFileException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  IOException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean performFinish(){
  String templateFolderPath=ReportPlugin.getDefault().getTemplatePreference();
  String filePath=SessionHandleAdapter.getInstance().getReportDesignHandle().getFileName();
  String fileName=filePath.substring(filePath.lastIndexOf(File.separator));
  String targetPath=templateFolderPath + fileName;
  int overwrite=0;
  try {
    if (new File(targetPath).exists()) {
      String[] buttons=new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL,IDialogConstants.CANCEL_LABEL};
      String question=Messages.getFormattedString("String_Node_Str",new Object[]{targetPath});
      MessageDialog d=new MessageDialog(getShell(),Messages.getString("String_Node_Str"),null,question,MessageDialog.QUESTION,buttons,0);
      overwrite=d.open();
    }
    if (overwrite == 0) {
      copyFile(filePath,templateFolderPath + fileName);
    }
  }
 catch (  IOException e) {
    ExceptionHandler.handle(e);
  }
  try {
    setDesignFile(templateFolderPath + fileName);
  }
 catch (  DesignFileException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
catch (  IOException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return overwrite != 1;
}