Program: 46630
Project: 46630
Buggy source:
private void findPerfHolePoints(RenderedImage img){
  perfBorderX=new int[img.getHeight()];
  Rectangle perfArea=new Rectangle(0,0,img.getWidth() / 4,img.getHeight());
  RectIter iter=RectIterFactory.create(img,perfArea);
  SampleModel sm=img.getSampleModel();
  int nbands=sm.getNumBands();
  int[] pixel=new int[nbands];
  int perfPixelCount=0;
  int x=0, y=-1;
  int perfStartY=-1;
  int perfEndY=-1;
  boolean isPerforation=false;
  int linesToDecide=-1;
  int[] lastLines=new int[MEDIAN_WINDOW];
  int n=0;
  System.out.println("String_Node_Str");
  while (!iter.nextLineDone()) {
    y++;
    int pixelsInLine=0;
    perfBorderX[y]=0;
    x=0;
    iter.startPixels();
    while (!iter.nextPixelDone()) {
      iter.getPixel(pixel);
      if (pixel[0] > 0) {
        perfPixelCount++;
        pixelsInLine++;
      }
 else       if (pixelsInLine > PERF_HOLE_THRESHOLD) {
        perfBorderX[y]=x;
        break;
      }
      x++;
    }
    lastLines[n]=pixelsInLine;
    n++;
    if (n >= MEDIAN_WINDOW) {
      n=0;
    }
    int medianPixels=median(lastLines);
    if (y < MEDIAN_WINDOW) {
      continue;
    }
    if (isPerforation) {
      if (medianPixels < PERF_HOLE_THRESHOLD) {
        perfEndY=y - (MEDIAN_WINDOW >> 1);
        int perfCenterY=(perfEndY + perfStartY) >> 1;
        int perfCenterX=getFrameLeft(perfStartY,perfEndY);
        if (perfCenterX > 0) {
          System.out.println(String.format("String_Node_Str",perfCenterX,perfCenterY));
          perfY.add(perfCenterY);
          perfX.add(perfCenterX);
          int imageY=perfCenterY - 200;
          imageY=Math.max(0,imageY);
          saveDebugImage(maskImage,"String_Node_Str",0,imageY,300,Math.min(400,maskImage.getHeight() - imageY));
        }
        isPerforation=false;
      }
    }
 else {
      if (medianPixels > PERF_HOLE_THRESHOLD) {
        perfStartY=y - (MEDIAN_WINDOW >> 1);
        isPerforation=true;
      }
    }
  }
}

Fixed version (ground truth):
private void findPerfHolePoints(RenderedImage img){
  perfBorderX=new int[img.getHeight()];
  Rectangle perfArea=new Rectangle(0,0,img.getWidth() / 4,img.getHeight());
  RectIter iter=RectIterFactory.create(img,perfArea);
  SampleModel sm=img.getSampleModel();
  int nbands=sm.getNumBands();
  int[] pixel=new int[nbands];
  int x=0, y=-1;
  int perfStartY=-1;
  int perfEndY=-1;
  boolean isPerforation=false;
  int linesToDecide=-1;
  int[] lastLines=new int[MEDIAN_WINDOW];
  int n=0;
  System.out.println("String_Node_Str");
  while (!iter.nextLineDone()) {
    y++;
    int pixelsInLine=0;
    perfBorderX[y]=0;
    x=0;
    iter.startPixels();
    while (!iter.nextPixelDone()) {
      iter.getPixel(pixel);
      if (pixel[0] > 0) {
        pixelsInLine++;
      }
 else       if (pixelsInLine > PERF_HOLE_THRESHOLD) {
        perfBorderX[y]=x;
        break;
      }
      x++;
    }
    lastLines[n]=pixelsInLine;
    n++;
    if (n >= MEDIAN_WINDOW) {
      n=0;
    }
    int medianPixels=median(lastLines);
    if (y < MEDIAN_WINDOW) {
      continue;
    }
    if (isPerforation) {
      if (medianPixels <= PERF_HOLE_THRESHOLD) {
        perfEndY=y - (MEDIAN_WINDOW >> 1);
        int perfCenterY=(perfEndY + perfStartY) >> 1;
        int perfCenterX=getFrameLeft(perfStartY,perfEndY);
        if (perfCenterX > 0) {
          int prevX=0;
          int prevY=0;
          if (perfX.size() >= 1) {
            prevX=perfX.get(perfX.size() - 1);
            prevY=perfY.get(perfY.size() - 1);
          }
          System.out.println(String.format("String_Node_Str",perfCenterX,perfCenterY,perfCenterX - prevX,perfCenterY - prevY));
          perfY.add(perfCenterY);
          perfX.add(perfCenterX);
          int imageY=perfCenterY - 200;
          imageY=Math.max(0,imageY);
          saveDebugImage(maskImage,"String_Node_Str",0,imageY,300,Math.min(400,maskImage.getHeight() - imageY));
        }
        isPerforation=false;
      }
    }
 else {
      if (medianPixels > PERF_HOLE_THRESHOLD) {
        perfStartY=y - (MEDIAN_WINDOW >> 1);
        isPerforation=true;
      }
    }
  }
}