Program: 11525
Project: 11525
Buggy source:
private void leeSigmaFilter(final Map<Band,Tile> targetTiles,final Rectangle targetRectangle){
  final int x0=targetRectangle.x;
  final int y0=targetRectangle.y;
  final int w=targetRectangle.width;
  final int h=targetRectangle.height;
  final int maxY=y0 + h;
  final int maxX=x0 + w;
  final Rectangle sourceRectangle=getSourceTileRectangle(x0,y0,w,h);
  final int sx0=sourceRectangle.x;
  final int sy0=sourceRectangle.y;
  final int sw=sourceRectangle.width;
  final int sh=sourceRectangle.height;
  final TileIndex trgIndex=new TileIndex(targetTiles.get(getTargetProduct().getBandAt(0)));
  for (  final PolBandUtils.QuadSourceBand bandList : srcBandList) {
    final Tile[] sourceTiles=new Tile[bandList.srcBands.length];
    final ProductData[] sourceDataBuffers=new ProductData[bandList.srcBands.length];
    for (int i=0; i < bandList.srcBands.length; ++i) {
      sourceTiles[i]=getSourceTile(bandList.srcBands[i],sourceRectangle);
      sourceDataBuffers[i]=sourceTiles[i].getDataBuffer();
    }
    final TileIndex srcIndex=new TileIndex(sourceTiles[0]);
    final ProductData[] targetDataBuffers=new ProductData[9];
    for (    final Band targetBand : bandList.targetBands) {
      final String targetBandName=targetBand.getName();
      final ProductData dataBuffer=targetTiles.get(targetBand).getDataBuffer();
      if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[0]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[1]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[2]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[3]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[4]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[5]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[6]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[7]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[8]=dataBuffer;
    }
    Z98 z98=new Z98();
    computeZ98Values(sourceTiles[0],sourceRectangle,sourceDataBuffers,z98);
    double[][] Tr=new double[3][3];
    double[][] Ti=new double[3][3];
    int xx, yy, trgIdx, srcIdx;
    boolean[][] isPointTarget=new boolean[h][w];
    T3[][] filterWindowT3=null;
    T3[][] targetWindowT3=null;
    for (int y=y0; y < maxY; ++y) {
      yy=y - y0;
      trgIndex.calculateStride(y);
      srcIndex.calculateStride(y);
      for (int x=x0; x < maxX; ++x) {
        xx=x - x0;
        trgIdx=trgIndex.getIndex(x);
        srcIdx=srcIndex.getIndex(x);
        PolOpUtils.getT3(srcIdx,sourceProductType,sourceDataBuffers,Tr,Ti);
        if (y - halfFilterSize < sy0 || y + halfFilterSize > sy0 + sh - 1 || x - halfFilterSize < sx0 || x + halfFilterSize > sx0 + sw - 1) {
          filterWindowT3=new T3[filterWindowSize][filterWindowSize];
          getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],filterWindowT3);
          final int n=setPixelsInSigmaRange(filterWindowT3);
          computeFilteredT3(filterWindowT3,n,sigmaVSqr,Tr,Ti);
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        if (isPointTarget[yy][xx]) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        targetWindowT3=new T3[targetWindowSize][targetWindowSize];
        getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],targetWindowT3);
        if (checkPointTarget(z98,targetWindowT3,isPointTarget,x0,y0,w,h)) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        double[] sigmaRangeT11=new double[2];
        double[] sigmaRangeT22=new double[2];
        double[] sigmaRangeT33=new double[2];
        computeSigmaRange(targetWindowT3,0,sigmaRangeT11);
        computeSigmaRange(targetWindowT3,1,sigmaRangeT22);
        computeSigmaRange(targetWindowT3,2,sigmaRangeT33);
        filterWindowT3=new T3[filterWindowSize][filterWindowSize];
        getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],filterWindowT3);
        final int n=selectPixelsInSigmaRange(sigmaRangeT11,sigmaRangeT22,sigmaRangeT33,filterWindowT3);
        if (n == 0) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        computeFilteredT3(filterWindowT3,n,sigmaVPSqr,Tr,Ti);
        saveT3(Tr,Ti,trgIdx,targetDataBuffers);
      }
    }
  }
}

