Program: 72940
Project: 72940
Buggy source:
public final void updateFigure(ExtendedItemHandle eih,IFigure ifg){
  try {
    eih.loadExtendedElement();
    final ChartReportItemImpl crii=(ChartReportItemImpl)eih.getReportItem();
    crii.setHandle(eih);
    final Chart cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    if (cm == null) {
      return;
    }
    Bounds defaultBounds=ChartReportItemUtil.createDefaultChartBounds(eih,cm);
    double dHeightInPoints=defaultBounds.getHeight();
    double dWidthInPoints=defaultBounds.getWidth();
    final DimensionHandle dhHeight;
    final DimensionHandle dhWidth;
    if (ChartXTabUtil.isAxisChart(eih)) {
      ExtendedItemHandle plotChart=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
      if (ChartXTabUIUtil.isTransposedChartWithAxes(cm)) {
        dhHeight=eih.getHeight();
        dhWidth=plotChart.getWidth();
      }
 else {
        dhHeight=plotChart.getHeight();
        dhWidth=eih.getWidth();
      }
    }
 else {
      dhHeight=eih.getHeight();
      dhWidth=eih.getWidth();
    }
    double dOriginalHeight=dhHeight.getMeasure();
    String sHeightUnits=dhHeight.getUnits();
    double dOriginalWidth=dhWidth.getMeasure();
    String sWidthUnits=dhWidth.getUnits();
    final IDisplayServer idsSWT=ChartUIUtil.getDisplayServer();
    if (sHeightUnits != null) {
      if (sHeightUnits == DesignChoiceConstants.UNITS_PX) {
        dOriginalHeight=ChartUtil.convertPixelsToPoints(idsSWT,dOriginalHeight);
        sHeightUnits=DesignChoiceConstants.UNITS_PT;
      }
      if (sHeightUnits == DesignChoiceConstants.UNITS_PERCENTAGE) {
        IFigure parentFigure=ifg.getParent();
        if (parentFigure != null) {
          int height=(int)((parentFigure.getSize().height - parentFigure.getInsets().getHeight()) * dOriginalHeight / 100);
          dOriginalHeight=ChartUtil.convertPixelsToPoints(idsSWT,height);
          sHeightUnits=DesignChoiceConstants.UNITS_PT;
        }
      }
      dHeightInPoints=DimensionUtil.convertTo(dOriginalHeight,sHeightUnits,DesignChoiceConstants.UNITS_PT).getMeasure();
    }
    if (sWidthUnits != null) {
      if (sWidthUnits == DesignChoiceConstants.UNITS_PX) {
        dOriginalWidth=(dOriginalWidth * 72d) / idsSWT.getDpiResolution();
        sWidthUnits=DesignChoiceConstants.UNITS_PT;
      }
      if (sWidthUnits == DesignChoiceConstants.UNITS_PERCENTAGE) {
        IFigure parentFigure=ifg.getParent();
        if (parentFigure != null) {
          int width=(int)((parentFigure.getSize().width - parentFigure.getInsets().getWidth()) * dOriginalWidth / 100);
          dOriginalWidth=ChartUtil.convertPixelsToPoints(idsSWT,width);
          sWidthUnits=DesignChoiceConstants.UNITS_PT;
        }
      }
      dWidthInPoints=DimensionUtil.convertTo(dOriginalWidth,sWidthUnits,DesignChoiceConstants.UNITS_PT).getMeasure();
    }
    final double dHeightInPixels=(idsSWT.getDpiResolution() * dHeightInPoints) / 72d;
    final double dWidthInPixels=(idsSWT.getDpiResolution() * dWidthInPoints) / 72d;
    if (cm != null && !ChartXTabUtil.isAxisChart(eih)) {
      if (dWidthInPoints > 0)       cm.getBlock().getBounds().setWidth(dWidthInPoints);
      if (dHeightInPoints > 0)       cm.getBlock().getBounds().setHeight(dHeightInPoints);
    }
    if (crii.getDesignerRepresentation() != null) {
      ((DesignerRepresentation)crii.getDesignerRepresentation()).setDirty(true);
    }
    Dimension newSize=ifg.getBounds().getCopy().getSize();
    if (dWidthInPixels > 0)     newSize.width=(int)dWidthInPixels;
    if (dHeightInPixels > 0)     newSize.height=(int)dHeightInPixels;
    ifg.setSize(newSize);
  }
 catch (  BirtException ex) {
    logger.log(ex);
  }
}

