Program: 71740
Project: 71740
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);
    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 {
    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);
  }
}