Program: 11438
Project: 11438
Buggy source:
/** 
 * Called by the framework in order to compute a tile for the given target band. <p>The default implementation throws a runtime exception with the message "not implemented".</p>
 * @param targetBand The target band.
 * @param targetTile The current tile associated with the target band to be computed.
 * @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 raster.
 */
@Override public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm) throws OperatorException {
  final Rectangle targetTileRectangle=targetTile.getRectangle();
  final int x0=targetTileRectangle.x;
  final int y0=targetTileRectangle.y;
  final int w=targetTileRectangle.width;
  final int h=targetTileRectangle.height;
  try {
    final String targetBandName=targetBand.getName();
    final ThermalNoiseInfo noiseInfo=getNoiseInfo(targetBandName);
    Tile sourceRaster1=null;
    ProductData srcData1=null;
    ProductData srcData2=null;
    Band sourceBand1=null;
    final String[] srcBandNames=targetBandNameToSourceBandName.get(targetBand.getName());
    if (srcBandNames.length == 1) {
      sourceBand1=sourceProduct.getBand(srcBandNames[0]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
    }
 else {
      sourceBand1=sourceProduct.getBand(srcBandNames[0]);
      final Band sourceBand2=sourceProduct.getBand(srcBandNames[1]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      final Tile sourceRaster2=getSourceTile(sourceBand2,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
      srcData2=sourceRaster2.getDataBuffer();
    }
    final Unit.UnitType bandUnit=Unit.getUnitType(sourceBand1);
    final ProductData trgData=targetTile.getDataBuffer();
    final TileIndex srcIndex=new TileIndex(sourceRaster1);
    final TileIndex tgtIndex=new TileIndex(targetTile);
    final int maxY=y0 + h;
    final int maxX=x0 + w;
    final boolean complexData=bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY;
    Sentinel1Calibrator.CalibrationInfo calInfo=null;
    Sentinel1Calibrator.CALTYPE calType=null;
    if (absoluteCalibrationPerformed) {
      calInfo=getCalInfo(targetBandName);
      calType=Sentinel1Calibrator.getCalibrationType(targetBandName);
    }
    double dn, dn2, i, q;
    int srcIdx, tgtIdx;
    for (int y=y0; y < maxY; ++y) {
      srcIndex.calculateStride(y);
      tgtIndex.calculateStride(y);
      final double[] lut=new double[w];
      if (absoluteCalibrationPerformed) {
        final int calVecIdx=calInfo.getCalibrationVectorIndex(y);
        final Sentinel1Utils.CalibrationVector vec0=calInfo.getCalibrationVector(calVecIdx);
        final Sentinel1Utils.CalibrationVector vec1=calInfo.getCalibrationVector(calVecIdx + 1);
        final float[] vec0LUT=Sentinel1Calibrator.getVector(calType,vec0);
        final float[] vec1LUT=Sentinel1Calibrator.getVector(calType,vec1);
        final int pixelIdx0=calInfo.getPixelIndex(x0,calVecIdx);
        computeTileScaledNoiseLUT(y,x0,y0,w,noiseInfo,calInfo,vec0.timeMJD,vec1.timeMJD,vec0LUT,vec1LUT,vec0.pixels,pixelIdx0,lut);
      }
 else {
        computeTileNoiseLUT(y,x0,y0,w,noiseInfo,lut);
      }
      for (int x=x0; x < maxX; ++x) {
        final int xx=x - x0;
        srcIdx=srcIndex.getIndex(x);
        tgtIdx=tgtIndex.getIndex(x);
        if (bandUnit == Unit.UnitType.AMPLITUDE) {
          dn=srcData1.getElemDoubleAt(srcIdx);
          dn2=dn * dn;
        }
 else         if (complexData) {
          i=srcData1.getElemDoubleAt(srcIdx);
          q=srcData2.getElemDoubleAt(srcIdx);
          dn2=i * i + q * q;
        }
 else         if (bandUnit == Unit.UnitType.INTENSITY) {
          dn2=srcData1.getElemDoubleAt(srcIdx);
        }
 else {
          throw new OperatorException("String_Node_Str");
        }
        trgData.setElemDoubleAt(tgtIdx,dn2 - lut[xx]);
      }
    }
  }
 catch (  Throwable e) {
    throw new OperatorException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Called by the framework in order to compute a tile for the given target band. <p>The default implementation throws a runtime exception with the message "not implemented".</p>
 * @param targetBand The target band.
 * @param targetTile The current tile associated with the target band to be computed.
 * @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 raster.
 */
@Override public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm) throws OperatorException {
  final Rectangle targetTileRectangle=targetTile.getRectangle();
  final int x0=targetTileRectangle.x;
  final int y0=targetTileRectangle.y;
  final int w=targetTileRectangle.width;
  final int h=targetTileRectangle.height;
  try {
    final String targetBandName=targetBand.getName();
    final ThermalNoiseInfo noiseInfo=getNoiseInfo(targetBandName);
    Tile sourceRaster1=null;
    ProductData srcData1=null;
    ProductData srcData2=null;
    Band sourceBand1=null;
    final String[] srcBandNames=targetBandNameToSourceBandName.get(targetBand.getName());
    if (srcBandNames.length == 1) {
      sourceBand1=sourceProduct.getBand(srcBandNames[0]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
    }
 else {
      sourceBand1=sourceProduct.getBand(srcBandNames[0]);
      final Band sourceBand2=sourceProduct.getBand(srcBandNames[1]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      final Tile sourceRaster2=getSourceTile(sourceBand2,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
      srcData2=sourceRaster2.getDataBuffer();
    }
    final Unit.UnitType bandUnit=Unit.getUnitType(sourceBand1);
    final ProductData trgData=targetTile.getDataBuffer();
    final TileIndex srcIndex=new TileIndex(sourceRaster1);
    final TileIndex tgtIndex=new TileIndex(targetTile);
    final int maxY=y0 + h;
    final int maxX=x0 + w;
    final boolean complexData=bandUnit == Unit.UnitType.REAL || bandUnit == Unit.UnitType.IMAGINARY;
    Sentinel1Calibrator.CalibrationInfo calInfo=null;
    Sentinel1Calibrator.CALTYPE calType=null;
    if (absoluteCalibrationPerformed) {
      calInfo=getCalInfo(targetBandName);
      calType=Sentinel1Calibrator.getCalibrationType(targetBandName);
    }
    double dn, dn2, i, q;
    int srcIdx, tgtIdx;
    for (int y=y0; y < maxY; ++y) {
      srcIndex.calculateStride(y);
      tgtIndex.calculateStride(y);
      final double[] lut=new double[w];
      if (absoluteCalibrationPerformed) {
        final int calVecIdx=calInfo.getCalibrationVectorIndex(y);
        final Sentinel1Utils.CalibrationVector vec0=calInfo.getCalibrationVector(calVecIdx);
        final Sentinel1Utils.CalibrationVector vec1=calInfo.getCalibrationVector(calVecIdx + 1);
        final float[] vec0LUT=Sentinel1Calibrator.getVector(calType,vec0);
        final float[] vec1LUT=Sentinel1Calibrator.getVector(calType,vec1);
        final int pixelIdx0=calInfo.getPixelIndex(x0,calVecIdx);
        computeTileScaledNoiseLUT(y,x0,w,noiseInfo,calInfo,vec0.timeMJD,vec1.timeMJD,vec0LUT,vec1LUT,vec0.pixels,pixelIdx0,lut);
      }
 else {
        computeTileNoiseLUT(y,x0,w,noiseInfo,lut);
      }
      for (int x=x0; x < maxX; ++x) {
        final int xx=x - x0;
        srcIdx=srcIndex.getIndex(x);
        tgtIdx=tgtIndex.getIndex(x);
        if (bandUnit == Unit.UnitType.AMPLITUDE) {
          dn=srcData1.getElemDoubleAt(srcIdx);
          dn2=dn * dn;
        }
 else         if (complexData) {
          i=srcData1.getElemDoubleAt(srcIdx);
          q=srcData2.getElemDoubleAt(srcIdx);
          dn2=i * i + q * q;
        }
 else         if (bandUnit == Unit.UnitType.INTENSITY) {
          dn2=srcData1.getElemDoubleAt(srcIdx);
        }
 else {
          throw new OperatorException("String_Node_Str");
        }
        trgData.setElemDoubleAt(tgtIdx,dn2 - lut[xx]);
      }
    }
  }
 catch (  Throwable e) {
    throw new OperatorException(e.getMessage());
  }
}