Program: 174931
Project: 174931
Buggy source:
/** 
 * Exec the analysis process
 */
public Results call(){
  final Thread currentThread=Thread.currentThread();
  final String oldName=currentThread.getName();
  currentThread.setName("String_Node_Str" + gir.getImId());
  try {
    List<ComplexEditVDSVectorLayer> resultLayers=new ArrayList<>();
    String coastMaskName=analysis.getCoastMask() != null ? analysis.getCoastMask().getFileName() : "String_Node_Str";
    String iceMaskName=analysis.getIceMask() != null ? analysis.getIceMask().getFileName() : "String_Node_Str";
    notifyStartProcessListener("String_Node_Str" + coastMaskName + "String_Node_Str"+ iceMaskName);
    SarImageReader reader=((SarImageReader)gir);
    String[] thresholdsString=StringUtils.join(analysis.getThresholdsParams(),"String_Node_Str").split("String_Node_Str");
    BlackBorderAnalysis blackBorderAnalysis=runBBAnalysis();
    analysis.setBlackBorderAnalysis(blackBorderAnalysis);
    int numberofbands=gir.getNBand();
    int[] bands=new int[numberofbands];
    int noiseFloor=SumoPlatform.getApplication().getConfiguration().getNoiseFloor(0);
    int thresPixelMin=SumoPlatform.getApplication().getConfiguration().getThreshMinPixelValue(500);
    final KDistributionEstimation kdist=new KDistributionEstimation(ENL,noiseFloor,thresPixelMin);
    DetectedPixels mergePixels=new DetectedPixels(reader.getRangeSpacing(),reader.getAzimuthSpacing());
    DetectedPixels banddetectedpixels[]=new DetectedPixels[numberofbands];
    String timeStampStart=reader.getTimeStampStart();
    double azimuth=reader.getAzimuthSpacing();
    int xtileSize=analysis.getRealSizeX();
    int ytileSize=analysis.getRealSizeY();
    try {
      for (int band=0; band < numberofbands && !stop; band++) {
        notifyAnalysisBand(new StringBuilder().append("String_Node_Str").append(gir.getBandName(band)).toString());
        int vTiles=analysis.getVerTiles();
        notifyVDSAnalysis("String_Node_Str",vTiles);
        analysis.addProgressListener(this);
        banddetectedpixels[band]=analysis.analyse(kdist,band);
        if (numPointLimit != 0 && banddetectedpixels[band].getAllDetectedPixels().size() > numPointLimit) {
          logger.warn("String_Node_Str");
          return null;
        }
        if (mergePixels == null) {
          mergePixels=banddetectedpixels[band];
        }
 else {
          mergePixels.merge(banddetectedpixels[band]);
        }
        bands[band]=band;
        String polarization=reader.getBands()[band];
        if (numberofbands < 1 || displaybandanalysis) {
          notifyAgglomerating(new StringBuilder().append("String_Node_Str").append(polarization).toString());
          Boat[] boats=null;
          if (agglomerationMethodology.startsWith("String_Node_Str")) {
            banddetectedpixels[band].agglomerate();
            banddetectedpixels[band].computeBoatsAttributes(polarization);
          }
 else {
            if (stop)             break;
            boats=analysis.agglomerateNeighbours(banddetectedpixels[band],neighbouringDistance,neighbourTilesize,removelandconnectedpixels,(analysis.getCoastMask() != null) ? analysis.getCoastMask() : null,kdist,polarization,band);
          }
          String layerName=new StringBuilder("String_Node_Str").append(polarization).append("String_Node_Str").append(analysis.getThresholdParam(polarization)).toString();
          ComplexEditVDSVectorLayer vdsanalysisLayer=new ComplexEditVDSVectorLayer(LayerManager.getIstanceManager().getCurrentImageLayer(),layerName,"String_Node_Str",new GeometryImage("String_Node_Str","String_Node_Str",timeStampStart,azimuth,boats),thresholdsString,ENL,buffer,bufferedMaskName,"String_Node_Str" + band);
          vdsanalysisLayer.addDetectedPixels(banddetectedpixels[band].getAllDetectedPixels(),display);
          if (!agglomerationMethodology.startsWith("String_Node_Str")) {
            vdsanalysisLayer.addThreshAggPixels(banddetectedpixels[band].getThresholdaggregatePixels(),display);
            vdsanalysisLayer.addThresholdPixels(banddetectedpixels[band].getThresholdclipPixels(),display);
          }
          notifyCalcAzimuth("String_Node_Str");
          AzimuthAmbiguity azimuthAmbiguity=new AzimuthAmbiguity(boats,(SarImageReader)gir,band);
          azimuthAmbiguity.process();
          List<Geometry> az=azimuthAmbiguity.getAmbiguityboatgeometry();
          vdsanalysisLayer.addAzimuthAmbiguities(az,display);
          if (gir instanceof Sentinel1) {
            if (((Sentinel1)gir).getInstumentationMode().equalsIgnoreCase("String_Node_Str") || ((Sentinel1)gir).getInstumentationMode().equalsIgnoreCase("String_Node_Str")) {
              notifyCalcAzimuth("String_Node_Str");
              S1ArtefactsAmbiguity arAmbiguity=new S1ArtefactsAmbiguity(boats,(SarImageReader)gir,band);
              arAmbiguity.process();
              List<Geometry> artefactsA=arAmbiguity.getAmbiguityboatgeometry();
              vdsanalysisLayer.addArtefactsAmbiguities(artefactsA,display);
            }
          }
          if ((analysis.getCoastMask() != null)) {
            vdsanalysisLayer.addGeometries("String_Node_Str",Color.BLUE,1,GeometryImage.POLYGON,analysis.getCoastMask().getMaskGeometries(),true);
          }
          vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0xFF00FF),1,GeometryImage.LINESTRING,GeometryExtractor.getTiles(gir.getWidth(),gir.getHeight(),xtileSize,ytileSize),false);
          notifyLayerReady(vdsanalysisLayer);
          resultLayers.add(vdsanalysisLayer);
        }
      }
      if (stop) {
        return null;
      }
      if (bands.length > 1) {
        notifyAgglomerating("String_Node_Str");
        Boat[] boats=null;
        if (agglomerationMethodology.startsWith("String_Node_Str")) {
          mergePixels.agglomerate();
          mergePixels.computeBoatsAttributes("String_Node_Str");
        }
 else {
          boats=analysis.agglomerateNeighbours(mergePixels,neighbouringDistance,neighbourTilesize,removelandconnectedpixels,(analysis.getCoastMask() != null) ? analysis.getCoastMask() : null,kdist,"String_Node_Str",bands);
        }
        if (stop) {
          return null;
        }
        ComplexEditVDSVectorLayer vdsanalysisLayer=new ComplexEditVDSVectorLayer(LayerManager.getIstanceManager().getCurrentImageLayer(),"String_Node_Str","String_Node_Str",new GeometryImage("String_Node_Str","String_Node_Str",timeStampStart,azimuth,boats),thresholdsString,ENL,buffer,bufferedMaskName,"String_Node_Str");
        boolean display=SumoPlatform.getApplication().getConfiguration().getDisplayPixel();
        if (!agglomerationMethodology.startsWith("String_Node_Str")) {
          vdsanalysisLayer.addThreshAggPixels(mergePixels.getThresholdaggregatePixels(),display);
          vdsanalysisLayer.addThresholdPixels(mergePixels.getThresholdclipPixels(),display);
        }
        vdsanalysisLayer.addDetectedPixels(mergePixels.getAllDetectedPixels(),display);
        if ((analysis.getCoastMask() != null)) {
          vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0x0000FF),1,GeometryImage.POLYGON,analysis.getCoastMask().getMaskGeometries(),true);
        }
        vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0xFF00FF),1,GeometryImage.LINESTRING,GeometryExtractor.getTiles(gir.getWidth(),gir.getHeight(),xtileSize,ytileSize),false);
        notifyCalcAzimuth("String_Node_Str");
        AzimuthAmbiguity azimuthAmbiguity=new AzimuthAmbiguity(boats,(SarImageReader)gir,bands);
        azimuthAmbiguity.process();
        List<Geometry> az=azimuthAmbiguity.getAmbiguityboatgeometry();
        vdsanalysisLayer.addAzimuthAmbiguities(az,display);
        if (gir instanceof Sentinel1) {
          if (((Sentinel1)gir).getInstumentationMode().equalsIgnoreCase("String_Node_Str")) {
            notifyCalcAzimuth("String_Node_Str");
            S1ArtefactsAmbiguity arAmbiguity=new S1ArtefactsAmbiguity(boats,(SarImageReader)gir,bands);
            arAmbiguity.process();
            List<Geometry> artefactsA=arAmbiguity.getAmbiguityboatgeometry();
            vdsanalysisLayer.addArtefactsAmbiguities(artefactsA,display);
          }
        }
        notifyLayerReady(vdsanalysisLayer);
        resultLayers.add(vdsanalysisLayer);
      }
      notifyEndProcessListener();
    }
 catch (    Exception ee) {
      ee.printStackTrace();
    }
 finally {
      if (this.listeners != null)       removeAllProcessListener();
    }
    return new Results(reader,resultLayers);
  }
  finally {
    currentThread.setName(oldName);
  }
}

