Program: 72089
Project: 72089
Buggy source:
public final IFigure createFigure(final ExtendedItemHandle eih){
  try {
    eih.loadExtendedElement();
  }
 catch (  ExtendedElementException eeex) {
    logger.log(eeex);
  }
  try {
    final ChartReportItemImpl iri=(ChartReportItemImpl)eih.getReportItem();
    final DesignerRepresentation dr=new DesignerRepresentation(iri);
    iri.setDesignerRepresentation(dr);
    if (iri.isCopied() && ChartXTabUtil.isPlotChart(eih)) {
      ChartWithAxes cwa=(ChartWithAxes)iri.getProperty(ChartReportItemConstants.PROPERTY_CHART);
      Axis yAxis=(Axis)((Axis)cwa.getAxes().get(0)).getAssociatedAxes().get(0);
      if (yAxis.getLineAttributes().isVisible() && ChartXTabUtil.findReferenceChart(eih) == null) {
        AggregationCellHandle containerCell=ChartXTabUtil.getXtabContainerCell(eih);
        AggregationCellHandle grandTotalCell=ChartXTabUIUtil.getGrandTotalAggregationCell(containerCell,cwa.isTransposed());
        Object content=ChartXTabUtil.getFirstContent(grandTotalCell);
        if (ChartXTabUtil.isAxisChart((DesignElementHandle)content)) {
          final ExtendedItemHandle axisChart=(ExtendedItemHandle)content;
          if (!axisChart.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART).equals(eih))           Display.getCurrent().asyncExec(new Runnable(){
            public void run(){
              try {
                axisChart.setProperty(ChartReportItemConstants.PROPERTY_HOST_CHART,eih);
              }
 catch (              SemanticException e) {
                logger.log(e);
              }
            }
          }
);
        }
      }
    }
 else     if (ChartXTabUtil.isAxisChart(eih)) {
      DesignElementHandle hostChart=eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
      if (hostChart != null) {
        hostChart.getContainer().addListener(createDeleteChartListener(eih));
      }
    }
    return dr;
  }
 catch (  BirtException e) {
    logger.log(e);
    return null;
  }
}

Fixed version (ground truth):
public final IFigure createFigure(final ExtendedItemHandle eih){
  try {
    eih.loadExtendedElement();
  }
 catch (  ExtendedElementException eeex) {
    logger.log(eeex);
  }
  try {
    final ChartReportItemImpl iri=(ChartReportItemImpl)eih.getReportItem();
    final DesignerRepresentation dr=new DesignerRepresentation(iri);
    iri.setDesignerRepresentation(dr);
    if (iri.isCopied() && ChartXTabUtil.isPlotChart(eih)) {
      ChartWithAxes cwa=(ChartWithAxes)iri.getProperty(ChartReportItemConstants.PROPERTY_CHART);
      Axis yAxis=(Axis)((Axis)cwa.getAxes().get(0)).getAssociatedAxes().get(0);
      if (yAxis.getLineAttributes().isVisible() && ChartXTabUtil.findReferenceChart(eih) == null) {
        AggregationCellHandle containerCell=ChartXTabUtil.getXtabContainerCell(eih);
        AggregationCellHandle grandTotalCell=ChartXTabUIUtil.getGrandTotalAggregationCell(containerCell,cwa.isTransposed());
        Object content=ChartXTabUtil.getFirstContent(grandTotalCell);
        if (ChartXTabUtil.isAxisChart((DesignElementHandle)content)) {
          final ExtendedItemHandle axisChart=(ExtendedItemHandle)content;
          if (!axisChart.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART).equals(eih))           Display.getCurrent().asyncExec(new Runnable(){
            public void run(){
              try {
                axisChart.setProperty(ChartReportItemConstants.PROPERTY_HOST_CHART,eih);
              }
 catch (              SemanticException e) {
                logger.log(e);
              }
            }
          }
);
        }
      }
    }
 else     if (ChartXTabUtil.isAxisChart(eih)) {
      DesignElementHandle hostChart=eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
      if (hostChart != null) {
        Listener listener=createDeleteChartListener(eih);
        DesignElementHandle cell=hostChart.getContainer();
        cell.addListener(listener);
        if (cell.getContainer() != null) {
          cell.getContainer().addListener(listener);
        }
      }
    }
    return dr;
  }
 catch (  BirtException e) {
    logger.log(e);
    return null;
  }
}