Fixed version (ground truth):
private void leeSigmaFilter(final Map<Band,Tile> targetTiles,final Rectangle targetRectangle){
  final int x0=targetRectangle.x;
  final int y0=targetRectangle.y;
  final int w=targetRectangle.width;
  final int h=targetRectangle.height;
  final int maxY=y0 + h;
  final int maxX=x0 + w;
  final Rectangle sourceRectangle=getSourceTileRectangle(x0,y0,w,h);
  final int sx0=sourceRectangle.x;
  final int sy0=sourceRectangle.y;
  final int sw=sourceRectangle.width;
  final int sh=sourceRectangle.height;
  final TileIndex trgIndex=new TileIndex(targetTiles.get(getTargetProduct().getBandAt(0)));
  for (  final PolBandUtils.QuadSourceBand bandList : srcBandList) {
    final Tile[] sourceTiles=new Tile[bandList.srcBands.length];
    final ProductData[] sourceDataBuffers=new ProductData[bandList.srcBands.length];
    for (int i=0; i < bandList.srcBands.length; ++i) {
      sourceTiles[i]=getSourceTile(bandList.srcBands[i],sourceRectangle);
      sourceDataBuffers[i]=sourceTiles[i].getDataBuffer();
    }
    final TileIndex srcIndex=new TileIndex(sourceTiles[0]);
    final ProductData[] targetDataBuffers=new ProductData[9];
    for (    final Band targetBand : bandList.targetBands) {
      final String targetBandName=targetBand.getName();
      final ProductData dataBuffer=targetTiles.get(targetBand).getDataBuffer();
      if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[0]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[1]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[2]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[3]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[4]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[5]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[6]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str"))       targetDataBuffers[7]=dataBuffer;
 else       if (targetBandName.contains("String_Node_Str") || targetBandName.contains("String_Node_Str"))       targetDataBuffers[8]=dataBuffer;
    }
    Z98 z98=new Z98();
    computeZ98Values(sourceTiles[0],sourceRectangle,sourceDataBuffers,z98);
    double[][] Tr=new double[3][3];
    double[][] Ti=new double[3][3];
    int xx, yy, trgIdx, srcIdx;
    boolean[][] isPointTarget=new boolean[h][w];
    T3[][] filterWindowT3=null;
    T3[][] targetWindowT3=null;
    for (int y=y0; y < maxY; ++y) {
      yy=y - y0;
      trgIndex.calculateStride(y);
      srcIndex.calculateStride(y);
      for (int x=x0; x < maxX; ++x) {
        xx=x - x0;
        trgIdx=trgIndex.getIndex(x);
        srcIdx=srcIndex.getIndex(x);
        PolOpUtils.getT3(srcIdx,sourceProductType,sourceDataBuffers,Tr,Ti);
        if (isPointTarget[yy][xx]) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        if (y - halfFilterSize < sy0 || y + halfFilterSize > sy0 + sh - 1 || x - halfFilterSize < sx0 || x + halfFilterSize > sx0 + sw - 1) {
          filterWindowT3=new T3[filterWindowSize][filterWindowSize];
          getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],filterWindowT3);
          final int n=setPixelsInSigmaRange(filterWindowT3);
          computeFilteredT3(filterWindowT3,n,sigmaVSqr,Tr,Ti);
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        targetWindowT3=new T3[targetWindowSize][targetWindowSize];
        getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],targetWindowT3);
        if (checkPointTarget(z98,targetWindowT3,isPointTarget,x0,y0,w,h)) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        double[] sigmaRangeT11=new double[2];
        double[] sigmaRangeT22=new double[2];
        double[] sigmaRangeT33=new double[2];
        computeSigmaRange(targetWindowT3,0,sigmaRangeT11);
        computeSigmaRange(targetWindowT3,1,sigmaRangeT22);
        computeSigmaRange(targetWindowT3,2,sigmaRangeT33);
        filterWindowT3=new T3[filterWindowSize][filterWindowSize];
        getWindowPixelT3s(x,y,sourceDataBuffers,sx0,sy0,sw,sh,sourceTiles[0],filterWindowT3);
        final int n=selectPixelsInSigmaRange(sigmaRangeT11,sigmaRangeT22,sigmaRangeT33,filterWindowT3);
        if (n == 0) {
          saveT3(Tr,Ti,trgIdx,targetDataBuffers);
          continue;
        }
        computeFilteredT3(filterWindowT3,n,sigmaVPSqr,Tr,Ti);
        saveT3(Tr,Ti,trgIdx,targetDataBuffers);
      }
    }
  }
}