Program: 73994
Project: 73994
Buggy source:
private final void showLeftValue(IPrimitiveRenderer ipr,Location lo,Label la,int iLabelPosition,boolean bShadow){
  Graphics2D g2d=(Graphics2D)((IDeviceRenderer)ipr).getGraphicsContext();
  FontDefinition fd=la.getCaption().getFont();
  double dAngleInDegrees=fd.getRotation();
  if (bShadow) {
    bShadow=la.getShadowColor() != null;
  }
  Color clrText=(Color)_sxs.getColor(la.getCaption().getColor());
  Color clrBackground=null;
  if (la.getBackground() != null) {
    clrBackground=(Color)_sxs.getColor((ColorDefinition)la.getBackground());
  }
  final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
  final double dSineTheta=(Math.sin(dAngleInRadians));
  final double dCosTheta=(Math.cos(dAngleInRadians));
  final ITextMetrics itm=new SwingTextMetrics(_sxs,la);
  lo=adjustTextPosition(iLabelPosition,lo,itm,dAngleInDegrees);
  double dX=lo.getX(), dY=lo.getY();
  try {
    final double dFW=itm.getFullWidth();
    final double dH=itm.getHeight();
    final double dD=itm.getDescent();
    final double dFH=itm.getFullHeight();
    double dXOffset=0, dW=0;
    final int iLC=itm.getLineCount();
    final Insets ins=la.getInsets().scaledInstance(_sxs.getDpiResolution() / 72d);
    final double shadowness=3 * _sxs.getDpiResolution() / 72d;
    final boolean bEmptyText="String_Node_Str".equals(la.getCaption().getValue());
    TextLayout tl;
    final HorizontalAlignment ha=la.getCaption().getFont().getAlignment().getHorizontalAlignment();
    final boolean bRightAligned=ha.getValue() == HorizontalAlignment.RIGHT;
    final boolean bCenterAligned=ha.getValue() == HorizontalAlignment.CENTER;
    double dRotateX=(dX - dFW);
    double dRotateY=(dY + dH / 2);
    dX-=dFW;
    dY+=dH / 2;
    if (dAngleInDegrees == 0) {
      double dYHalfOffset=(dFH + dH) / 2d;
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dYHalfOffset) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dYHalfOffset) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dYHalfOffset) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dYHalfOffset,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(dY - dYHalfOffset + ins.getTop() + dH * (i + 1) - dD));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
    }
 else     if (dAngleInDegrees > 0 && dAngleInDegrees < 90) {
      double dDeltaX=dFW - dFW * dCosTheta;
      double dDeltaY=dFW * dSineTheta + dH / 2 - dH * dCosTheta / 2.0;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dFH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < itm.getLineCount(); i++) {
            tl=((SwingTextMetrics)itm).getLayout(iLC - i - 1);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) - (dH * i)) - ins.getBottom()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
    }
 else     if (dAngleInDegrees < 0 && dAngleInDegrees > -90) {
      double dDeltaX=dFW - dFW * dCosTheta - dH * dSineTheta;
      double dDeltaY=+dFW * dSineTheta - dH / 2 + dH * dCosTheta / 2;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) + (dH * i)) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
    }
 else     if (dAngleInDegrees == 90) {
      double dDeltaX=dFW;
      double dDeltaY=(dFW - dH) / 2;
      dX+=dDeltaX;
      dY+=dDeltaY;
      g2d.rotate(dAngleInRadians,dX,dY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dFH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) - (dH * (iLC - i - 1))) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dX,dY);
    }
 else     if (dAngleInDegrees == -90) {
      double dDeltaX=dFW - dH;
      double dDeltaY=(dFW + dH) / 2;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dX,dY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) + (dH * i)) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dX,dY);
    }
  }
  finally {
    itm.dispose();
  }
}

