Program: 71365
Project: 71365
Buggy source:
public Object onRowSets(IBaseResultSet[] baseResultSet) throws BirtException {
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  if (resultSet == null) {
    return new Object[]{new byte[]{0}};
  }
 else   if (ChartReportItemUtil.isEmpty(resultSet)) {
    return null;
  }
  Bounds bo=cm.getBlock().getBounds();
  if (bo.getWidth() == 0 && bo.getHeight() == 0) {
    return null;
  }
  try {
    if (rtc.getScale() == null && ChartReportItemUtil.canScaleShared(handle,cm)) {
      rtc.setScale(createSharedScale(resultSet));
    }
    boolean isSharingQuery=false;
    if (handle.getDataBindingReference() != null || handle.getContainer() instanceof MultiViewsHandle) {
      isSharingQuery=true;
    }
    rtc.setSharingQuery(isSharingQuery);
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    if (rtc.getScriptContext() != null && rtc.getScriptContext() instanceof ChartScriptContext) {
      ((ChartScriptContext)rtc.getScriptContext()).setExternalContext(externalContext);
    }
    initializeScriptHandler(externalContext);
    IDataRowExpressionEvaluator rowAdapter=createEvaluator(resultSet);
    IActionEvaluator evaluator=new BIRTActionEvaluator();
    Generator.instance().bindData(rowAdapter,evaluator,cm,rtc);
    prepareDeviceRenderer();
    GeneratedChartState gcs=buildChart(rowAdapter,externalContext);
    renderToImageFile(gcs);
    rowAdapter.close();
    if (rtc.getScale() != null && !rtc.getScale().isShared()) {
      rtc.getScale().setShared(true);
      ((ChartReportItemImpl)getReportItem(handle)).setScale(rtc.getScale());
    }
    return getImageToDisplay();
  }
 catch (  BirtException birtException) {
    if (isNoDataException(birtException)) {
      return null;
    }
 else {
      throw birtException;
    }
  }
catch (  RuntimeException ex) {
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(ex);
    throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ex);
  }
}

Fixed version (ground truth):
public Object onRowSets(IBaseResultSet[] baseResultSet) throws BirtException {
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  if (resultSet == null) {
    return new Object[]{new byte[]{0}};
  }
 else   if (ChartReportItemUtil.isEmpty(resultSet)) {
    return null;
  }
  Bounds bo=cm.getBlock().getBounds();
  if (bo.getWidth() == 0 && bo.getHeight() == 0) {
    return null;
  }
  try {
    ScaleContext sharedScale=createSharedScale(resultSet);
    if (ChartReportItemUtil.canScaleShared(handle,cm)) {
      if (rtc.getScale() == null) {
        rtc.setScale(sharedScale);
      }
      if (sharedScale != null) {
        if (sharedScale.getMin() instanceof Double) {
          rtc.putState(AutoScale.KEY_SHARED_MINMAX,new double[]{(Double)sharedScale.getMin(),(Double)sharedScale.getMax()});
        }
 else         if (rtc.getScale().getMin() instanceof CDateTime) {
          rtc.putState(AutoScale.KEY_SHARED_MINMAX,new CDateTime[]{(CDateTime)sharedScale.getMin(),(CDateTime)sharedScale.getMax()});
        }
      }
    }
    boolean isSharingQuery=false;
    if (handle.getDataBindingReference() != null || handle.getContainer() instanceof MultiViewsHandle) {
      isSharingQuery=true;
    }
    rtc.setSharingQuery(isSharingQuery);
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    if (rtc.getScriptContext() != null && rtc.getScriptContext() instanceof ChartScriptContext) {
      ((ChartScriptContext)rtc.getScriptContext()).setExternalContext(externalContext);
    }
    initializeScriptHandler(externalContext);
    IDataRowExpressionEvaluator rowAdapter=createEvaluator(resultSet);
    IActionEvaluator evaluator=new BIRTActionEvaluator();
    Generator.instance().bindData(rowAdapter,evaluator,cm,rtc);
    prepareDeviceRenderer();
    GeneratedChartState gcs=buildChart(rowAdapter,externalContext);
    renderToImageFile(gcs);
    rowAdapter.close();
    if (rtc.getScale() != null && !rtc.getScale().isShared()) {
      rtc.getScale().setShared(true);
      ((ChartReportItemImpl)getReportItem(handle)).setScale(rtc.getScale());
    }
    return getImageToDisplay();
  }
 catch (  BirtException birtException) {
    if (isNoDataException(birtException)) {
      return null;
    }
 else {
      throw birtException;
    }
  }
catch (  RuntimeException ex) {
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(ex);
    throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ex);
  }
}