Program: 69211
Project: 69211
Buggy source:
/** 
 * Renders all marker ranges associated with all axes (base and orthogonal) in the plot Marker ranges are drawn immediately (not rendered as deferred) at an appropriate Z-order immediately after the plot background is drawn.
 * @param oaxa An array containing all axes
 * @param boPlotClientArea The bounds of the actual client area
 * @throws ChartException
 */
private final void renderMarkerRanges(OneAxis[] oaxa,Bounds boPlotClientArea) throws ChartException {
  Axis ax;
  int iRangeCount, iAxisCount=oaxa.length;
  MarkerRange mr;
  RectangleRenderEvent rre;
  DataElement deStart, deEnd;
  AutoScale asc;
  double dMin=0, dMax=0;
  int iOrientation, iCompare=IConstants.EQUAL;
  final Bounds bo=goFactory.createBounds(0,0,0,0);
  final IDeviceRenderer idr=getDevice();
  final AbstractScriptHandler sh=getRunTimeContext().getScriptHandler();
  final boolean bTransposed=((ChartWithAxes)getModel()).isTransposed();
  final PlotWithAxes pwa=(PlotWithAxes)getComputations();
  final StringBuffer sb=new StringBuffer();
  Bounds boText=goFactory.createBounds(0,0,0,0);
  Anchor anc=null;
  Label la=null;
  TextRenderEvent tre;
  double dOriginalAngle=0;
  for (int i=0; i < iAxisCount; i++) {
    ax=oaxa[i].getModelAxis();
    iOrientation=ax.getOrientation().getValue();
    if (bTransposed) {
      iOrientation=(iOrientation == Orientation.HORIZONTAL) ? Orientation.VERTICAL : Orientation.HORIZONTAL;
    }
    asc=oaxa[i].getScale();
    EList<MarkerRange> el=ax.getMarkerRanges();
    iRangeCount=el.size();
    for (int j=0; j < iRangeCount; j++) {
      mr=el.get(j);
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_MARKER_RANGE,ax,mr,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_MARKER_RANGE,mr);
      deStart=mr.getStartValue();
      deEnd=mr.getEndValue();
      try {
        iCompare=compare(deStart,deEnd);
      }
 catch (      ChartException dfex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,dfex);
      }
      if (iCompare == IConstants.MORE) {
        final DataElement deTemp=deStart;
        deStart=deEnd;
        deEnd=deTemp;
      }
      if (isDimension3D()) {
        return;
      }
      try {
        dMin=(deStart == null) ? ((iOrientation == Orientation.HORIZONTAL) ? boPlotClientArea.getLeft() : boPlotClientArea.getTop() + boPlotClientArea.getHeight()) : Methods.getLocation(asc,deStart);
      }
 catch (      Exception ex) {
        logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",new Object[]{deStart,mr},getRunTimeContext().getULocale()));
        continue;
      }
      try {
        dMax=(deEnd == null) ? ((iOrientation == Orientation.HORIZONTAL) ? boPlotClientArea.getLeft() + boPlotClientArea.getWidth() : boPlotClientArea.getTop()) : Methods.getLocation(asc,deEnd);
      }
 catch (      Exception ex) {
        logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",new Object[]{deEnd,mr},getRunTimeContext().getULocale()));
        continue;
      }
      rre=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),RectangleRenderEvent.class);
      if (iOrientation == Orientation.HORIZONTAL) {
        if (dMax > boPlotClientArea.getLeft() + boPlotClientArea.getWidth()) {
          dMax=boPlotClientArea.getLeft() + boPlotClientArea.getWidth();
        }
        if (dMin < boPlotClientArea.getLeft()) {
          dMax=boPlotClientArea.getLeft();
        }
        bo.set(dMin,boPlotClientArea.getTop(),dMax - dMin,boPlotClientArea.getHeight());
      }
 else {
        if (dMax < boPlotClientArea.getTop()) {
          dMax=boPlotClientArea.getTop();
        }
        if (dMin > boPlotClientArea.getTop() + boPlotClientArea.getHeight()) {
          dMin=boPlotClientArea.getTop() + boPlotClientArea.getHeight();
        }
        bo.set(boPlotClientArea.getLeft(),dMax,boPlotClientArea.getWidth(),dMin - dMax);
      }
      if (pwa.getDimension() == IConstants.TWO_5_D) {
        if (iOrientation == Orientation.HORIZONTAL) {
          bo.translate(pwa.getSeriesThickness(),0);
        }
 else {
          bo.translate(0,-pwa.getSeriesThickness());
        }
      }
      rre.setBounds(bo);
      rre.setOutline(mr.getOutline());
      rre.setBackground(mr.getFill());
      idr.fillRectangle(rre);
      idr.drawRectangle(rre);
      la=goFactory.copyOf(mr.getLabel());
      if (la.isVisible()) {
        if (la.getCaption().getValue() != null && !IConstants.UNDEFINED_STRING.equals(la.getCaption().getValue()) && la.getCaption().getValue().length() > 0) {
          la.getCaption().setValue(oaxa[i].getRunTimeContext().externalizedMessage(la.getCaption().getValue()));
        }
 else {
          try {
            sb.delete(0,sb.length());
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            sb.append(ValueFormatter.format(deStart,mr.getFormatSpecifier(),oaxa[i].getRunTimeContext().getULocale(),null));
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            sb.append(ValueFormatter.format(deEnd,mr.getFormatSpecifier(),oaxa[i].getRunTimeContext().getULocale(),null));
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            la.getCaption().setValue(sb.toString());
          }
 catch (          ChartException dfex) {
            throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,dfex);
          }
        }
        anc=switchAnchor(mr.getLabelAnchor());
        if (bTransposed) {
          dOriginalAngle=la.getCaption().getFont().getRotation();
          try {
            la.getCaption().getFont().setRotation(pwa.getTransposedAngle(dOriginalAngle));
            anc=ChartUtil.transposeAnchor(anc);
          }
 catch (          IllegalArgumentException uiex) {
            throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
          }
        }
        BoundingBox bb=null;
        try {
          bb=cComp.computeBox(idr.getDisplayServer(),IConstants.LEFT,la,0,0);
        }
 catch (        IllegalArgumentException uiex) {
          throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
        }
        boText.set(0,0,bb.getWidth(),bb.getHeight());
        tre=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),TextRenderEvent.class);
        tre.setBlockBounds(bo);
        tre.setBlockAlignment(anchorToAlignment(anc));
        tre.setLabel(la);
        tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
        getDeferredCache().addLabel(tre);
      }
      if (isInteractivityEnabled()) {
        Trigger tg;
        EList<Trigger> elTriggers=mr.getTriggers();
        if (!elTriggers.isEmpty()) {
          final InteractionEvent iev=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),InteractionEvent.class);
          iev.setCursor(mr.getCursor());
          for (int t=0; t < elTriggers.size(); t++) {
            tg=goFactory.copyOf(elTriggers.get(t));
            processTrigger(tg,StructureSource.createMarkerRange(mr));
            iev.addTrigger(tg);
          }
          iev.setHotSpot(rre);
          idr.enableInteraction(iev);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_MARKER_RANGE,ax,mr,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_MARKER_RANGE,mr);
    }
  }
}

