Program: 78112
Project: 78112
Buggy source:
private void addLogoAtPosition(BufferedImage img,BufferedImage logo,RelativeRectangle position) throws ServiceException {
  double imgWidth=img.getWidth();
  double imgHeight=img.getHeight();
  double relativeXPosition=position.getX();
  double relativeYPosition=position.getY();
  int absoluteXPosition=(int)(imgWidth * relativeXPosition / (100d));
  int absoluteYPosition=(int)(imgHeight * relativeYPosition / (100d));
  double relativeLogoWidth=position.getWidth();
  double relativeLogoHeight=position.getHeight();
  LogoWatermarkServiceImageObserver observer=new LogoWatermarkServiceImageObserver(this);
  Graphics g=img.getGraphics();
  try {
    if (relativeLogoHeight == -1 && relativeLogoWidth == -1) {
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,observer);
      this.wait();
    }
 else     if (relativeLogoHeight == -1 && relativeLogoWidth > 0) {
      double absoluteLogoWidth=relativeLogoWidth / (100d) * imgWidth;
      double absoluteLogoHeight=relativeLogoHeight / relativeLogoWidth * absoluteLogoWidth;
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,(int)absoluteLogoWidth,(int)absoluteLogoHeight,observer);
      this.wait();
    }
 else     if (relativeLogoHeight > 0 && relativeLogoWidth == -1) {
      double absoluteLogoHeigth=relativeLogoHeight / (100d) * imgHeight;
      double absoluteLogoWidth=relativeLogoWidth / relativeLogoHeight * absoluteLogoHeigth;
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,(int)absoluteLogoWidth,(int)absoluteLogoHeigth,observer);
      this.wait();
    }
 else     if (relativeLogoHeight > 0 && relativeLogoWidth > 0) {
      double absoluteLogoHeigth=relativeLogoHeight / (100d) * imgHeight;
      double absoluteLogoWidth=relativeLogoWidth / (100d) * imgWidth;
      this.wait();
    }
 else {
      LOGGER.error("String_Node_Str");
      throw new ServiceException("String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str" + e);
    throw new ServiceException(e);
  }
}

Fixed version (ground truth):
private void addLogoAtPosition(BufferedImage img,BufferedImage logo,RelativeRectangle position) throws ServiceException {
  double imgWidth=img.getWidth();
  double imgHeight=img.getHeight();
  double relativeXPosition=position.getX();
  double relativeYPosition=position.getY();
  int absoluteXPosition=(int)(imgWidth * relativeXPosition / (100d));
  int absoluteYPosition=(int)(imgHeight * relativeYPosition / (100d));
  double relativeLogoWidth=position.getWidth();
  double relativeLogoHeight=position.getHeight();
  LogoWatermarkServiceImageObserver observer=new LogoWatermarkServiceImageObserver(this);
  Graphics g=img.getGraphics();
  try {
    if (relativeLogoHeight == -1 && relativeLogoWidth == -1) {
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,observer);
      this.wait();
    }
 else     if (relativeLogoHeight == -1 && relativeLogoWidth > 0) {
      double absoluteLogoWidth=relativeLogoWidth / (100d) * imgWidth;
      double absoluteLogoHeight=relativeLogoHeight / relativeLogoWidth * absoluteLogoWidth;
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,(int)absoluteLogoWidth,(int)absoluteLogoHeight,observer);
      this.wait();
    }
 else     if (relativeLogoHeight > 0 && relativeLogoWidth == -1) {
      double absoluteLogoHeigth=relativeLogoHeight / (100d) * imgHeight;
      double absoluteLogoWidth=relativeLogoWidth / relativeLogoHeight * absoluteLogoHeigth;
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,(int)absoluteLogoWidth,(int)absoluteLogoHeigth,observer);
      this.wait();
    }
 else     if (relativeLogoHeight > 0 && relativeLogoWidth > 0) {
      double absoluteLogoHeigth=relativeLogoHeight / (100d) * imgHeight;
      double absoluteLogoWidth=relativeLogoWidth / (100d) * imgWidth;
      g.drawImage(logo,absoluteXPosition,absoluteYPosition,(int)absoluteLogoWidth,(int)absoluteLogoHeigth,observer);
      this.wait();
    }
 else {
      LOGGER.error("String_Node_Str");
      throw new ServiceException("String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    LOGGER.error("String_Node_Str" + e);
    throw new ServiceException(e);
  }
 finally {
    g.finalize();
  }
}