Fixed version (ground truth):
/** 
 * Exec the analysis process
 */
public Results call(){
  final Thread currentThread=Thread.currentThread();
  final String oldName=currentThread.getName();
  currentThread.setName("String_Node_Str" + gir.getImId());
  try {
    List<ComplexEditVDSVectorLayer> resultLayers=new ArrayList<>();
    String coastMaskName=analysis.getCoastMask() != null ? analysis.getCoastMask().getFileName() : "String_Node_Str";
    String iceMaskName=analysis.getIceMask() != null ? analysis.getIceMask().getFileName() : "String_Node_Str";
    notifyStartProcessListener("String_Node_Str" + coastMaskName + "String_Node_Str"+ iceMaskName);
    SarImageReader reader=((SarImageReader)gir);
    String[] thresholdsString=StringUtils.join(analysis.getThresholdsParams(),"String_Node_Str").split("String_Node_Str");
    BlackBorderAnalysis blackBorderAnalysis=runBBAnalysis();
    analysis.setBlackBorderAnalysis(blackBorderAnalysis);
    int numberofbands=gir.getNBand();
    int[] bands=new int[numberofbands];
    int noiseFloor=SumoPlatform.getApplication().getConfiguration().getNoiseFloor(0);
    int thresPixelMin=SumoPlatform.getApplication().getConfiguration().getThreshMinPixelValue(500);
    final KDistributionEstimation kdist=new KDistributionEstimation(ENL,noiseFloor,thresPixelMin);
    DetectedPixels mergePixels=new DetectedPixels(reader.getRangeSpacing(),reader.getAzimuthSpacing());
    DetectedPixels banddetectedpixels[]=new DetectedPixels[numberofbands];
    String timeStampStart=reader.getTimeStampStart();
    double azimuth=reader.getAzimuthSpacing();
    int xtileSize=analysis.getRealSizeX();
    int ytileSize=analysis.getRealSizeY();
    try {
      for (int band=0; band < numberofbands && !stop; band++) {
        notifyAnalysisBand(new StringBuilder().append("String_Node_Str").append(gir.getBandName(band)).toString());
        int vTiles=analysis.getVerTiles();
        notifyVDSAnalysis("String_Node_Str",vTiles);
        analysis.addProgressListener(this);
        banddetectedpixels[band]=analysis.analyse(kdist,band);
        if (numPointLimit != 0 && banddetectedpixels[band].getAllDetectedPixels().size() > numPointLimit) {
          logger.warn("String_Node_Str");
          return null;
        }
        if (mergePixels == null) {
          mergePixels=banddetectedpixels[band];
        }
 else {
          mergePixels.merge(banddetectedpixels[band]);
        }
        bands[band]=band;
        String polarization=reader.getBands()[band];
        if (numberofbands < 1 || displaybandanalysis) {
          notifyAgglomerating(new StringBuilder().append("String_Node_Str").append(polarization).toString());
          Boat[] boats=null;
          if (agglomerationMethodology.startsWith("String_Node_Str")) {
            banddetectedpixels[band].agglomerate();
            banddetectedpixels[band].computeBoatsAttributes(polarization);
          }
 else {
            if (stop)             break;
            boats=analysis.agglomerateNeighbours(banddetectedpixels[band],neighbouringDistance,neighbourTilesize,removelandconnectedpixels,(analysis.getCoastMask() != null) ? analysis.getCoastMask() : null,kdist,polarization,band);
          }
          String layerName=new StringBuilder("String_Node_Str").append(polarization).append("String_Node_Str").append(analysis.getThresholdParam(polarization)).toString();
          ComplexEditVDSVectorLayer vdsanalysisLayer=new ComplexEditVDSVectorLayer(LayerManager.getIstanceManager().getCurrentImageLayer(),layerName,"String_Node_Str",new GeometryImage("String_Node_Str","String_Node_Str",timeStampStart,azimuth,boats),thresholdsString,ENL,buffer,bufferedMaskName,"String_Node_Str" + band);
          vdsanalysisLayer.addDetectedPixels(banddetectedpixels[band].getAllDetectedPixels(),display);
          if (!agglomerationMethodology.startsWith("String_Node_Str")) {
            vdsanalysisLayer.addThreshAggPixels(banddetectedpixels[band].getThresholdaggregatePixels(),display);
            vdsanalysisLayer.addThresholdPixels(banddetectedpixels[band].getThresholdclipPixels(),display);
          }
          notifyCalcAzimuth("String_Node_Str");
          AzimuthAmbiguity azimuthAmbiguity=new AzimuthAmbiguity(boats,(SarImageReader)gir,band);
          azimuthAmbiguity.process();
          List<Geometry> az=azimuthAmbiguity.getAmbiguityboatgeometry();
          vdsanalysisLayer.addAzimuthAmbiguities(az,display);
          if (gir instanceof Sentinel1) {
            if (((Sentinel1)gir).getInstumentationMode().equalsIgnoreCase("String_Node_Str")) {
              notifyCalcAzimuth("String_Node_Str");
              S1ArtefactsAmbiguity arAmbiguity=new S1ArtefactsAmbiguity(boats,(SarImageReader)gir,band);
              arAmbiguity.process();
              List<Geometry> artefactsA=arAmbiguity.getAmbiguityboatgeometry();
              vdsanalysisLayer.addArtefactsAmbiguities(artefactsA,display);
            }
          }
          if ((analysis.getCoastMask() != null)) {
            vdsanalysisLayer.addGeometries("String_Node_Str",Color.BLUE,1,GeometryImage.POLYGON,analysis.getCoastMask().getMaskGeometries(),true);
          }
          vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0xFF0391),1,GeometryImage.LINESTRING,GeometryExtractor.getTiles(gir.getWidth(),gir.getHeight(),xtileSize,ytileSize),false);
          notifyLayerReady(vdsanalysisLayer);
          resultLayers.add(vdsanalysisLayer);
        }
      }
      if (stop) {
        return null;
      }
      if (bands.length > 1) {
        notifyAgglomerating("String_Node_Str");
        Boat[] boats=null;
        if (agglomerationMethodology.startsWith("String_Node_Str")) {
          mergePixels.agglomerate();
          mergePixels.computeBoatsAttributes("String_Node_Str");
        }
 else {
          boats=analysis.agglomerateNeighbours(mergePixels,neighbouringDistance,neighbourTilesize,removelandconnectedpixels,(analysis.getCoastMask() != null) ? analysis.getCoastMask() : null,kdist,"String_Node_Str",bands);
        }
        if (stop) {
          return null;
        }
        ComplexEditVDSVectorLayer vdsanalysisLayer=new ComplexEditVDSVectorLayer(LayerManager.getIstanceManager().getCurrentImageLayer(),"String_Node_Str","String_Node_Str",new GeometryImage("String_Node_Str","String_Node_Str",timeStampStart,azimuth,boats),thresholdsString,ENL,buffer,bufferedMaskName,"String_Node_Str");
        boolean display=SumoPlatform.getApplication().getConfiguration().getDisplayPixel();
        if (!agglomerationMethodology.startsWith("String_Node_Str")) {
          vdsanalysisLayer.addThreshAggPixels(mergePixels.getThresholdaggregatePixels(),display);
          vdsanalysisLayer.addThresholdPixels(mergePixels.getThresholdclipPixels(),display);
        }
        vdsanalysisLayer.addDetectedPixels(mergePixels.getAllDetectedPixels(),display);
        if ((analysis.getCoastMask() != null)) {
          vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0x0000FF),1,GeometryImage.POLYGON,analysis.getCoastMask().getMaskGeometries(),true);
        }
        vdsanalysisLayer.addGeometries("String_Node_Str",new Color(0xFF00FF),1,GeometryImage.LINESTRING,GeometryExtractor.getTiles(gir.getWidth(),gir.getHeight(),xtileSize,ytileSize),false);
        notifyCalcAzimuth("String_Node_Str");
        AzimuthAmbiguity azimuthAmbiguity=new AzimuthAmbiguity(boats,(SarImageReader)gir,bands);
        azimuthAmbiguity.process();
        List<Geometry> az=azimuthAmbiguity.getAmbiguityboatgeometry();
        vdsanalysisLayer.addAzimuthAmbiguities(az,display);
        if (gir instanceof Sentinel1) {
          if (((Sentinel1)gir).getInstumentationMode().equalsIgnoreCase("String_Node_Str")) {
            notifyCalcAzimuth("String_Node_Str");
            S1ArtefactsAmbiguity arAmbiguity=new S1ArtefactsAmbiguity(boats,(SarImageReader)gir,bands);
            arAmbiguity.process();
            List<Geometry> artefactsA=arAmbiguity.getAmbiguityboatgeometry();
            vdsanalysisLayer.addArtefactsAmbiguities(artefactsA,display);
          }
        }
        notifyLayerReady(vdsanalysisLayer);
        resultLayers.add(vdsanalysisLayer);
      }
      notifyEndProcessListener();
    }
 catch (    Exception ee) {
      ee.printStackTrace();
    }
 finally {
      if (this.listeners != null)       removeAllProcessListener();
    }
    return new Results(reader,resultLayers);
  }
  finally {
    currentThread.setName(oldName);
  }
}