Program: 69838
Project: 69838
Buggy source:
public byte[] drawImage() throws IOException {
  if (diagonalNumber <= 0 && antidiagonalNumber <= 0) {
    return null;
  }
  if (imageDpi < 0) {
    imageDpi=DEFAULT_IMAGE_DPI;
  }
  int imagePXWidth=HTMLEmitterUtil.getDimensionPixelValue(imageWidth,imageDpi);
  int imagePXHeight=HTMLEmitterUtil.getDimensionPixelValue(imageHeight,imageDpi);
  if (imagePXWidth <= 0) {
    imagePXWidth=DEFAULT_IMAGE_PX_WIDTH;
  }
  if (imagePXHeight <= 0) {
    imagePXHeight=DEFAULT_IMAGE_PX_HEIGHT;
  }
  int diagonalPXWidth=HTMLEmitterUtil.getDimensionPixelValue(diagonalWidth,imageDpi);
  if (diagonalPXWidth <= 0) {
    diagonalPXWidth=1;
  }
  int antidiagonalPXWidth=HTMLEmitterUtil.getDimensionPixelValue(antidiagonalWidth,imageDpi);
  if (antidiagonalPXWidth <= 0) {
    antidiagonalPXWidth=1;
  }
  BufferedImage bufferedImage=new BufferedImage(imagePXWidth,imagePXHeight,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2d=bufferedImage.createGraphics();
  originStroke=g2d.getStroke();
  try {
    if (diagonalStyle != null && !"String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
      Color lineColor=PropertyUtil.getColor(diagonalColor);
      if (lineColor == null) {
        lineColor=color;
      }
      if (lineColor != null) {
        g2d.setColor(lineColor);
      }
      if ("String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
        float dash[]={1,(diagonalPXWidth * 2) - 1 + (diagonalPXWidth % 2)};
        Stroke stroke=new BasicStroke(diagonalPXWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,10.0f,dash,(diagonalPXWidth * 2) - (diagonalPXWidth / 2));
        g2d.setStroke(stroke);
        if (diagonalNumber == 1) {
          g2d.drawLine(0,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
 else         if (diagonalNumber == 2) {
          g2d.drawLine((imagePXWidth / 3) - 1,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,(imagePXHeight / 3) - 1 + (diagonalPXWidth / 2),imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
 else         if (diagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,(imagePXHeight / 2) - 1 + (diagonalPXWidth / 2),imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
      }
 else {
        if ("String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
          float dash[]={3 * diagonalPXWidth};
          Stroke stroke=new BasicStroke(diagonalPXWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.0f,dash,0.0f);
          g2d.setStroke(stroke);
        }
 else {
          if (diagonalPXWidth > 1) {
            g2d.setStroke(new BasicStroke(diagonalPXWidth));
          }
        }
        if (diagonalNumber == 1) {
          g2d.drawLine(0,0,imagePXWidth - 1,imagePXHeight - 1);
        }
 else         if (diagonalNumber == 2) {
          g2d.drawLine((imagePXWidth / 3) - 1,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,(imagePXHeight / 3) - 1,imagePXWidth - 1,imagePXHeight - 1);
        }
 else         if (diagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,(imagePXHeight / 2) - 1,imagePXWidth - 1,imagePXHeight - 1);
        }
      }
    }
    if (antidiagonalStyle != null && !"String_Node_Str".equalsIgnoreCase(antidiagonalStyle)) {
      Color lineColor=PropertyUtil.getColor(antidiagonalColor);
      if (lineColor == null) {
        lineColor=color;
      }
      if (lineColor != null) {
        g2d.setColor(lineColor);
      }
      if ("String_Node_Str".equalsIgnoreCase(antidiagonalStyle)) {
        float dash[]={1,(antidiagonalPXWidth * 2) - 1 + (antidiagonalPXWidth % 2)};
        Stroke stroke=new BasicStroke(antidiagonalPXWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,10.0f,dash,(antidiagonalPXWidth * 2) - (antidiagonalPXWidth / 2));
        g2d.setStroke(stroke);
        if (antidiagonalNumber == 1) {
          g2d.drawLine(imagePXWidth - 1,antidiagonalPXWidth / 2,0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
        }
 else         if (antidiagonalNumber == 2) {
          g2d.drawLine((imagePXWidth * 2 / 3) - 1,antidiagonalPXWidth / 2,0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
          g2d.drawLine(imagePXWidth - 1,(imagePXHeight / 3) - 1 + (antidiagonalPXWidth / 2),0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
        }
 else         if (antidiagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,antidiagonalPXWidth / 2,0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
          g2d.drawLine(imagePXWidth - 1,antidiagonalPXWidth / 2,0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
          g2d.drawLine(imagePXWidth - 1,(imagePXHeight / 2) - 1 + (antidiagonalPXWidth / 2),0,imagePXHeight - 1 + (antidiagonalPXWidth / 2));
        }
      }
 else {
        if ("String_Node_Str".equalsIgnoreCase(antidiagonalStyle)) {
          float dash[]={3 * antidiagonalPXWidth};
          Stroke stroke=new BasicStroke(antidiagonalPXWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.0f,dash,0.0f);
          g2d.setStroke(stroke);
        }
 else {
          if (antidiagonalPXWidth > 1) {
            g2d.setStroke(new BasicStroke(antidiagonalPXWidth));
          }
 else {
            g2d.setStroke(originStroke);
          }
        }
        if (antidiagonalNumber == 1) {
          g2d.drawLine(imagePXWidth - 1,0,0,imagePXHeight - 1);
        }
 else         if (antidiagonalNumber == 2) {
          g2d.drawLine((imagePXWidth * 2 / 3) - 1,0,0,imagePXHeight - 1);
          g2d.drawLine(imagePXWidth - 1,(imagePXHeight / 3) - 1,0,imagePXHeight - 1);
        }
 else         if (antidiagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,0,0,imagePXHeight - 1);
          g2d.drawLine(imagePXWidth - 1,0,0,imagePXHeight - 1);
          g2d.drawLine(imagePXWidth - 1,(imagePXHeight / 2) - 1,0,imagePXHeight - 1);
        }
      }
    }
  }
  finally {
    g2d.dispose();
  }
  byte[] resultImageByteArray=null;
  ByteArrayOutputStream imageStream=new ByteArrayOutputStream();
  ImageIO.write(bufferedImage,"String_Node_Str",imageStream);
  imageStream.flush();
  resultImageByteArray=imageStream.toByteArray();
  imageStream.close();
  return resultImageByteArray;
}

Fixed version (ground truth):
public byte[] drawImage() throws IOException {
  if (diagonalNumber <= 0 && antidiagonalNumber <= 0) {
    return null;
  }
  if (imageDpi < 0) {
    imageDpi=DEFAULT_IMAGE_DPI;
  }
  int imagePXWidth=HTMLEmitterUtil.getDimensionPixelValue(imageWidth,imageDpi);
  int imagePXHeight=HTMLEmitterUtil.getDimensionPixelValue(imageHeight,imageDpi);
  if (imagePXWidth <= 0) {
    imagePXWidth=DEFAULT_IMAGE_PX_WIDTH;
  }
  if (imagePXHeight <= 0) {
    imagePXHeight=DEFAULT_IMAGE_PX_HEIGHT;
  }
  int diagonalPXWidth=HTMLEmitterUtil.getDimensionPixelValue(diagonalWidth,imageDpi);
  if (diagonalPXWidth <= 0) {
    diagonalPXWidth=1;
  }
  int antidiagonalPXWidth=HTMLEmitterUtil.getDimensionPixelValue(antidiagonalWidth,imageDpi);
  if (antidiagonalPXWidth <= 0) {
    antidiagonalPXWidth=1;
  }
  BufferedImage bufferedImage=new BufferedImage(imagePXWidth,imagePXHeight,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2d=bufferedImage.createGraphics();
  originStroke=g2d.getStroke();
  try {
    if (diagonalStyle != null && !"String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
      Color lineColor=PropertyUtil.getColor(diagonalColor);
      if (lineColor == null) {
        lineColor=color;
      }
      if (lineColor != null) {
        g2d.setColor(lineColor);
      }
      if ("String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
        float dash[]={1,(diagonalPXWidth * 2) - 1 + (diagonalPXWidth % 2)};
        Stroke stroke=new BasicStroke(diagonalPXWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,10.0f,dash,(diagonalPXWidth * 2) - (diagonalPXWidth / 2));
        g2d.setStroke(stroke);
        if (diagonalNumber == 1) {
          g2d.drawLine(0,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
 else         if (diagonalNumber == 2) {
          g2d.drawLine((imagePXWidth / 3) - 1,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,(imagePXHeight / 3) - 1 + (diagonalPXWidth / 2),imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
 else         if (diagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,diagonalPXWidth / 2,imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
          g2d.drawLine(0,(imagePXHeight / 2) - 1 + (diagonalPXWidth / 2),imagePXWidth - 1,imagePXHeight - 1 + (diagonalPXWidth / 2));
        }
      }
 else {
        if ("String_Node_Str".equalsIgnoreCase(diagonalStyle)) {
          float dash[]={3 * diagonalPXWidth};
          Stroke stroke=new BasicStroke(diagonalPXWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.0f,dash,0.0f);
          g2d.setStroke(stroke);
        }
 else {
          if (diagonalPXWidth > 1) {
            g2d.setStroke(new BasicStroke(diagonalPXWidth));
          }
        }
        if (diagonalNumber == 1) {
          g2d.drawLine(0,0,imagePXWidth - 1,imagePXHeight - 1);
        }
 else         if (diagonalNumber == 2) {
          g2d.drawLine((imagePXWidth / 3) - 1,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,(imagePXHeight / 3) - 1,imagePXWidth - 1,imagePXHeight - 1);
        }
 else         if (diagonalNumber >= 3) {
          g2d.drawLine((imagePXWidth / 2) - 1,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,0,imagePXWidth - 1,imagePXHeight - 1);
          g2d.drawLine(0,(imagePXHeight / 2) - 1,imagePXWidth - 1,imagePXHeight - 1);
        }
      }
    }
  }
  finally {
    g2d.dispose();
  }
  byte[] resultImageByteArray=null;
  ByteArrayOutputStream imageStream=new ByteArrayOutputStream();
  ImageIO.write(bufferedImage,"String_Node_Str",imageStream);
  imageStream.flush();
  resultImageByteArray=imageStream.toByteArray();
  imageStream.close();
  return resultImageByteArray;
}