Program: 75861
Project: 75861
Buggy source:
public void fillRectangle(RectangleRenderEvent rre) throws ChartException {
  final Fill flBackground=validateMultipleFill(rre.getBackground());
  if (isFullTransparent(flBackground)) {
    return;
  }
  final Bounds bo=normalizeBounds(rre.getBounds());
  final Rectangle2D.Double r2d=new Rectangle2D.Double(bo.getLeft(),bo.getTop(),bo.getWidth(),bo.getHeight());
  if (flBackground instanceof ColorDefinition) {
    final ColorDefinition cd=(ColorDefinition)flBackground;
    _g2d.setColor((Color)_ids.getColor(cd));
    _g2d.fill(r2d);
  }
 else   if (flBackground instanceof Gradient) {
    final Gradient g=(Gradient)flBackground;
    final ColorDefinition cdStart=g.getStartColor();
    final ColorDefinition cdEnd=g.getEndColor();
    double dAngleInDegrees=g.getDirection();
    final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
    if (dAngleInDegrees < -90 || dAngleInDegrees > 90) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{new Double(dAngleInDegrees)},Messages.getResourceBundle(getULocale()));
    }
    Point2D.Double p2dStart, p2dEnd;
    if (dAngleInDegrees == 90) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dEnd=new Point2D.Double(bo.getLeft(),bo.getTop());
    }
 else     if (dAngleInDegrees == -90) {
      p2dEnd=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
    }
 else     if (dAngleInDegrees > 0) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop() + bo.getHeight() - bo.getWidth() * Math.abs(Math.tan(dAngleInRadians)));
    }
 else     if (dAngleInDegrees < 0) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop() + bo.getWidth() * Math.abs(Math.tan(dAngleInRadians)));
    }
 else {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop());
    }
    _g2d.setPaint(new GradientPaint(p2dStart,(Color)_ids.getColor(cdStart),p2dEnd,(Color)_ids.getColor(cdEnd)));
    _g2d.fill(r2d);
  }
 else   if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image) {
    java.awt.Image img=null;
    if (flBackground instanceof EmbeddedImage) {
      try {
        String imageData=((EmbeddedImage)flBackground).getData();
        if (imageData == null) {
          imageData="String_Node_Str";
        }
        byte[] data=Base64.decodeBase64(imageData.getBytes());
        img=createImage(data);
      }
 catch (      Exception ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
    }
 else {
      try {
        final String sUrl=((org.eclipse.birt.chart.model.attribute.Image)flBackground).getURL();
        img=(java.awt.Image)_ids.loadImage(new URL(sUrl));
      }
 catch (      ChartException ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
catch (      MalformedURLException muex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,muex);
      }
    }
    final Shape shClip=_g2d.getClip();
    Area ar2=new Area(r2d);
    if (shClip != null) {
      Area ar1=new Area(shClip);
      ar2.intersect(ar1);
    }
    _g2d.setClip(ar2);
    final Size szImage=_ids.getSize(img);
    int iXRepeat=(int)(Math.ceil(r2d.width / szImage.getWidth()));
    int iYRepeat=(int)(Math.ceil(r2d.height / szImage.getHeight()));
    ImageObserver io=(ImageObserver)_ids.getObserver();
    for (int i=0; i < iXRepeat; i++) {
      for (int j=0; j < iYRepeat; j++) {
        _g2d.drawImage(img,(int)(r2d.x + i * szImage.getWidth()),(int)(r2d.y + j * szImage.getHeight()),io);
      }
    }
    _g2d.setClip(shClip);
  }
}

Fixed version (ground truth):
public void fillRectangle(RectangleRenderEvent rre) throws ChartException {
  iv.modifyEvent(rre);
  final Fill flBackground=validateMultipleFill(rre.getBackground());
  if (isFullTransparent(flBackground)) {
    return;
  }
  final Bounds bo=normalizeBounds(rre.getBounds());
  final Rectangle2D.Double r2d=new Rectangle2D.Double(bo.getLeft(),bo.getTop(),bo.getWidth(),bo.getHeight());
  if (flBackground instanceof ColorDefinition) {
    final ColorDefinition cd=(ColorDefinition)flBackground;
    _g2d.setColor((Color)_ids.getColor(cd));
    _g2d.fill(r2d);
  }
 else   if (flBackground instanceof Gradient) {
    final Gradient g=(Gradient)flBackground;
    final ColorDefinition cdStart=g.getStartColor();
    final ColorDefinition cdEnd=g.getEndColor();
    double dAngleInDegrees=g.getDirection();
    final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
    if (dAngleInDegrees < -90 || dAngleInDegrees > 90) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{new Double(dAngleInDegrees)},Messages.getResourceBundle(getULocale()));
    }
    Point2D.Double p2dStart, p2dEnd;
    if (dAngleInDegrees == 90) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dEnd=new Point2D.Double(bo.getLeft(),bo.getTop());
    }
 else     if (dAngleInDegrees == -90) {
      p2dEnd=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
    }
 else     if (dAngleInDegrees > 0) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop() + bo.getHeight());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop() + bo.getHeight() - bo.getWidth() * Math.abs(Math.tan(dAngleInRadians)));
    }
 else     if (dAngleInDegrees < 0) {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop() + bo.getWidth() * Math.abs(Math.tan(dAngleInRadians)));
    }
 else {
      p2dStart=new Point2D.Double(bo.getLeft(),bo.getTop());
      p2dEnd=new Point2D.Double(bo.getLeft() + bo.getWidth(),bo.getTop());
    }
    _g2d.setPaint(new GradientPaint(p2dStart,(Color)_ids.getColor(cdStart),p2dEnd,(Color)_ids.getColor(cdEnd)));
    _g2d.fill(r2d);
  }
 else   if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image) {
    java.awt.Image img=null;
    if (flBackground instanceof EmbeddedImage) {
      try {
        String imageData=((EmbeddedImage)flBackground).getData();
        if (imageData == null) {
          imageData="String_Node_Str";
        }
        byte[] data=Base64.decodeBase64(imageData.getBytes());
        img=createImage(data);
      }
 catch (      Exception ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
    }
 else {
      try {
        final String sUrl=((org.eclipse.birt.chart.model.attribute.Image)flBackground).getURL();
        img=(java.awt.Image)_ids.loadImage(new URL(sUrl));
      }
 catch (      ChartException ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
catch (      MalformedURLException muex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,muex);
      }
    }
    final Shape shClip=_g2d.getClip();
    Area ar2=new Area(r2d);
    if (shClip != null) {
      Area ar1=new Area(shClip);
      ar2.intersect(ar1);
    }
    _g2d.setClip(ar2);
    final Size szImage=_ids.getSize(img);
    int iXRepeat=(int)(Math.ceil(r2d.width / szImage.getWidth()));
    int iYRepeat=(int)(Math.ceil(r2d.height / szImage.getHeight()));
    ImageObserver io=(ImageObserver)_ids.getObserver();
    for (int i=0; i < iXRepeat; i++) {
      for (int j=0; j < iYRepeat; j++) {
        _g2d.drawImage(img,(int)(r2d.x + i * szImage.getWidth()),(int)(r2d.y + j * szImage.getHeight()),io);
      }
    }
    _g2d.setClip(shClip);
  }
}