Fixed version (ground truth):
private final void showLeftValue(IPrimitiveRenderer ipr,Location lo,Label la,int iLabelPosition,boolean bShadow){
  Graphics2D g2d=(Graphics2D)((IDeviceRenderer)ipr).getGraphicsContext();
  FontDefinition fd=la.getCaption().getFont();
  double dAngleInDegrees=fd.getRotation();
  if (bShadow) {
    bShadow=la.getShadowColor() != null;
  }
  Color clrText=(Color)_sxs.getColor(la.getCaption().getColor());
  Color clrBackground=null;
  if (la.getBackground() != null) {
    clrBackground=(Color)_sxs.getColor((ColorDefinition)la.getBackground());
  }
  final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
  final double dSineTheta=(Math.sin(dAngleInRadians));
  final double dCosTheta=(Math.cos(dAngleInRadians));
  final ITextMetrics itm=_sxs.getTextMetrics(la);
  lo=adjustTextPosition(iLabelPosition,lo,itm,dAngleInDegrees);
  double dX=lo.getX(), dY=lo.getY();
  try {
    final double dFW=itm.getFullWidth();
    final double dH=itm.getHeight();
    final double dD=itm.getDescent();
    final double dFH=itm.getFullHeight();
    double dXOffset=0, dW=0;
    final int iLC=itm.getLineCount();
    final Insets ins=la.getInsets().scaledInstance(_sxs.getDpiResolution() / 72d);
    final double shadowness=3 * _sxs.getDpiResolution() / 72d;
    final boolean bEmptyText="String_Node_Str".equals(la.getCaption().getValue());
    TextLayout tl;
    final HorizontalAlignment ha=la.getCaption().getFont().getAlignment().getHorizontalAlignment();
    final boolean bRightAligned=ha.getValue() == HorizontalAlignment.RIGHT;
    final boolean bCenterAligned=ha.getValue() == HorizontalAlignment.CENTER;
    double dRotateX=(dX - dFW);
    double dRotateY=(dY + dH / 2);
    dX-=dFW;
    dY+=dH / 2;
    if (dAngleInDegrees == 0) {
      double dYHalfOffset=(dFH + dH) / 2d;
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dYHalfOffset) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dYHalfOffset) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dYHalfOffset) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dYHalfOffset,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(dY - dYHalfOffset + ins.getTop() + dH * (i + 1) - dD));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
    }
 else     if (dAngleInDegrees > 0 && dAngleInDegrees < 90) {
      double dDeltaX=dFW - dFW * dCosTheta;
      double dDeltaY=dFW * dSineTheta + dH / 2 - dH * dCosTheta / 2.0;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dFH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < itm.getLineCount(); i++) {
            tl=((SwingTextMetrics)itm).getLayout(iLC - i - 1);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) - (dH * i)) - ins.getBottom()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
    }
 else     if (dAngleInDegrees < 0 && dAngleInDegrees > -90) {
      double dDeltaX=dFW - dFW * dCosTheta - dH * dSineTheta;
      double dDeltaY=+dFW * dSineTheta - dH / 2 + dH * dCosTheta / 2;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) + (dH * i)) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dRotateX + dDeltaX,dRotateY - dDeltaY);
    }
 else     if (dAngleInDegrees == 90) {
      double dDeltaX=dFW;
      double dDeltaY=(dFW - dH) / 2;
      dX+=dDeltaX;
      dY+=dDeltaY;
      g2d.rotate(dAngleInRadians,dX,dY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dFH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) - (dH * (iLC - i - 1))) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dX,dY);
    }
 else     if (dAngleInDegrees == -90) {
      double dDeltaX=dFW - dH;
      double dDeltaY=(dFW + dH) / 2;
      dX+=dDeltaX;
      dY-=dDeltaY;
      g2d.rotate(dAngleInRadians,dX,dY);
      if (bShadow) {
        g2d.setPaint(new GradientPaint(new Point2D.Double(dX + shadowness,(dY - dFH) + shadowness),(Color)_sxs.getColor(la.getShadowColor()),new Point2D.Double(dX + shadowness + dFW,(dY - dFH) + shadowness + dFH),(Color)_sxs.getColor(la.getShadowColor().translucent())));
        g2d.fill(new Rectangle2D.Double(dX + shadowness,(dY - dFH) + shadowness,dFW,dFH));
      }
 else {
        final Rectangle2D.Double r2d=new Rectangle2D.Double(dX,dY - dH,dFW,dFH);
        if (clrBackground != null) {
          g2d.setColor(clrBackground);
          g2d.fill(r2d);
        }
        if (!bEmptyText) {
          g2d.setColor(clrText);
          for (int i=0; i < iLC; i++) {
            tl=((SwingTextMetrics)itm).getLayout(i);
            if (bRightAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + dFW - dW - ins.getRight();
            }
 else             if (bCenterAligned) {
              dW=tl.getBounds().getWidth();
              dXOffset=-ins.getLeft() + (dFW - dW) / 2;
            }
            tl.draw(g2d,(float)(dX + dXOffset + ins.getLeft()),(float)(((dY - dD) + (dH * i)) + ins.getTop()));
          }
        }
        renderOutline(ipr,la.getOutline(),r2d);
      }
      g2d.rotate(-dAngleInRadians,dX,dY);
    }
  }
  finally {
    itm.dispose();
  }
}