Fixed version (ground truth):
public final void updateFigure(ExtendedItemHandle eih,IFigure ifg){
  try {
    eih.loadExtendedElement();
    final ChartReportItemImpl crii=(ChartReportItemImpl)eih.getReportItem();
    crii.setHandle(eih);
    final boolean bAxisChart=ChartXTabUtil.isAxisChart(eih);
    final ExtendedItemHandle hostChart;
    final Chart cm;
    if (bAxisChart) {
      hostChart=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
      cm=ChartXTabUtil.getChartFromHandle(hostChart);
    }
 else {
      hostChart=null;
      cm=(Chart)crii.getProperty(ChartReportItemUtil.PROPERTY_CHART);
    }
    if (cm == null) {
      return;
    }
    Bounds defaultBounds=ChartReportItemUtil.createDefaultChartBounds(eih,cm);
    double dHeightInPoints=defaultBounds.getHeight();
    double dWidthInPoints=defaultBounds.getWidth();
    final DimensionHandle dhHeight;
    final DimensionHandle dhWidth;
    if (bAxisChart) {
      if (ChartXTabUIUtil.isTransposedChartWithAxes(cm)) {
        dhHeight=eih.getHeight();
        dhWidth=hostChart.getWidth();
      }
 else {
        dhHeight=hostChart.getHeight();
        dhWidth=eih.getWidth();
      }
    }
 else {
      dhHeight=eih.getHeight();
      dhWidth=eih.getWidth();
    }
    double dOriginalHeight=dhHeight.getMeasure();
    String sHeightUnits=dhHeight.getUnits();
    double dOriginalWidth=dhWidth.getMeasure();
    String sWidthUnits=dhWidth.getUnits();
    final IDisplayServer idsSWT=ChartUIUtil.getDisplayServer();
    if (sHeightUnits != null) {
      if (sHeightUnits == DesignChoiceConstants.UNITS_PX) {
        dOriginalHeight=ChartUtil.convertPixelsToPoints(idsSWT,dOriginalHeight);
        sHeightUnits=DesignChoiceConstants.UNITS_PT;
      }
      if (sHeightUnits == DesignChoiceConstants.UNITS_PERCENTAGE) {
        IFigure parentFigure=ifg.getParent();
        if (parentFigure != null) {
          int height=(int)((parentFigure.getSize().height - parentFigure.getInsets().getHeight()) * dOriginalHeight / 100);
          dOriginalHeight=ChartUtil.convertPixelsToPoints(idsSWT,height);
          sHeightUnits=DesignChoiceConstants.UNITS_PT;
        }
      }
      dHeightInPoints=DimensionUtil.convertTo(dOriginalHeight,sHeightUnits,DesignChoiceConstants.UNITS_PT).getMeasure();
    }
    if (sWidthUnits != null) {
      if (sWidthUnits == DesignChoiceConstants.UNITS_PX) {
        dOriginalWidth=(dOriginalWidth * 72d) / idsSWT.getDpiResolution();
        sWidthUnits=DesignChoiceConstants.UNITS_PT;
      }
      if (sWidthUnits == DesignChoiceConstants.UNITS_PERCENTAGE) {
        IFigure parentFigure=ifg.getParent();
        if (parentFigure != null) {
          int width=(int)((parentFigure.getSize().width - parentFigure.getInsets().getWidth()) * dOriginalWidth / 100);
          dOriginalWidth=ChartUtil.convertPixelsToPoints(idsSWT,width);
          sWidthUnits=DesignChoiceConstants.UNITS_PT;
        }
      }
      dWidthInPoints=DimensionUtil.convertTo(dOriginalWidth,sWidthUnits,DesignChoiceConstants.UNITS_PT).getMeasure();
    }
    final double dHeightInPixels=(idsSWT.getDpiResolution() * dHeightInPoints) / 72d;
    final double dWidthInPixels=(idsSWT.getDpiResolution() * dWidthInPoints) / 72d;
    if (cm != null && !bAxisChart) {
      if (dWidthInPoints > 0)       cm.getBlock().getBounds().setWidth(dWidthInPoints);
      if (dHeightInPoints > 0)       cm.getBlock().getBounds().setHeight(dHeightInPoints);
    }
    if (crii.getDesignerRepresentation() != null) {
      ((DesignerRepresentation)crii.getDesignerRepresentation()).setDirty(true);
    }
    Dimension newSize=ifg.getBounds().getCopy().getSize();
    if (dWidthInPixels > 0)     newSize.width=(int)dWidthInPixels;
    if (dHeightInPixels > 0)     newSize.height=(int)dHeightInPixels;
    ifg.setSize(newSize);
  }
 catch (  BirtException ex) {
    logger.log(ex);
  }
}