Program: 67778
Project: 67778
Buggy source:
/** 
 * Draws background image in a rectangle area with specified repeat pattern. <br> <br> The repeat mode can be: <table border="solid"> <tr> <td align="center"><B>Name</td> <td align="center"><B>What for</td> </tr> <tr> <td>no-repeat</td> <td>Don't repeat.</td> </tr> <tr> <td>repeat-x</td> <td>Only repeat on x orientation.</td> </tr> <tr> <td>repeat-y</td> <td>Only repeat on y orientation.</td> </tr> <tr> <td>repeat</td> <td>Repeat on x and y orientation.</td> </tr> </table>
 * @param imageURI the uri of the background image.
 * @param x the x coordinate of the rectangle area.
 * @param y the y coordinate of the rectangle area.
 * @param width the width of the rectangle area.
 * @param height the height of the rectangle area.
 * @param positionX the initial x position of the background image.
 * @param positionY the initial y position of the background image.
 * @param repeat the repeat mode.
 * @throws Exception 
 */
public void drawBackgroundImage(String imageURI,float x,float y,float width,float height,float imageWidth,float imageHeight,float positionX,float positionY,int repeat) throws IOException {
  if (imageURI == null || imageURI.length() == 0) {
    return;
  }
  org.eclipse.birt.report.engine.layout.emitter.Image image=EmitterUtil.parseImage(null,IImageContent.IMAGE_URL,imageURI,null,null);
  byte[] imageData=image.getData();
  if (imageWidth == 0 || imageHeight == 0) {
    imageWidth=image.getWidth();
    imageHeight=image.getHeight();
  }
  Position imageSize=new Position(imageWidth,imageHeight);
  Position areaPosition=new Position(x,y);
  Position areaSize=new Position(width,height);
  Position imagePosition=new Position(x + positionX,y + positionY);
  BackgroundImageLayout layout=new BackgroundImageLayout(areaPosition,areaSize,imagePosition,imageSize);
  Collection positions=layout.getImagePositions(repeat);
  gSave();
  setColor(Color.WHITE);
  out.println("String_Node_Str");
  drawRawRect(x,y,width,height);
  out.println("String_Node_Str");
  Iterator iterator=positions.iterator();
  while (iterator.hasNext()) {
    Position position=(Position)iterator.next();
    try {
      drawImage(imageURI,new ByteArrayInputStream(imageData),position.getX(),position.getY(),imageSize.getX(),imageSize.getY());
    }
 catch (    Exception e) {
      log.log(Level.WARNING,e.getLocalizedMessage());
    }
  }
  gRestore();
}

Fixed version (ground truth):
/** 
 * Draws background image in a rectangle area with specified repeat pattern. <br> <br> The repeat mode can be: <table border="solid"> <tr> <td align="center"><B>Name</td> <td align="center"><B>What for</td> </tr> <tr> <td>no-repeat</td> <td>Don't repeat.</td> </tr> <tr> <td>repeat-x</td> <td>Only repeat on x orientation.</td> </tr> <tr> <td>repeat-y</td> <td>Only repeat on y orientation.</td> </tr> <tr> <td>repeat</td> <td>Repeat on x and y orientation.</td> </tr> </table>
 * @param imageURI the uri of the background image.
 * @param x the x coordinate of the rectangle area.
 * @param y the y coordinate of the rectangle area.
 * @param width the width of the rectangle area.
 * @param height the height of the rectangle area.
 * @param positionX the initial x position of the background image.
 * @param positionY the initial y position of the background image.
 * @param repeat the repeat mode.
 * @throws Exception 
 */
public void drawBackgroundImage(String imageURI,float x,float y,float width,float height,float imageWidth,float imageHeight,float positionX,float positionY,int repeat) throws IOException {
  if (imageURI == null || imageURI.length() == 0) {
    return;
  }
  org.eclipse.birt.report.engine.layout.emitter.Image image=EmitterUtil.parseImage(null,IImageContent.IMAGE_URL,imageURI,null,null);
  byte[] imageData=image.getData();
  if (imageWidth == 0 || imageHeight == 0) {
    int resolutionX=image.getPhysicalWidthDpi();
    int resolutionY=image.getPhysicalHeightDpi();
    if (0 == resolutionX || 0 == resolutionY) {
      resolutionX=96;
      resolutionY=96;
    }
    imageWidth=image.getWidth() / resolutionX * 72;
    imageHeight=image.getHeight() / resolutionY * 72;
  }
  Position imageSize=new Position(imageWidth,imageHeight);
  Position areaPosition=new Position(x,y);
  Position areaSize=new Position(width,height);
  Position imagePosition=new Position(x + positionX,y + positionY);
  BackgroundImageLayout layout=new BackgroundImageLayout(areaPosition,areaSize,imagePosition,imageSize);
  Collection positions=layout.getImagePositions(repeat);
  gSave();
  setColor(Color.WHITE);
  out.println("String_Node_Str");
  drawRawRect(x,y,width,height);
  out.println("String_Node_Str");
  Iterator iterator=positions.iterator();
  while (iterator.hasNext()) {
    Position position=(Position)iterator.next();
    try {
      drawImage(imageURI,new ByteArrayInputStream(imageData),position.getX(),position.getY(),imageSize.getX(),imageSize.getY());
    }
 catch (    Exception e) {
      log.log(Level.WARNING,e.getLocalizedMessage());
    }
  }
  gRestore();
}