Program: 154100
Project: 154100
Buggy source:
/** 
 * Computes a tile.  A new <code>WritableRaster</code> is created to represent the requested tile.  Its width and height are equal to this image's tile width and tile height respectively.  If the requested tile lies outside of the image's boundary, or if the backward mapped and padded tile region does not intersect all sources, the created raster is returned with all of its pixels set to 0. <p> Whether or not this method performs source cobbling is determined by the <code>cobbleSources</code> variable set at construction time. If <code>cobbleSources</code> is <code>true</code>, cobbling is performed on the source for areas that intersect multiple tiles, and <code>computeRect(Raster[], WritableRaster, Rectangle)</code> is called to perform the actual computation.  Otherwise, <code>computeRect(PlanarImage[], WritableRaster, Rectangle)</code> is called to perform the actual computation.
 * @param tileX The X index of the tile.
 * @param tileY The Y index of the tile.
 * @return The tile as a <code>Raster</code>.
 */
public Raster computeTile(int tileX,int tileY){
  Point org=new Point(tileXToX(tileX),tileYToY(tileY));
  WritableRaster dest=createWritableRaster(sampleModel,org);
  Rectangle destRect=getTileRect(tileX,tileY).intersection(getBounds());
  if (destRect.isEmpty()) {
    if (setBackground) {
      ImageUtil.fillBackground(dest,destRect,backgroundValues);
    }
    return dest;
  }
  int numSources=getNumSources();
  if (cobbleSources) {
    Raster[] rasterSources=new Raster[numSources];
    for (int i=0; i < numSources; i++) {
      PlanarImage source=getSource(i);
      Rectangle srcRect=mapDestRect(destRect,i);
      if (srcRect == null) {
        srcRect=source.getBounds();
      }
 else       if (!srcRect.intersects(source.getBounds())) {
        if (setBackground) {
          ImageUtil.fillBackground(dest,destRect,backgroundValues);
        }
        return dest;
      }
      rasterSources[i]=extender != null ? source.getExtendedData(srcRect,extender) : source.getData(srcRect);
    }
    computeRect(rasterSources,dest,destRect);
    for (int i=0; i < numSources; i++) {
      Raster sourceData=rasterSources[i];
      if (sourceData != null) {
        PlanarImage source=getSourceImage(i);
        if (source.overlapsMultipleTiles(sourceData.getBounds())) {
          recycleTile(sourceData);
        }
      }
    }
  }
 else {
    PlanarImage[] imageSources=new PlanarImage[numSources];
    for (int i=0; i < numSources; i++) {
      imageSources[i]=getSource(i);
    }
    computeRect(imageSources,dest,destRect);
  }
  return dest;
}

Fixed version (ground truth):
/** 
 * Computes a tile.  A new <code>WritableRaster</code> is created to represent the requested tile.  Its width and height are equal to this image's tile width and tile height respectively.  If the requested tile lies outside of the image's boundary, or if the backward mapped and padded tile region does not intersect all sources, the created raster is returned with all of its pixels set to 0. <p> Whether or not this method performs source cobbling is determined by the <code>cobbleSources</code> variable set at construction time. If <code>cobbleSources</code> is <code>true</code>, cobbling is performed on the source for areas that intersect multiple tiles, and <code>computeRect(Raster[], WritableRaster, Rectangle)</code> is called to perform the actual computation.  Otherwise, <code>computeRect(PlanarImage[], WritableRaster, Rectangle)</code> is called to perform the actual computation.
 * @param tileX The X index of the tile.
 * @param tileY The Y index of the tile.
 * @return The tile as a <code>Raster</code>.
 */
public Raster computeTile(int tileX,int tileY){
  Point org=new Point(tileXToX(tileX),tileYToY(tileY));
  WritableRaster dest=createWritableRaster(sampleModel,org);
  Rectangle destRect=getTileRect(tileX,tileY).intersection(getBounds());
  if (destRect.isEmpty()) {
    if (setBackground) {
      ImageUtil.fillBackground(dest,destRect,backgroundValues);
    }
    return dest;
  }
  int numSources=getNumSources();
  if (cobbleSources) {
    Raster[] rasterSources=new Raster[numSources];
    for (int i=0; i < numSources; i++) {
      PlanarImage source=getSource(i);
      Rectangle srcBounds=source.getBounds();
      Rectangle srcRect=mapDestRect(destRect,i);
      if (srcRect == null) {
        srcRect=srcBounds;
      }
 else {
        if (extender == null && !srcBounds.contains(srcRect)) {
          srcRect=srcBounds.intersection(srcRect);
        }
        if (!srcRect.intersects(srcBounds)) {
          if (setBackground) {
            ImageUtil.fillBackground(dest,destRect,backgroundValues);
          }
          return dest;
        }
      }
      rasterSources[i]=extender != null ? source.getExtendedData(srcRect,extender) : source.getData(srcRect);
    }
    computeRect(rasterSources,dest,destRect);
    for (int i=0; i < numSources; i++) {
      Raster sourceData=rasterSources[i];
      if (sourceData != null) {
        PlanarImage source=getSourceImage(i);
        if (source.overlapsMultipleTiles(sourceData.getBounds())) {
          recycleTile(sourceData);
        }
      }
    }
  }
 else {
    PlanarImage[] imageSources=new PlanarImage[numSources];
    for (int i=0; i < numSources; i++) {
      imageSources[i]=getSource(i);
    }
    computeRect(imageSources,dest,destRect);
  }
  return dest;
}