Program: 73638
Project: 73638
Buggy source:
public int open(final ExtendedItemHandle eih){
  if (iInstanceCount > 0) {
    return Window.CANCEL;
  }
  iInstanceCount++;
  DesignElementHandle hostChart=eih.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
  if (hostChart instanceof ExtendedItemHandle) {
    this.extendedHandle=(ExtendedItemHandle)hostChart;
  }
 else {
    this.extendedHandle=eih;
  }
  try {
    IReportItem item=null;
    try {
      item=extendedHandle.getReportItem();
      if (item == null) {
        extendedHandle.loadExtendedElement();
        item=extendedHandle.getReportItem();
      }
    }
 catch (    ExtendedElementException exception) {
      logger.log(exception);
    }
    if (item == null) {
      logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
      return Window.CANCEL;
    }
    final CommandStack commandStack=extendedHandle.getRoot().getCommandStack();
    final String TRANS_NAME="String_Node_Str";
    commandStack.startTrans(TRANS_NAME);
    final ChartReportItemImpl crii=((ChartReportItemImpl)item);
    final Chart cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    final Chart cmClone=(cm == null) ? null : (Chart)EcoreUtil.copy(cm);
    final Object[] applyData=new Object[2];
    Shell parentShell=null;
    if (PlatformUI.isWorkbenchRunning()) {
      parentShell=PlatformUI.getWorkbench().getDisplay().getActiveShell();
    }
    final ChartWizard chartBuilder=new ChartWizard(parentShell);
    ReportDataServiceProvider dataProvider=new ReportDataServiceProvider(extendedHandle);
    IChartDataSheet dataSheet=new StandardChartDataSheet(extendedHandle,dataProvider);
    final ChartWizardContext context=new ChartWizardContext(cmClone,this,dataProvider,dataSheet);
    if (dataProvider.isInXTab()) {
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_X,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_Y,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_Z,false);
      context.setEnabled(ChartUIConstants.SUBTASK_LEGEND,false);
      context.setEnabled(ChartUIConstants.SUBTASK_TITLE,false);
    }
    chartBuilder.addCustomButton(new ApplyButtonHandler(chartBuilder){
      public void run(){
        super.run();
        applyData[0]=EcoreUtil.copy(context.getModel());
        applyData[1]=context.getOutputFormat();
        commandStack.commit();
        commandStack.startTrans(TRANS_NAME);
      }
    }
);
    context.setRtL(ChartReportItemUtil.isRtl());
    Object of=extendedHandle.getProperty(ChartReportItemUtil.PROPERTY_OUTPUT);
    if (of instanceof String) {
      if (of.equals("String_Node_Str")) {
        context.setOutputFormat("String_Node_Str");
      }
 else       context.setOutputFormat((String)of);
    }
    context.setExtendedItem(extendedHandle);
    context.setProcessor(new ChartReportStyleProcessor(extendedHandle,false));
    ChartWizardContext contextResult=(ChartWizardContext)chartBuilder.open(null,taskId,context);
    if (contextResult != null && contextResult.getModel() != null) {
      commandStack.commit();
      updateModel(extendedHandle,chartBuilder,crii,cm,contextResult.getModel(),contextResult.getOutputFormat());
      if (hostChart != null) {
        ChartReportItemUtil.getChartReportItemFromHandle(eih).setModel(contextResult.getModel());
      }
      return Window.OK;
    }
 else     if (applyData[0] != null) {
      commandStack.rollback();
      updateModel(extendedHandle,chartBuilder,crii,cm,(Chart)applyData[0],(String)applyData[1]);
      if (hostChart != null) {
        ChartReportItemUtil.getChartReportItemFromHandle(eih).setModel((Chart)applyData[0]);
      }
      return Window.OK;
    }
    commandStack.rollback();
    return Window.CANCEL;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
 finally {
    iInstanceCount--;
    this.extendedHandle=null;
  }
}

