Program: 11565
Project: 11565
Buggy source:
/** 
 * Called by the framework in order to compute the stack of tiles for the given target bands. <p>The default implementation throws a runtime exception with the message "not implemented".</p>
 * @param targetTiles     The current tiles to be computed for each target band.
 * @param targetRectangle The area in pixel coordinates to be computed (same for all rasters in <code>targetRasters</code>).
 * @param pm              A progress monitor which should be used to determine computation cancelation requests.
 * @throws OperatorException if an error occurs during computation of the target rasters.
 */
@Override public void computeTileStack(Map<Band,Tile> targetTiles,Rectangle targetRectangle,ProgressMonitor pm) throws OperatorException {
  try {
    final int tx0=targetRectangle.x;
    final int ty0=targetRectangle.y;
    final int tw=targetRectangle.width;
    final int th=targetRectangle.height;
    final int tyMax=ty0 + th;
    final int txMax=tx0 + tw;
    final int maxShift=(int)computeMaxShift(txMax);
    final Rectangle sourceRectangle=getSourceRectangle(tx0,ty0,tw,th,maxShift);
    final int sx0=sourceRectangle.x;
    final int sy0=sourceRectangle.y;
    final int sw=sourceRectangle.width;
    final int sh=sourceRectangle.height;
    final int syMax=sy0 + sh;
    final int sxMax=sx0 + sw;
    final Set<Band> keySet=targetTiles.keySet();
    double totalShift;
    for (    Band targetBand : keySet) {
      final Tile targetTile=targetTiles.get(targetBand);
      final Tile sourceTile=getSourceTile(sourceProduct.getBand(targetBand.getName()),sourceRectangle);
      final ProductData trgDataBuffer=targetTile.getDataBuffer();
      final ProductData srcDataBuffer=sourceTile.getDataBuffer();
      final TileIndex srcIndex=new TileIndex(sourceTile);
      for (int y=sy0; y < syMax; y++) {
        srcIndex.calculateStride(y);
        for (int x=sx0; x < sxMax; x++) {
          if (useMapreadyShiftOnly) {
            totalShift=Math.round(fracShift * x);
          }
 else           if (useFAQShiftOnly) {
            totalShift=computeShift(x,y);
          }
 else           if (useBoth) {
            double faqShift=computeShift(x,y);
            double fraction=Math.round(fracShift * x);
            totalShift=faqShift + fraction;
          }
 else {
            throw new OperatorException("String_Node_Str");
          }
          final int newy=y + (int)totalShift;
          if (newy >= ty0 && newy < tyMax) {
            final int trgIdx=targetTile.getDataBufferIndex(x,newy);
            trgDataBuffer.setElemFloatAt(trgIdx,srcDataBuffer.getElemFloatAt(srcIndex.getIndex(x)));
          }
        }
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),e);
  }
}

Fixed version (ground truth):
/** 
 * Called by the framework in order to compute the stack of tiles for the given target bands. <p>The default implementation throws a runtime exception with the message "not implemented".</p>
 * @param targetTiles     The current tiles to be computed for each target band.
 * @param targetRectangle The area in pixel coordinates to be computed (same for all rasters in <code>targetRasters</code>).
 * @param pm              A progress monitor which should be used to determine computation cancelation requests.
 * @throws OperatorException if an error occurs during computation of the target rasters.
 */
@Override public void computeTileStack(Map<Band,Tile> targetTiles,Rectangle targetRectangle,ProgressMonitor pm) throws OperatorException {
  try {
    final int tx0=targetRectangle.x;
    final int ty0=targetRectangle.y;
    final int tw=targetRectangle.width;
    final int th=targetRectangle.height;
    final int tyMax=ty0 + th;
    final int txMax=tx0 + tw;
    final int maxShift=(int)computeMaxShift(txMax,ty0);
    final Rectangle sourceRectangle=getSourceRectangle(tx0,ty0,tw,th,maxShift);
    final int sx0=sourceRectangle.x;
    final int sy0=sourceRectangle.y;
    final int sw=sourceRectangle.width;
    final int sh=sourceRectangle.height;
    final int syMax=sy0 + sh;
    final int sxMax=sx0 + sw;
    final Set<Band> keySet=targetTiles.keySet();
    double totalShift;
    for (    Band targetBand : keySet) {
      final Tile targetTile=targetTiles.get(targetBand);
      final Tile sourceTile=getSourceTile(sourceProduct.getBand(targetBand.getName()),sourceRectangle);
      final ProductData trgDataBuffer=targetTile.getDataBuffer();
      final ProductData srcDataBuffer=sourceTile.getDataBuffer();
      final TileIndex srcIndex=new TileIndex(sourceTile);
      for (int y=sy0; y < syMax; y++) {
        srcIndex.calculateStride(y);
        for (int x=sx0; x < sxMax; x++) {
          if (useMapreadyShiftOnly) {
            totalShift=Math.round(fracShift * x);
          }
 else           if (useFAQShiftOnly) {
            totalShift=computeShift(x,y);
          }
 else           if (useBoth) {
            double faqShift=computeShift(x,y);
            double fraction=Math.round(fracShift * x);
            totalShift=faqShift + fraction;
          }
 else {
            throw new OperatorException("String_Node_Str");
          }
          final int newy=y + (int)totalShift;
          if (newy >= ty0 && newy < tyMax) {
            final int trgIdx=targetTile.getDataBufferIndex(x,newy);
            trgDataBuffer.setElemFloatAt(trgIdx,srcDataBuffer.getElemFloatAt(srcIndex.getIndex(x)));
          }
        }
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),e);
  }
}