Fixed version (ground truth):
/** 
 * Renders all marker ranges associated with all axes (base and orthogonal) in the plot Marker ranges are drawn immediately (not rendered as deferred) at an appropriate Z-order immediately after the plot background is drawn.
 * @param oaxa An array containing all axes
 * @param boPlotClientArea The bounds of the actual client area
 * @throws ChartException
 */
private final void renderMarkerRanges(OneAxis[] oaxa,Bounds boPlotClientArea) throws ChartException {
  Axis ax;
  int iRangeCount, iAxisCount=oaxa.length;
  MarkerRange mr;
  RectangleRenderEvent rre;
  DataElement deStart, deEnd;
  AutoScale asc;
  double dMin=0, dMax=0;
  int iOrientation, iCompare=IConstants.EQUAL;
  final Bounds bo=goFactory.createBounds(0,0,0,0);
  final IDeviceRenderer idr=getDevice();
  final AbstractScriptHandler sh=getRunTimeContext().getScriptHandler();
  final boolean bTransposed=((ChartWithAxes)getModel()).isTransposed();
  final PlotWithAxes pwa=(PlotWithAxes)getComputations();
  final StringBuffer sb=new StringBuffer();
  Bounds boText=goFactory.createBounds(0,0,0,0);
  Anchor anc=null;
  Label la=null;
  TextRenderEvent tre;
  double dOriginalAngle=0;
  for (int i=0; i < iAxisCount; i++) {
    ax=oaxa[i].getModelAxis();
    iOrientation=ax.getOrientation().getValue();
    if (bTransposed) {
      iOrientation=(iOrientation == Orientation.HORIZONTAL) ? Orientation.VERTICAL : Orientation.HORIZONTAL;
    }
    asc=oaxa[i].getScale();
    EList<MarkerRange> el=ax.getMarkerRanges();
    iRangeCount=el.size();
    for (int j=0; j < iRangeCount; j++) {
      mr=el.get(j);
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_MARKER_RANGE,ax,mr,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_MARKER_RANGE,mr);
      deStart=mr.getStartValue();
      deEnd=mr.getEndValue();
      try {
        iCompare=compare(deStart,deEnd);
      }
 catch (      ChartException dfex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,dfex);
      }
      if (iCompare == IConstants.MORE) {
        final DataElement deTemp=deStart;
        deStart=deEnd;
        deEnd=deTemp;
      }
      if (isDimension3D()) {
        return;
      }
      try {
        dMin=(deStart == null) ? ((iOrientation == Orientation.HORIZONTAL) ? boPlotClientArea.getLeft() : boPlotClientArea.getTop() + boPlotClientArea.getHeight()) : Methods.getLocation(asc,deStart);
      }
 catch (      Exception ex) {
        logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",new Object[]{deStart,mr},getRunTimeContext().getULocale()));
        continue;
      }
      try {
        dMax=(deEnd == null) ? ((iOrientation == Orientation.HORIZONTAL) ? boPlotClientArea.getLeft() + boPlotClientArea.getWidth() : boPlotClientArea.getTop()) : Methods.getLocation(asc,deEnd);
      }
 catch (      Exception ex) {
        logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",new Object[]{deEnd,mr},getRunTimeContext().getULocale()));
        continue;
      }
      rre=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),RectangleRenderEvent.class);
      if (iOrientation == Orientation.HORIZONTAL) {
        double maxLimit=boPlotClientArea.getLeft() + boPlotClientArea.getWidth();
        double minLimit=boPlotClientArea.getLeft();
        dMax=Math.min(dMax,maxLimit);
        dMin=Math.min(dMin,maxLimit);
        dMax=Math.max(dMax,minLimit);
        dMin=Math.max(dMin,minLimit);
        bo.set(dMin,boPlotClientArea.getTop(),dMax - dMin,boPlotClientArea.getHeight());
      }
 else {
        double minLimit=boPlotClientArea.getTop();
        double maxLimit=boPlotClientArea.getTop() + boPlotClientArea.getHeight();
        dMax=Math.min(dMax,maxLimit);
        dMin=Math.min(dMin,maxLimit);
        dMax=Math.max(dMax,minLimit);
        dMin=Math.max(dMin,minLimit);
        bo.set(boPlotClientArea.getLeft(),dMax,boPlotClientArea.getWidth(),dMin - dMax);
      }
      if (pwa.getDimension() == IConstants.TWO_5_D) {
        if (iOrientation == Orientation.HORIZONTAL) {
          bo.translate(pwa.getSeriesThickness(),0);
        }
 else {
          bo.translate(0,-pwa.getSeriesThickness());
        }
      }
      rre.setBounds(bo);
      rre.setOutline(mr.getOutline());
      rre.setBackground(mr.getFill());
      idr.fillRectangle(rre);
      idr.drawRectangle(rre);
      la=goFactory.copyOf(mr.getLabel());
      if (la.isVisible()) {
        if (la.getCaption().getValue() != null && !IConstants.UNDEFINED_STRING.equals(la.getCaption().getValue()) && la.getCaption().getValue().length() > 0) {
          la.getCaption().setValue(oaxa[i].getRunTimeContext().externalizedMessage(la.getCaption().getValue()));
        }
 else {
          try {
            sb.delete(0,sb.length());
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            sb.append(ValueFormatter.format(deStart,mr.getFormatSpecifier(),oaxa[i].getRunTimeContext().getULocale(),null));
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            sb.append(ValueFormatter.format(deEnd,mr.getFormatSpecifier(),oaxa[i].getRunTimeContext().getULocale(),null));
            sb.append(Messages.getString("String_Node_Str",getRunTimeContext().getULocale()));
            la.getCaption().setValue(sb.toString());
          }
 catch (          ChartException dfex) {
            throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,dfex);
          }
        }
        anc=switchAnchor(mr.getLabelAnchor());
        if (bTransposed) {
          dOriginalAngle=la.getCaption().getFont().getRotation();
          try {
            la.getCaption().getFont().setRotation(pwa.getTransposedAngle(dOriginalAngle));
            anc=ChartUtil.transposeAnchor(anc);
          }
 catch (          IllegalArgumentException uiex) {
            throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
          }
        }
        BoundingBox bb=null;
        try {
          bb=cComp.computeBox(idr.getDisplayServer(),IConstants.LEFT,la,0,0);
        }
 catch (        IllegalArgumentException uiex) {
          throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
        }
        boText.set(0,0,bb.getWidth(),bb.getHeight());
        tre=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),TextRenderEvent.class);
        tre.setBlockBounds(bo);
        tre.setBlockAlignment(anchorToAlignment(anc));
        tre.setLabel(la);
        tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
        getDeferredCache().addLabel(tre);
      }
      if (isInteractivityEnabled()) {
        Trigger tg;
        EList<Trigger> elTriggers=mr.getTriggers();
        if (!elTriggers.isEmpty()) {
          final InteractionEvent iev=((EventObjectCache)idr).getEventObject(StructureSource.createMarkerRange(mr),InteractionEvent.class);
          iev.setCursor(mr.getCursor());
          for (int t=0; t < elTriggers.size(); t++) {
            tg=goFactory.copyOf(elTriggers.get(t));
            processTrigger(tg,StructureSource.createMarkerRange(mr));
            iev.addTrigger(tg);
          }
          iev.setHotSpot(rre);
          idr.enableInteraction(iev);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_MARKER_RANGE,ax,mr,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_MARKER_RANGE,mr);
    }
  }
}