Program: 108797
Project: 108797
Buggy source:
/** 
 * Redraws the plot
 */
public void updatePlot(){
  Graphics2D g2d=(Graphics2D)buffer.getGraphics();
  g2d.setColor(background);
  g2d.fillRect(0,0,buffer.getWidth(),buffer.getHeight());
  if (buffer.getWidth() > OFFSET_LEFT + OFFSET_RIGHT + 100 && buffer.getHeight() > OFFSET_TOP + OFFSET_BOTTOM) {
    int width=buffer.getWidth() - OFFSET_LEFT - OFFSET_RIGHT;
    int height=buffer.getHeight() - OFFSET_TOP - OFFSET_BOTTOM;
    if (heatmap != null) {
      g2d.drawImage(heatmap,OFFSET_LEFT,OFFSET_TOP,width,height,null);
      g2d.setColor(Color.black);
      g2d.drawRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      double tickX=(double)width / (double)heatmap.getWidth();
      if (tickX >= 2d) {
        double currX=tickX;
        while (currX < width - 1) {
          g2d.setColor(Color.darkGray);
          g2d.drawLine(OFFSET_LEFT + (int)currX,OFFSET_TOP + height,OFFSET_LEFT + (int)currX + 1,OFFSET_TOP + height + OFFSET_TICK_SMALL);
          currX+=tickX;
        }
      }
      double tickY=(double)height / (double)heatmap.getHeight();
      if (tickY >= 2d) {
        double currY=tickY;
        while (currY < height - 1) {
          g2d.setColor(Color.darkGray);
          g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + (int)currY,OFFSET_LEFT - OFFSET_TICK_SMALL,OFFSET_TOP + (int)currY + 1);
          currY+=tickY;
        }
      }
    }
 else {
      g2d.setColor(Color.white);
      g2d.fillRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      g2d.setColor(Color.black);
      g2d.drawRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      g2d.setColor(Color.black);
      drawText("String_Node_Str",g2d,OFFSET_LEFT,OFFSET_TOP,width,height);
    }
    RenderingHints hints=g2d.getRenderingHints();
    g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    int legendWidth=buffer.getWidth() - width - OFFSET_LEFT- 2 * OFFSET_LEGEND;
    g2d.drawImage(LEGEND,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP + height,legendWidth,-height,null);
    g2d.setRenderingHints(hints);
    g2d.setColor(Color.black);
    g2d.drawRect(OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP,legendWidth,height);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2d.setColor(Color.black);
    drawText("String_Node_Str",g2d,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP - 15,legendWidth,10);
    drawText("String_Node_Str",g2d,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP + height + 5,legendWidth,10);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP,OFFSET_LEFT - OFFSET_TICK,OFFSET_TOP);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + height,OFFSET_LEFT - OFFSET_TICK,OFFSET_TOP + height);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + height,OFFSET_LEFT,OFFSET_TOP + height + OFFSET_TICK);
    g2d.drawLine(OFFSET_LEFT + width,OFFSET_TOP + height,OFFSET_LEFT + width,OFFSET_TOP + height + OFFSET_TICK);
    if (attribute1 != null && attribute2 != null) {
      g2d.setColor(Color.black);
      g2d.setFont(FONT);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      drawText(attribute2,g2d,OFFSET_LEFT,OFFSET_TOP + height + 4,width,10);
      g2d.rotate(Math.PI / 2);
      drawText(attribute1,g2d,OFFSET_TOP,-OFFSET_LEFT + 4,height,10);
      g2d.rotate(-Math.PI / 2);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
  }
  g2d.dispose();
}

Fixed version (ground truth):
/** 
 * Redraws the plot
 */
public void updatePlot(){
  Graphics2D g2d=(Graphics2D)buffer.getGraphics();
  g2d.setColor(background);
  g2d.fillRect(0,0,buffer.getWidth(),buffer.getHeight());
  if (buffer.getWidth() > OFFSET_LEFT + OFFSET_RIGHT + 100 && buffer.getHeight() > OFFSET_TOP + OFFSET_BOTTOM) {
    int width=buffer.getWidth() - OFFSET_LEFT - OFFSET_RIGHT;
    int height=buffer.getHeight() - OFFSET_TOP - OFFSET_BOTTOM;
    if (heatmap != null) {
      g2d.drawImage(heatmap,OFFSET_LEFT,OFFSET_TOP,width,height,null);
      g2d.setColor(Color.black);
      g2d.drawRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      double tickX=(double)width / (double)heatmap.getWidth();
      if (tickX >= 2d) {
        double currX=tickX;
        while (currX < width - 1) {
          g2d.setColor(Color.darkGray);
          g2d.drawLine(OFFSET_LEFT + (int)currX,OFFSET_TOP + height,OFFSET_LEFT + (int)currX + 1,OFFSET_TOP + height + OFFSET_TICK_SMALL);
          currX+=tickX;
        }
      }
      double tickY=(double)height / (double)heatmap.getHeight();
      if (tickY >= 2d) {
        double currY=tickY;
        while (currY < height - 1) {
          g2d.setColor(Color.darkGray);
          g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + (int)currY,OFFSET_LEFT - OFFSET_TICK_SMALL,OFFSET_TOP + (int)currY + 1);
          currY+=tickY;
        }
      }
    }
 else {
      g2d.setColor(Color.white);
      g2d.fillRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      g2d.setColor(Color.black);
      g2d.drawRect(OFFSET_LEFT,OFFSET_TOP,width,height);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      g2d.setColor(Color.black);
      drawText("String_Node_Str",g2d,OFFSET_LEFT,OFFSET_TOP,width,height);
    }
    RenderingHints hints=g2d.getRenderingHints();
    g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    int legendWidth=buffer.getWidth() - width - OFFSET_LEFT- 2 * OFFSET_LEGEND;
    g2d.drawImage(LEGEND,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP + height,legendWidth,-height,null);
    g2d.setRenderingHints(hints);
    g2d.setColor(Color.black);
    g2d.drawRect(OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP,legendWidth,height);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2d.setColor(Color.black);
    drawText("String_Node_Str",g2d,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP - 15,legendWidth,10);
    drawText("String_Node_Str",g2d,OFFSET_LEFT + width + OFFSET_LEGEND,OFFSET_TOP + height + 5,legendWidth,10);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP,OFFSET_LEFT - OFFSET_TICK,OFFSET_TOP);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + height,OFFSET_LEFT - OFFSET_TICK,OFFSET_TOP + height);
    g2d.drawLine(OFFSET_LEFT,OFFSET_TOP + height,OFFSET_LEFT,OFFSET_TOP + height + OFFSET_TICK);
    g2d.drawLine(OFFSET_LEFT + width,OFFSET_TOP + height,OFFSET_LEFT + width,OFFSET_TOP + height + OFFSET_TICK);
    if (attribute1 != null && attribute2 != null) {
      g2d.setColor(Color.black);
      g2d.setFont(FONT);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      drawText(attribute1,g2d,OFFSET_LEFT,OFFSET_TOP + height + 4,width,10);
      g2d.rotate(Math.PI / 2);
      drawText(attribute2,g2d,OFFSET_TOP,-OFFSET_LEFT + 4,height,10);
      g2d.rotate(-Math.PI / 2);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
  }
  g2d.dispose();
}