Program: 74401
Project: 74401
Buggy source:
public Object onRowSets(IRowSet[] irsa) throws BirtException {
  if (irsa == null || irsa.length < 1 || irsa[0] == null || irsa[0].isEmpty()) {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    return null;
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  if (handle == null) {
    return null;
  }
  try {
    String javaHandlerClass=handle.getEventHandlerClass();
    if (javaHandlerClass != null && javaHandlerClass.length() > 0) {
      cm.setScript(javaHandlerClass);
    }
    IRowSet rowSet=irsa[0];
    if (rowSet == null || rowSet.isEmpty()) {
      return null;
    }
    rtc.setScriptClassLoader(new BIRTScriptClassLoader(appClassLoader));
    ScriptHandler sh=rtc.getScriptHandler();
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    if (sh == null) {
      sh=new ScriptHandler();
      rtc.setScriptHandler(sh);
      sh.setScriptClassLoader(rtc.getScriptClassLoader());
      sh.setScriptContext(rtc.getScriptContext());
      final String sScriptContent=cm.getScript();
      if (externalContext != null && externalContext.getScriptable() != null) {
        sh.init(externalContext.getScriptable());
      }
 else {
        sh.init(null);
      }
      sh.setRunTimeModel(cm);
      if (sScriptContent != null && sScriptContent.length() > 0 && rtc.isScriptingEnabled()) {
        sh.register(sScriptContent);
      }
    }
    BIRTDataRowEvaluator rowAdapter=new BIRTDataRowEvaluator(rowSet);
    Generator.instance().bindData(rowAdapter,new BIRTActionEvaluator(),cm,rtc);
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    idr=ChartEngine.instance().getRenderer("String_Node_Str" + sExtension.toUpperCase(Locale.US));
    idr.setProperty(IDeviceRenderer.DPI_RESOLUTION,new Integer(dpi));
    if ("String_Node_Str".equalsIgnoreCase(sExtension)) {
      idr.setProperty("String_Node_Str",Boolean.TRUE);
    }
    final Bounds originalBounds=cm.getBlock().getBounds();
    final Bounds bo=(Bounds)EcoreUtil.copy(originalBounds);
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",bo));
    final Generator gr=Generator.instance();
    GeneratedChartState gcs=null;
    rtc.setActionRenderer(new BIRTActionRenderer(this.handle,this.ah,rowAdapter,this.context));
    rtc.setMessageLookup(new BIRTMessageLookup(context));
    Object renderContext=context.getAppContext().get(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT);
    if (renderContext instanceof HTMLRenderContext) {
      IRenderOption renderOption=((HTMLRenderContext)renderContext).getRenderOption();
      if (renderOption instanceof HTMLRenderOption) {
        if (((HTMLRenderOption)renderOption).getHtmlRtLFlag()) {
          rtc.setRightToLeft(true);
        }
      }
    }
    gcs=gr.build(idr.getDisplayServer(),cm,bo,externalContext,rtc,new ChartReportStyleProcessor(handle,this.style));
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    BufferedOutputStream bos=new BufferedOutputStream(baos);
    idr.setProperty(IDeviceRenderer.FILE_IDENTIFIER,bos);
    idr.setProperty(IDeviceRenderer.UPDATE_NOTIFIER,new EmptyUpdateNotifier(cm,gcs.getChartModel()));
    gr.render(idr,gcs);
    rowAdapter.close();
    try {
      bos.close();
      fis=new ByteArrayInputStream(baos.toByteArray());
    }
 catch (    Exception ioex) {
      throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ioex);
    }
    if (!"String_Node_Str".equals(sExtension) && idr instanceof IImageMapEmitter) {
      imageMap=((IImageMapEmitter)idr).getImageMap();
    }
  }
 catch (  BirtException birtException) {
    Throwable ex=birtException;
    while (ex.getCause() != null) {
      ex=ex.getCause();
    }
    if (ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.ZERO_DATASET) {
      return null;
    }
    if (ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.ALL_NULL_DATASET) {
      return null;
    }
    if ((ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.INVALID_IMAGE_SIZE)) {
      logger.log(birtException);
      return null;
    }
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(birtException);
    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);
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  if ("String_Node_Str".equals(sExtension)) {
    return fis;
  }
 else {
    return new Object[]{fis,imageMap};
  }
}

