Program: 11446
Project: 11446
Buggy source:
/** 
 * Create target product.
 */
private void createTargetProduct(){
  targetProduct=new Product(sourceProduct.getName(),sourceProduct.getProductType(),sourceImageWidth,sourceImageHeight);
  ProductUtils.copyProductNodes(sourceProduct,targetProduct);
  final String[] masterBandNames=StackUtils.getMasterBandNames(sourceProduct);
  final int numSrcBands=sourceProduct.getNumBands();
  Band slvBand1=null, slvBand2=null;
  final String mstPol=OperatorUtils.getPolarizationFromBandName(masterBand1.getName());
  for (  Band slvBand : sourceProduct.getBands()) {
    if (!StringUtils.contains(masterBandNames,slvBand.getName()) && slvBand != masterBand1) {
      final String slvPol=OperatorUtils.getPolarizationFromBandName(slvBand.getName());
      if (mstPol == null || mstPol.equals(slvPol)) {
        final String unit=slvBand.getUnit();
        if (unit != null && !unit.contains(Unit.IMAGINARY)) {
          slvBand1=slvBand;
          break;
        }
 else         if (unit == null) {
          slvBand1=slvBand;
        }
      }
    }
  }
  boolean oneSlaveProcessed=false;
  for (int i=0; i < numSrcBands; ++i) {
    final Band srcBand=sourceProduct.getBandAt(i);
    final Band targetBand=targetProduct.addBand(srcBand.getName(),srcBand.getDataType());
    ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
    sourceRasterMap.put(targetBand,srcBand);
    gcpsComputedMap.put(srcBand,false);
    if (srcBand == masterBand1 || srcBand == masterBand2 || oneSlaveProcessed || srcBand != slvBand1 || StringUtils.contains(masterBandNames,srcBand.getName())) {
      targetBand.setSourceImage(srcBand.getSourceImage());
    }
 else {
      final String unit=srcBand.getUnit();
      if (!oneSlaveProcessed && (unit == null || !unit.contains(Unit.IMAGINARY))) {
        oneSlaveProcessed=true;
        primarySlaveBand=srcBand;
        final MetadataElement absRoot=AbstractMetadata.getAbstractedMetadata(targetProduct);
        AbstractMetadata.addAbstractedAttribute(absRoot,"String_Node_Str",ProductData.TYPE_ASCII,"String_Node_Str","String_Node_Str");
        absRoot.setAttributeString("String_Node_Str",primarySlaveBand.getName());
      }
    }
    if (complexCoregistration) {
      if (srcBand.getUnit() != null && srcBand.getUnit().equals(Unit.REAL)) {
        if (i + 1 < numSrcBands)         complexSrcMap.put(srcBand,sourceProduct.getBandAt(i + 1));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create target product.
 */
private void createTargetProduct(){
  targetProduct=new Product(sourceProduct.getName(),sourceProduct.getProductType(),sourceImageWidth,sourceImageHeight);
  ProductUtils.copyProductNodes(sourceProduct,targetProduct);
  final String[] masterBandNames=StackUtils.getMasterBandNames(sourceProduct);
  final int numSrcBands=sourceProduct.getNumBands();
  Band slvBand1=null, slvBand2=null;
  final String mstPol=OperatorUtils.getPolarizationFromBandName(masterBand1.getName());
  for (  Band slvBand : sourceProduct.getBands()) {
    if (!StringUtils.contains(masterBandNames,slvBand.getName()) && slvBand != masterBand1) {
      final String slvPol=OperatorUtils.getPolarizationFromBandName(slvBand.getName());
      if (mstPol == null || slvPol == null || mstPol.equals(slvPol)) {
        final String unit=slvBand.getUnit();
        if (unit != null && !unit.contains(Unit.IMAGINARY)) {
          slvBand1=slvBand;
          break;
        }
 else         if (unit == null) {
          slvBand1=slvBand;
        }
      }
    }
  }
  boolean oneSlaveProcessed=false;
  for (int i=0; i < numSrcBands; ++i) {
    final Band srcBand=sourceProduct.getBandAt(i);
    final Band targetBand=targetProduct.addBand(srcBand.getName(),srcBand.getDataType());
    ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
    sourceRasterMap.put(targetBand,srcBand);
    gcpsComputedMap.put(srcBand,false);
    if (srcBand == masterBand1 || srcBand == masterBand2 || oneSlaveProcessed || srcBand != slvBand1 || StringUtils.contains(masterBandNames,srcBand.getName())) {
      targetBand.setSourceImage(srcBand.getSourceImage());
    }
 else {
      final String unit=srcBand.getUnit();
      if (!oneSlaveProcessed && (unit == null || !unit.contains(Unit.IMAGINARY))) {
        oneSlaveProcessed=true;
        primarySlaveBand=srcBand;
        final MetadataElement absRoot=AbstractMetadata.getAbstractedMetadata(targetProduct);
        AbstractMetadata.addAbstractedAttribute(absRoot,"String_Node_Str",ProductData.TYPE_ASCII,"String_Node_Str","String_Node_Str");
        absRoot.setAttributeString("String_Node_Str",primarySlaveBand.getName());
      }
    }
    if (complexCoregistration) {
      if (srcBand.getUnit() != null && srcBand.getUnit().equals(Unit.REAL)) {
        if (i + 1 < numSrcBands)         complexSrcMap.put(srcBand,sourceProduct.getBandAt(i + 1));
      }
    }
  }
}