Program: 65436
Project: 65436
Buggy source:
public Object onRowSets(IBaseResultSet[] baseResultSet) throws BirtException {
  if (cm == null) {
    return null;
  }
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  boolean bEmpty=false;
  boolean bEmptyWithUncompletedBindings=false;
  boolean bEmptyWithEmptyResultSet=false;
  if (resultSet == null || !ChartItemUtil.checkChartBindingComplete(cm)) {
    bEmpty=true;
    bEmptyWithUncompletedBindings=true;
  }
  if (!bEmpty && ChartReportItemUtil.isEmpty(resultSet)) {
    bEmpty=true;
    bEmptyWithEmptyResultSet=true;
  }
  Bounds bo=cm.getBlock().getBounds();
  if (bo.getWidth() == 0 && bo.getHeight() == 0 && (bo.isSetHeight() || bo.isSetWidth())) {
    return null;
  }
  renderDpi=getRenderDpi();
  try {
    if (rtc.getSharedScale() == null && ChartReportItemUtil.canScaleShared(modelHandle,cm)) {
      rtc.setSharedScale(createSharedScale(resultSet));
    }
    boolean isSharingQuery=false;
    if (modelHandle.getDataBindingReference() != null || modelHandle.getContainer() instanceof MultiViewsHandle || ChartItemUtil.isChartInheritGroups(modelHandle)) {
      isSharingQuery=true;
      isSharingQuery&=!ChartItemUtil.isChartHandle(ChartItemUtil.getReportItemReference(modelHandle));
    }
    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();
    ChartReportStyleProcessor styleProcessor=new ChartReportStyleProcessor(modelHandle,true,this.style,this.dpi);
    styleProcessor.applyDefaultHyperlink(this.cm);
    updateChartModel();
    boolean bEmptyData=false;
    if (!bEmptyWithUncompletedBindings && !bindData(rowAdapter,evaluator)) {
      bEmptyData=true;
    }
    Object renderObject=generateRenderObject(rowAdapter,externalContext,bEmpty,styleProcessor);
    rowAdapter.close();
    if (bEmpty) {
      if (bEmptyWithUncompletedBindings && isAutoHide()) {
        return outputNullResultSet();
      }
      if (bEmptyWithEmptyResultSet && isAutoHide()) {
        return null;
      }
    }
    if (bEmptyData && isAutoHide()) {
      return null;
    }
    return renderObject;
  }
 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 {
  if (cm == null) {
    return null;
  }
  IBaseResultSet resultSet=getDataToRender(baseResultSet);
  boolean bEmpty=false;
  boolean bEmptyWithUncompletedBindings=false;
  boolean bEmptyWithEmptyResultSet=false;
  if (resultSet == null || !ChartItemUtil.checkChartBindingComplete(cm)) {
    bEmpty=true;
    bEmptyWithUncompletedBindings=true;
  }
  if (!bEmpty && ChartReportItemUtil.isEmpty(resultSet)) {
    bEmpty=true;
    bEmptyWithEmptyResultSet=true;
  }
  Bounds bo=cm.getBlock().getBounds();
  if (bo.getWidth() == 0 && bo.getHeight() == 0 && (bo.isSetHeight() || bo.isSetWidth())) {
    return null;
  }
  renderDpi=getRenderDpi();
  try {
    rtc.setTimeZone(context.getTimeZone());
    if (rtc.getSharedScale() == null && ChartReportItemUtil.canScaleShared(modelHandle,cm)) {
      rtc.setSharedScale(createSharedScale(resultSet));
    }
    boolean isSharingQuery=false;
    if (modelHandle.getDataBindingReference() != null || modelHandle.getContainer() instanceof MultiViewsHandle || ChartItemUtil.isChartInheritGroups(modelHandle)) {
      isSharingQuery=true;
      isSharingQuery&=!ChartItemUtil.isChartHandle(ChartItemUtil.getReportItemReference(modelHandle));
    }
    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();
    ChartReportStyleProcessor styleProcessor=new ChartReportStyleProcessor(modelHandle,true,this.style,this.dpi);
    styleProcessor.applyDefaultHyperlink(this.cm);
    updateChartModel();
    boolean bEmptyData=false;
    if (!bEmptyWithUncompletedBindings && !bindData(rowAdapter,evaluator)) {
      bEmptyData=true;
    }
    Object renderObject=generateRenderObject(rowAdapter,externalContext,bEmpty,styleProcessor);
    rowAdapter.close();
    if (bEmpty) {
      if (bEmptyWithUncompletedBindings && isAutoHide()) {
        return outputNullResultSet();
      }
      if (bEmptyWithEmptyResultSet && isAutoHide()) {
        return null;
      }
    }
    if (bEmptyData && isAutoHide()) {
      return null;
    }
    return renderObject;
  }
 catch (  RuntimeException ex) {
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(ex);
    throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ex);
  }
}