Program: 67924
Project: 67924
Buggy source:
/** 
 * Overridden behavior for graphic element series that are plotted along axes
 * @param bo
 * @override
 */
public final void render(Map<Series,LegendItemRenderingHints> htRenderers,Bounds bo) throws ChartException {
  final boolean bFirstInSequence=(iSeriesIndex == 0);
  final boolean bLastInSequence=(iSeriesIndex == iSeriesCount - 1);
  final Chart cm=getModel();
  final IDeviceRenderer idr=getDevice();
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  if (bFirstInSequence) {
    Block bl=cm.getBlock();
    final Enumeration<Block> e=bl.children(true);
    final BlockGenerationEvent bge=new BlockGenerationEvent(bl);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
    bge.updateBlock(bl);
    renderChartBlock(idr,bl,StructureSource.createChartBlock(bl));
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
    while (e.hasMoreElements()) {
      bl=e.nextElement();
      bge.updateBlock(bl);
      if (bl instanceof Plot) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderPlot(idr,(Plot)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
        if (!bLastInSequence) {
          break;
        }
      }
 else       if (bl instanceof TitleBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderTitle(idr,(TitleBlock)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof LabelBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLabel(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof Legend) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLegend(idr,(Legend)bl,htRenderers);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderBlock(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
    }
  }
 else   if (bLastInSequence) {
    Block bl=cm.getBlock();
    final Enumeration<Block> e=bl.children(true);
    final BlockGenerationEvent bge=new BlockGenerationEvent(this);
    boolean bStarted=false;
    while (e.hasMoreElements()) {
      bl=e.nextElement();
      if (!bStarted && !bl.isPlot()) {
        continue;
      }
      bStarted=true;
      bge.updateBlock(bl);
      if (bl instanceof Plot) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderPlot(idr,(Plot)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof TitleBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderTitle(idr,(TitleBlock)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof LabelBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLabel(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof Legend) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLegend(idr,(Legend)bl,htRenderers);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderBlock(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
    }
  }
 else {
    final BlockGenerationEvent bge=new BlockGenerationEvent(this);
    Plot p=cm.getPlot();
    bge.updateBlock(p);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,p,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,p);
    renderPlot(idr,p);
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,p,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,p);
  }
  if (bLastInSequence) {
    Object obj=getComputations();
    if (obj instanceof PlotWith2DAxes) {
      final PlotWith2DAxes pw2da=(PlotWith2DAxes)getComputations();
      pw2da.getStackedSeriesLookup().resetSubUnits();
    }
  }
}

Fixed version (ground truth):
/** 
 * Overridden behavior for graphic element series that are plotted along axes
 * @param bo
 */
@Override public final void render(Map<Series,LegendItemRenderingHints> htRenderers,Bounds bo) throws ChartException {
  final boolean bFirstInSequence=(iSeriesIndex == 0);
  final boolean bLastInSequence=(iSeriesIndex == iSeriesCount - 1);
  final Chart cm=getModel();
  final IDeviceRenderer idr=getDevice();
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  if (bFirstInSequence) {
    Block bl=cm.getBlock();
    final Enumeration<Block> e=bl.children(true);
    final BlockGenerationEvent bge=new BlockGenerationEvent(bl);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
    bge.updateBlock(bl);
    renderChartBlock(idr,bl,StructureSource.createChartBlock(bl));
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
    while (e.hasMoreElements()) {
      bl=e.nextElement();
      bge.updateBlock(bl);
      if (bl instanceof Plot) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderPlot(idr,(Plot)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
        if (!bLastInSequence) {
          break;
        }
      }
 else       if (bl instanceof TitleBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderTitle(idr,(TitleBlock)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof LabelBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLabel(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof Legend) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLegend(idr,(Legend)bl,htRenderers);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderBlock(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
    }
  }
 else   if (bLastInSequence) {
    Block bl=cm.getBlock();
    final Enumeration<Block> e=bl.children(true);
    final BlockGenerationEvent bge=new BlockGenerationEvent(this);
    boolean bStarted=false;
    while (e.hasMoreElements()) {
      bl=e.nextElement();
      if (!bStarted && !bl.isPlot()) {
        continue;
      }
      bStarted=true;
      bge.updateBlock(bl);
      if (bl instanceof Plot) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderPlot(idr,(Plot)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof TitleBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderTitle(idr,(TitleBlock)bl);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof LabelBlock) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLabel(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else       if (bl instanceof Legend) {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderLegend(idr,(Legend)bl,htRenderers);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
 else {
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,bl);
        renderBlock(idr,bl,StructureSource.createUnknown(bl));
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,bl,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,bl);
      }
    }
  }
 else {
    final BlockGenerationEvent bge=new BlockGenerationEvent(this);
    Plot p=cm.getPlot();
    bge.updateBlock(p);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_BLOCK,p,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_BLOCK,p);
    renderPlot(idr,p);
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_BLOCK,p,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_BLOCK,p);
  }
  if (bLastInSequence) {
    Object obj=getComputations();
    if (obj instanceof PlotWith2DAxes) {
      final PlotWith2DAxes pw2da=(PlotWith2DAxes)getComputations();
      pw2da.getStackedSeriesLookup().resetSubUnits();
    }
  }
}