Fixed version (ground truth):
public int open(final ExtendedItemHandle eih){
  if (iInstanceCount > 0) {
    return Window.CANCEL;
  }
  iInstanceCount++;
  DesignElementHandle hostChart=eih.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
  if (hostChart instanceof ExtendedItemHandle) {
    this.extendedHandle=(ExtendedItemHandle)hostChart;
  }
 else {
    this.extendedHandle=eih;
  }
  try {
    IReportItem item=null;
    try {
      item=extendedHandle.getReportItem();
      if (item == null) {
        extendedHandle.loadExtendedElement();
        item=extendedHandle.getReportItem();
      }
    }
 catch (    ExtendedElementException exception) {
      logger.log(exception);
    }
    if (item == null) {
      logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
      return Window.CANCEL;
    }
    final CommandStack commandStack=extendedHandle.getRoot().getCommandStack();
    final String TRANS_NAME="String_Node_Str";
    commandStack.startTrans(TRANS_NAME);
    final ChartReportItemImpl crii=((ChartReportItemImpl)item);
    final Chart cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    final Chart cmClone=(cm == null) ? null : (Chart)EcoreUtil.copy(cm);
    final Object[] applyData=new Object[2];
    Shell parentShell=null;
    if (PlatformUI.isWorkbenchRunning()) {
      parentShell=PlatformUI.getWorkbench().getDisplay().getActiveShell();
    }
    final ChartWizard chartBuilder=new ChartWizard(parentShell);
    ReportDataServiceProvider dataProvider=new ReportDataServiceProvider(extendedHandle);
    IChartDataSheet dataSheet=new StandardChartDataSheet(extendedHandle,dataProvider);
    final ChartWizardContext context=new ChartWizardContext(cmClone,this,dataProvider,dataSheet);
    if (dataProvider.isInXTab()) {
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_X,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_Y,false);
      context.setEnabled(ChartUIConstants.SUBTASK_AXIS_Z,false);
      context.setEnabled(ChartUIConstants.SUBTASK_LEGEND,false);
      context.setEnabled(ChartUIConstants.SUBTASK_TITLE,false);
    }
    chartBuilder.addCustomButton(new ApplyButtonHandler(chartBuilder){
      public void run(){
        super.run();
        applyData[0]=EcoreUtil.copy(context.getModel());
        applyData[1]=context.getOutputFormat();
        commandStack.commit();
        commandStack.startTrans(TRANS_NAME);
      }
    }
);
    context.setRtL(ChartReportItemUtil.isRtl());
    Object of=extendedHandle.getProperty(ChartReportItemUtil.PROPERTY_OUTPUT);
    if (of instanceof String) {
      if (of.equals("String_Node_Str")) {
        context.setOutputFormat("String_Node_Str");
      }
 else       context.setOutputFormat((String)of);
    }
    context.setExtendedItem(extendedHandle);
    context.setProcessor(new ChartReportStyleProcessor(extendedHandle,false));
    ChartWizardContext contextResult=(ChartWizardContext)chartBuilder.open(null,taskId,context);
    if (contextResult != null && contextResult.getModel() != null) {
      commandStack.commit();
      updateModel(extendedHandle,chartBuilder,crii,cm,contextResult.getModel(),contextResult.getOutputFormat());
      if (dataProvider.isInXTab()) {
        ChartXTabUtil.updateXTabForAxis(ChartXTabUtil.getXtabContainerCell(extendedHandle),extendedHandle,cm,contextResult.getModel());
      }
      return Window.OK;
    }
 else     if (applyData[0] != null) {
      commandStack.rollback();
      updateModel(extendedHandle,chartBuilder,crii,cm,(Chart)applyData[0],(String)applyData[1]);
      if (dataProvider.isInXTab()) {
        ChartXTabUtil.updateXTabForAxis(ChartXTabUtil.getXtabContainerCell(extendedHandle),extendedHandle,cm,(Chart)applyData[0]);
      }
      return Window.OK;
    }
    commandStack.rollback();
    return Window.CANCEL;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
 finally {
    iInstanceCount--;
    this.extendedHandle=null;
  }
}