Program: 170421
Project: 170421
Buggy source:
@Override protected void drawWithoutTransforms(final Context2D context,final double alpha,final BoundingBox bounds){
  if (false == isVisible()) {
    return;
  }
  final Viewport vp=getViewport();
  final int vw=vp.getWidth();
  final int vh=vp.getHeight();
  final Point2D a=new Point2D(0,0);
  final Point2D b=new Point2D(vw,vh);
  double scaleX=1, scaleY=1;
  Transform t=isTransformable() ? vp.getTransform() : null;
  if (t != null) {
    scaleX=t.getScaleX();
    scaleY=t.getScaleY();
    t=t.getInverse();
    t.transform(a,a);
    t.transform(b,b);
  }
  final double x1=a.getX();
  final double y1=a.getY();
  final double x2=b.getX();
  final double y2=b.getY();
  for (int direction=X; direction <= Y; direction++) {
    final boolean vertical=(direction == X);
    final double scale=vertical ? scaleX : scaleY;
    final double min=vertical ? x1 : y1;
    final double max=vertical ? x2 : y2;
    for (int primSec=0; primSec <= 1; primSec++) {
      final int index=(primSec * 2) + direction;
      final boolean isSecondary=(primSec == 1);
      if (m_lines[index] == null) {
        continue;
      }
      int n=0;
      if (isSecondary) {
        n=(int)Math.round(m_sizes[direction] / m_sizes[index]);
      }
      final Line line=m_lines[index];
      final double size=m_sizes[index];
      final double previousLineWidth=line.getStrokeWidth();
      line.setStrokeWidth(previousLineWidth / scale);
      final DashArray previousDashes=line.getDashArray();
      if (previousDashes != null) {
        final double[] d=previousDashes.getNormalizedArray();
        final DashArray dashes=new DashArray();
        for (        final double element : d) {
          dashes.push(element / scale);
        }
        line.setDashArray(dashes);
      }
      long n1=Math.round(min / size);
      if ((n1 * size) < min) {
        n1++;
      }
      long n2=Math.round(max / size);
      if ((n2 * size) > max) {
        n2--;
      }
      final Point2DArray points=line.getPoints();
      final Point2D p1=points.get(0);
      final Point2D p2=points.get(1);
      if (vertical) {
        p1.setY(y1);
        p2.setY(y2);
      }
 else {
        p1.setX(x1);
        p2.setX(x2);
      }
      for (long ni=n1; ni <= n2; ni++) {
        if (isSecondary && ((ni % n) == 0)) {
          continue;
        }
        if (vertical) {
          final double x=ni * size;
          p1.setX(x);
          p2.setX(x);
        }
 else {
          final double y=ni * size;
          p1.setY(y);
          p2.setY(y);
        }
        line.drawWithTransforms(context,alpha,bounds);
      }
      line.setStrokeWidth(previousLineWidth);
      if (previousDashes != null) {
        line.setDashArray(previousDashes);
      }
    }
  }
  super.drawWithoutTransforms(context,alpha,bounds);
}

Fixed version (ground truth):
@Override protected void drawWithoutTransforms(final Context2D context,final double alpha,final BoundingBox bounds){
  if (false == isVisible()) {
    return;
  }
  final Viewport vp=getViewport();
  final int vw=vp.getWidth();
  final int vh=vp.getHeight();
  final Point2D a=new Point2D(0,0);
  final Point2D b=new Point2D(vw,vh);
  double scaleX=1, scaleY=1;
  Transform t=isTransformable() ? vp.getTransform() : null;
  if (t != null) {
    scaleX=t.getScaleX();
    scaleY=t.getScaleY();
    t=t.getInverse();
    t.transform(a,a);
    t.transform(b,b);
  }
  final double x1=a.getX();
  final double y1=a.getY();
  final double x2=b.getX();
  final double y2=b.getY();
  for (int direction=X; direction <= Y; direction++) {
    final boolean vertical=(direction == X);
    final double scale=vertical ? scaleX : scaleY;
    final double min=vertical ? x1 : y1;
    final double max=vertical ? x2 : y2;
    for (int primSec=0; primSec <= 1; primSec++) {
      final int index=(primSec * 2) + direction;
      final boolean isSecondary=(primSec == 1);
      if (m_lines[index] == null) {
        continue;
      }
      int n=0;
      if (isSecondary) {
        n=(int)Math.round(m_sizes[direction] / m_sizes[index]);
      }
      final Line line=m_lines[index];
      final double size=m_sizes[index];
      final double previousLineWidth=line.getStrokeWidth();
      line.setStrokeWidth(previousLineWidth / scale);
      final DashArray previousDashes=line.getDashArray();
      final double[] d=previousDashes.getNormalizedArray();
      final DashArray dashes=new DashArray();
      for (      final double element : d) {
        dashes.push(element / scale);
      }
      line.setDashArray(dashes);
      long n1=Math.round(min / size);
      if ((n1 * size) < min) {
        n1++;
      }
      long n2=Math.round(max / size);
      if ((n2 * size) > max) {
        n2--;
      }
      final Point2DArray points=line.getPoints();
      final Point2D p1=points.get(0);
      final Point2D p2=points.get(1);
      if (vertical) {
        p1.setY(y1);
        p2.setY(y2);
      }
 else {
        p1.setX(x1);
        p2.setX(x2);
      }
      for (long ni=n1; ni <= n2; ni++) {
        if (isSecondary && ((ni % n) == 0)) {
          continue;
        }
        if (vertical) {
          final double x=ni * size;
          p1.setX(x);
          p2.setX(x);
        }
 else {
          final double y=ni * size;
          p1.setY(y);
          p2.setY(y);
        }
        line.drawWithTransforms(context,alpha,bounds);
      }
      line.setStrokeWidth(previousLineWidth);
      line.setDashArray(previousDashes);
    }
  }
  super.drawWithoutTransforms(context,alpha,bounds);
}