Fixed version (ground truth):
public Object onRowSets(IRowSet[] irsa) throws BirtException {
  if (irsa == null || irsa.length < 1 || irsa[0] == null || irsa[0].isEmpty()) {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    return null;
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  if (handle == null) {
    return null;
  }
  try {
    String javaHandlerClass=handle.getEventHandlerClass();
    if (javaHandlerClass != null && javaHandlerClass.length() > 0) {
      cm.setScript(javaHandlerClass);
    }
    IRowSet rowSet=irsa[0];
    if (rowSet == null || rowSet.isEmpty()) {
      return null;
    }
    rtc.setScriptClassLoader(new BIRTScriptClassLoader(appClassLoader));
    ScriptHandler sh=rtc.getScriptHandler();
    BIRTExternalContext externalContext=new BIRTExternalContext(context);
    if (sh == null) {
      sh=new ScriptHandler();
      rtc.setScriptHandler(sh);
      sh.setScriptClassLoader(rtc.getScriptClassLoader());
      sh.setScriptContext(rtc.getScriptContext());
      final String sScriptContent=cm.getScript();
      if (externalContext != null && externalContext.getScriptable() != null) {
        sh.init(externalContext.getScriptable());
      }
 else {
        sh.init(null);
      }
      sh.setRunTimeModel(cm);
      if (sScriptContent != null && sScriptContent.length() > 0 && rtc.isScriptingEnabled()) {
        sh.register(sScriptContent);
      }
    }
    idr=ChartEngine.instance().getRenderer("String_Node_Str" + sExtension.toUpperCase(Locale.US));
    idr.setProperty(IDeviceRenderer.DPI_RESOLUTION,new Integer(dpi));
    if ("String_Node_Str".equalsIgnoreCase(sExtension)) {
      idr.setProperty("String_Node_Str",Boolean.TRUE);
    }
    BIRTDataRowEvaluator rowAdapter=new BIRTDataRowEvaluator(rowSet);
    Generator.instance().bindData(rowAdapter,new BIRTActionEvaluator(),cm,rtc);
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    final Bounds originalBounds=cm.getBlock().getBounds();
    final Bounds bo=(Bounds)EcoreUtil.copy(originalBounds);
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",bo));
    final Generator gr=Generator.instance();
    GeneratedChartState gcs=null;
    rtc.setActionRenderer(new BIRTActionRenderer(this.handle,this.ah,rowAdapter,this.context));
    rtc.setMessageLookup(new BIRTMessageLookup(context));
    Object renderContext=context.getAppContext().get(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT);
    if (renderContext instanceof HTMLRenderContext) {
      IRenderOption renderOption=((HTMLRenderContext)renderContext).getRenderOption();
      if (renderOption instanceof HTMLRenderOption) {
        if (((HTMLRenderOption)renderOption).getHtmlRtLFlag()) {
          rtc.setRightToLeft(true);
        }
      }
    }
    gcs=gr.build(idr.getDisplayServer(),cm,bo,externalContext,rtc,new ChartReportStyleProcessor(handle,this.style));
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    BufferedOutputStream bos=new BufferedOutputStream(baos);
    idr.setProperty(IDeviceRenderer.FILE_IDENTIFIER,bos);
    idr.setProperty(IDeviceRenderer.UPDATE_NOTIFIER,new EmptyUpdateNotifier(cm,gcs.getChartModel()));
    gr.render(idr,gcs);
    rowAdapter.close();
    try {
      bos.close();
      fis=new ByteArrayInputStream(baos.toByteArray());
    }
 catch (    Exception ioex) {
      throw new ChartException(ChartReportItemPlugin.ID,ChartException.GENERATION,ioex);
    }
    if (getOutputType() == OUTPUT_AS_IMAGE_WITH_MAP && idr instanceof IImageMapEmitter) {
      imageMap=((IImageMapEmitter)idr).getImageMap();
    }
  }
 catch (  BirtException birtException) {
    Throwable ex=birtException;
    while (ex.getCause() != null) {
      ex=ex.getCause();
    }
    if (ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.ZERO_DATASET) {
      return null;
    }
    if (ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.ALL_NULL_DATASET) {
      return null;
    }
    if ((ex instanceof ChartException && ((ChartException)ex).getType() == ChartException.INVALID_IMAGE_SIZE)) {
      logger.log(birtException);
      return null;
    }
    logger.log(ILogger.ERROR,Messages.getString("String_Node_Str"));
    logger.log(birtException);
    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);
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str"));
  if (getOutputType() == OUTPUT_AS_IMAGE) {
    return fis;
  }
 else {
    return new Object[]{fis,imageMap};
  }
}