Program: 11465
Project: 11465
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 org.esa.snap.framework.gpf.OperatorException If an error occurs during computation of the target raster.
 */
@Override public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm) throws OperatorException {
  try {
    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;
    final ProductData trgData=targetTile.getDataBuffer();
    Band sourceBand1=null;
    Band sourceBand2=null;
    Tile sourceRaster1=null;
    Tile sourceRaster2=null;
    ProductData srcData1=null;
    ProductData srcData2=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]);
      sourceBand2=sourceProduct.getBand(srcBandNames[1]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      sourceRaster2=getSourceTile(sourceBand2,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
      srcData2=sourceRaster2.getDataBuffer();
    }
    final Unit.UnitType bandUnit=Unit.getUnitType(targetBand);
    if (bandUnit == Unit.UnitType.PHASE) {
      targetTile.setRawSamples(sourceRaster1.getRawSamples());
      return;
    }
    if (applyAntennaPatternCorrection && !isAntPattAvailable) {
      computeAntennaPatternCorrectionFactors(0,sourceImageWidth);
    }
    if (applyADCSaturationCorrection && !adcHasBeenTestedFlag) {
      testADC(sourceBand1,sourceBand2,bandUnit);
    }
    boolean applyADCSaturationCorrectionToCurrentTile=false;
    if (applyADCSaturationCorrection && h >= blockHeight && w >= blockWidth) {
      applyADCSaturationCorrectionToCurrentTile=true;
    }
    double[][] adcPowerLoss=null;
    if (applyADCSaturationCorrectionToCurrentTile) {
      adcPowerLoss=computeADCPowerLossValuesForCurrentTile(sourceBand1,sourceBand2,x0,y0,w,h,bandUnit);
    }
    final double k=calibrationConstant * FastMath.sin(referenceIncidenceAngle);
    final int maxY=y0 + h;
    final int maxX=x0 + w;
    double sigma, dn, dn2, i, q, phaseTerm=0.0;
    int index;
    int adcJ=0;
    for (int x=x0; x < maxX; x++) {
      final double sinIncidenceAngleByK=FastMath.sin(incidenceAngles[x]) / k;
      if (applyADCSaturationCorrectionToCurrentTile) {
        adcJ=Math.min(((x - x0) / blockWidth),adcPowerLoss[0].length - 1);
      }
      for (int y=y0; y < maxY; y++) {
        index=sourceRaster1.getDataBufferIndex(x,y);
        if (bandUnit == Unit.UnitType.AMPLITUDE) {
          dn=srcData1.getElemDoubleAt(index);
          dn2=dn * dn;
        }
 else         if (bandUnit == Unit.UnitType.INTENSITY) {
          dn2=srcData1.getElemDoubleAt(index);
        }
 else         if (bandUnit == Unit.UnitType.REAL) {
          i=srcData1.getElemDoubleAt(index);
          q=srcData2.getElemDoubleAt(index);
          dn2=i * i + q * q;
          if (outputImageInComplex) {
            phaseTerm=i / Math.sqrt(dn2);
          }
        }
 else         if (bandUnit == Unit.UnitType.IMAGINARY) {
          i=srcData1.getElemDoubleAt(index);
          q=srcData2.getElemDoubleAt(index);
          dn2=i * i + q * q;
          if (outputImageInComplex) {
            phaseTerm=q / Math.sqrt(dn2);
          }
        }
 else         if (bandUnit == Unit.UnitType.INTENSITY_DB) {
          dn2=FastMath.pow(10,srcData1.getElemDoubleAt(index) / 10.0);
        }
 else {
          throw new OperatorException("String_Node_Str");
        }
        double calFactor=sinIncidenceAngleByK;
        if (applyAntennaPatternCorrection) {
          calFactor*=antennaPatternCorrFactor[x];
        }
        if (applyRangeSpreadingLossCorrection) {
          calFactor*=rangeSpreadingLoss[x];
        }
        if (applyReplicaPowerCorrection) {
          calFactor*=replicaPulseVariationsCorrectionFactor;
        }
        if (applyADCSaturationCorrectionToCurrentTile) {
          final int adcI=Math.min(((y - y0) / blockHeight),adcPowerLoss.length - 1);
          calFactor*=adcPowerLoss[adcI][adcJ];
        }
        sigma=dn2 * calFactor;
        if (isComplex && outputImageInComplex) {
          sigma=Math.sqrt(sigma) * phaseTerm;
        }
        if (outputImageScaleInDb) {
          if (sigma < underFlowFloat) {
            sigma=-underFlowFloat;
          }
 else {
            sigma=10.0 * Math.log10(sigma);
          }
        }
        trgData.setElemDoubleAt(targetTile.getDataBufferIndex(x,y),sigma);
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException("String_Node_Str",e);
  }
}

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 org.esa.snap.framework.gpf.OperatorException If an error occurs during computation of the target raster.
 */
@Override public void computeTile(Band targetBand,Tile targetTile,ProgressMonitor pm) throws OperatorException {
  try {
    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;
    final ProductData trgData=targetTile.getDataBuffer();
    Band sourceBand1=null;
    Band sourceBand2=null;
    Tile sourceRaster1=null;
    Tile sourceRaster2=null;
    ProductData srcData1=null;
    ProductData srcData2=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]);
      sourceBand2=sourceProduct.getBand(srcBandNames[1]);
      sourceRaster1=getSourceTile(sourceBand1,targetTileRectangle);
      sourceRaster2=getSourceTile(sourceBand2,targetTileRectangle);
      srcData1=sourceRaster1.getDataBuffer();
      srcData2=sourceRaster2.getDataBuffer();
    }
    final Unit.UnitType tgtBandUnit=Unit.getUnitType(targetBand);
    final Unit.UnitType srcBandUnit=Unit.getUnitType(sourceBand1);
    if (tgtBandUnit == Unit.UnitType.PHASE) {
      targetTile.setRawSamples(sourceRaster1.getRawSamples());
      return;
    }
    if (applyAntennaPatternCorrection && !isAntPattAvailable) {
      computeAntennaPatternCorrectionFactors(0,sourceImageWidth);
    }
    if (applyADCSaturationCorrection && !adcHasBeenTestedFlag) {
      testADC(sourceBand1,sourceBand2,srcBandUnit);
    }
    boolean applyADCSaturationCorrectionToCurrentTile=false;
    if (applyADCSaturationCorrection && h >= blockHeight && w >= blockWidth) {
      applyADCSaturationCorrectionToCurrentTile=true;
    }
    double[][] adcPowerLoss=null;
    if (applyADCSaturationCorrectionToCurrentTile) {
      adcPowerLoss=computeADCPowerLossValuesForCurrentTile(sourceBand1,sourceBand2,x0,y0,w,h,srcBandUnit);
    }
    final double k=calibrationConstant * FastMath.sin(referenceIncidenceAngle);
    final int maxY=y0 + h;
    final int maxX=x0 + w;
    double sigma, dn, dn2, i, q, phaseTerm=0.0;
    int index;
    int adcJ=0;
    for (int x=x0; x < maxX; x++) {
      final double sinIncidenceAngleByK=FastMath.sin(incidenceAngles[x]) / k;
      if (applyADCSaturationCorrectionToCurrentTile) {
        adcJ=Math.min(((x - x0) / blockWidth),adcPowerLoss[0].length - 1);
      }
      for (int y=y0; y < maxY; y++) {
        index=sourceRaster1.getDataBufferIndex(x,y);
        if (srcBandUnit == Unit.UnitType.AMPLITUDE) {
          dn=srcData1.getElemDoubleAt(index);
          dn2=dn * dn;
        }
 else         if (srcBandUnit == Unit.UnitType.INTENSITY) {
          dn2=srcData1.getElemDoubleAt(index);
        }
 else         if (srcBandUnit == Unit.UnitType.REAL) {
          i=srcData1.getElemDoubleAt(index);
          q=srcData2.getElemDoubleAt(index);
          dn2=i * i + q * q;
          if (tgtBandUnit == Unit.UnitType.REAL) {
            phaseTerm=i / Math.sqrt(dn2);
          }
 else           if (tgtBandUnit == Unit.UnitType.IMAGINARY) {
            phaseTerm=q / Math.sqrt(dn2);
          }
        }
 else         if (srcBandUnit == Unit.UnitType.INTENSITY_DB) {
          dn2=FastMath.pow(10,srcData1.getElemDoubleAt(index) / 10.0);
        }
 else {
          throw new OperatorException("String_Node_Str");
        }
        double calFactor=sinIncidenceAngleByK;
        if (applyAntennaPatternCorrection) {
          calFactor*=antennaPatternCorrFactor[x];
        }
        if (applyRangeSpreadingLossCorrection) {
          calFactor*=rangeSpreadingLoss[x];
        }
        if (applyReplicaPowerCorrection) {
          calFactor*=replicaPulseVariationsCorrectionFactor;
        }
        if (applyADCSaturationCorrectionToCurrentTile) {
          final int adcI=Math.min(((y - y0) / blockHeight),adcPowerLoss.length - 1);
          calFactor*=adcPowerLoss[adcI][adcJ];
        }
        sigma=dn2 * calFactor;
        if (isComplex && outputImageInComplex) {
          sigma=Math.sqrt(sigma) * phaseTerm;
        }
        if (outputImageScaleInDb) {
          if (sigma < underFlowFloat) {
            sigma=-underFlowFloat;
          }
 else {
            sigma=10.0 * Math.log10(sigma);
          }
        }
        trgData.setElemDoubleAt(targetTile.getDataBufferIndex(x,y),sigma);
      }
    }
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException("String_Node_Str",e);
  }
}