Program: 11539
Project: 11539
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 targetTileMap   The target tiles associated with all target bands to be computed.
 * @param targetRectangle The rectangle of target tile.
 * @param pm              A progress monitor which should be used to determine computation cancelation requests.
 * @throws org.esa.beam.framework.gpf.OperatorException If an error occurs during computation of the target raster.
 */
@Override public void computeTileStack(Map<Band,Tile> targetTileMap,Rectangle targetRectangle,ProgressMonitor pm) throws OperatorException {
  try {
    if (onlyGCPsOnLand && dem == null) {
      createDEM();
    }
    final String[] masterBandNames=StackUtils.getMasterBandNames(sourceProduct);
    final Map<String,Band> singleSlvBandMap=new HashMap<String,Band>();
    final Map<Band,Band> bandList=new HashMap<Band,Band>();
    for (    Band targetBand : targetProduct.getBands()) {
      final Band slaveBand=sourceRasterMap.get(targetBand);
      if (gcpsCalculated && slaveBand == primarySlaveBand) {
        bandList.put(targetBand,slaveBand);
        break;
      }
      if (slaveBand == masterBand1 || slaveBand == masterBand2 || StringUtils.contains(masterBandNames,slaveBand.getName()))       continue;
      if (!useAllPolarimetricBands) {
        final String mstPol=OperatorUtils.getPolarizationFromBandName(masterBand1.getName());
        final String slvProductName=StackUtils.getSlaveProductName(targetProduct,targetBand,mstPol);
        if (slvProductName == null || singleSlvBandMap.get(slvProductName) != null) {
          continue;
        }
        singleSlvBandMap.put(slvProductName,targetBand);
      }
      final String unit=slaveBand.getUnit();
      if (unit != null && (unit.contains(Unit.IMAGINARY) || unit.contains(Unit.BIT)))       continue;
      bandList.put(targetBand,slaveBand);
    }
    int bandCnt=0;
    Band firstTargetBand=null;
    for (    Band targetBand : bandList.keySet()) {
      ++bandCnt;
      final Band slaveBand=bandList.get(targetBand);
      if (collocatedStack || !collocatedStack && bandCnt == 1) {
        final String bandCountStr=bandCnt + "String_Node_Str" + bandList.size();
        if (complexCoregistration) {
          computeSlaveGCPs(slaveBand,complexSrcMap.get(slaveBand),targetBand,bandCountStr);
        }
 else {
          computeSlaveGCPs(slaveBand,null,targetBand,bandCountStr);
        }
        if (bandCnt == 1) {
          firstTargetBand=targetBand;
        }
      }
 else {
        copyFirstTargetBandGCPs(firstTargetBand,targetBand);
      }
      final Tile targetTile=targetTileMap.get(targetBand);
      if (targetTile != null) {
        targetTile.setRawSamples(getSourceTile(slaveBand,targetRectangle).getRawSamples());
      }
    }
    setGCPsCalculated();
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),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 targetTileMap   The target tiles associated with all target bands to be computed.
 * @param targetRectangle The rectangle of target tile.
 * @param pm              A progress monitor which should be used to determine computation cancelation requests.
 * @throws org.esa.beam.framework.gpf.OperatorException If an error occurs during computation of the target raster.
 */
@Override public void computeTileStack(Map<Band,Tile> targetTileMap,Rectangle targetRectangle,ProgressMonitor pm) throws OperatorException {
  try {
    if (onlyGCPsOnLand && dem == null) {
      createDEM();
    }
    final String[] masterBandNames=StackUtils.getMasterBandNames(sourceProduct);
    final Map<String,Band> singleSlvBandMap=new HashMap<String,Band>();
    final Map<Band,Band> bandList=new HashMap<Band,Band>();
    for (    Band targetBand : targetProduct.getBands()) {
      final Band slaveBand=sourceRasterMap.get(targetBand);
      if (gcpsComputedMap.get(slaveBand)) {
        bandList.put(targetBand,primarySlaveBand);
        break;
      }
      if (slaveBand == masterBand1 || slaveBand == masterBand2 || StringUtils.contains(masterBandNames,slaveBand.getName())) {
        continue;
      }
      if (collocatedStack && !useAllPolarimetricBands) {
        final String mstPol=OperatorUtils.getPolarizationFromBandName(masterBand1.getName());
        final String slvProductName=StackUtils.getSlaveProductName(targetProduct,targetBand,mstPol);
        if (slvProductName == null || singleSlvBandMap.get(slvProductName) != null) {
          continue;
        }
        singleSlvBandMap.put(slvProductName,targetBand);
      }
      final String unit=slaveBand.getUnit();
      if (unit != null && (unit.contains(Unit.IMAGINARY) || unit.contains(Unit.BIT))) {
        continue;
      }
      bandList.put(targetBand,slaveBand);
    }
    int bandCnt=0;
    Band firstTargetBand=null;
    for (    Band targetBand : bandList.keySet()) {
      ++bandCnt;
      final Band slaveBand=bandList.get(targetBand);
      if (collocatedStack || !collocatedStack && bandCnt == 1) {
        final String bandCountStr=bandCnt + "String_Node_Str" + bandList.size();
        if (complexCoregistration) {
          computeSlaveGCPs(slaveBand,complexSrcMap.get(slaveBand),targetBand,bandCountStr);
        }
 else {
          computeSlaveGCPs(slaveBand,null,targetBand,bandCountStr);
        }
        if (bandCnt == 1) {
          firstTargetBand=targetBand;
        }
      }
 else {
        copyFirstTargetBandGCPs(firstTargetBand,targetBand);
      }
      if (slaveBand == primarySlaveBand) {
        final Tile targetTile=targetTileMap.get(targetBand);
        if (targetTile != null) {
          targetTile.setRawSamples(getSourceTile(slaveBand,targetRectangle).getRawSamples());
        }
      }
    }
    setGCPsCalculated();
  }
 catch (  Throwable e) {
    OperatorUtils.catchOperatorException(getId(),e);
  }
}