Program: 11430
Project: 11430
Buggy source:
@Override public void initialize() throws OperatorException {
  try {
    if (sourceProduct == null) {
      return;
    }
    if (sourceProduct.length < 2) {
      throw new OperatorException("String_Node_Str");
    }
    for (    final Product prod : sourceProduct) {
      final InputProductValidator validator=new InputProductValidator(prod);
      if (validator.isTOPSARProduct()) {
        throw new OperatorException("String_Node_Str");
      }
      if (prod.getSceneGeoCoding() == null) {
        throw new OperatorException(MessageFormat.format("String_Node_Str",prod.getName()));
      }
    }
    if (masterBandNames == null || masterBandNames.length == 0 || getMasterProduct(masterBandNames[0]) == null) {
      final Product defaultProd=sourceProduct[0];
      if (defaultProd != null) {
        final Band defaultBand=defaultProd.getBandAt(0);
        if (defaultBand != null) {
          if (defaultBand.getUnit() != null && defaultBand.getUnit().equals(Unit.REAL))           masterBandNames=new String[]{defaultProd.getBandAt(0).getName(),defaultProd.getBandAt(1).getName()};
 else           masterBandNames=new String[]{defaultBand.getName()};
        }
      }
      if (masterBandNames.length == 0) {
        targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
        return;
      }
    }
    masterProduct=getMasterProduct(masterBandNames[0]);
    if (masterProduct == null) {
      targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
      return;
    }
    appendToMaster=AbstractMetadata.getAbstractedMetadata(masterProduct).getAttributeInt(AbstractMetadata.coregistered_stack,0) == 1;
    final List<String> masterProductBands=new ArrayList<>(masterProduct.getNumBands());
    final Band[] slaveBandList=getSlaveBands();
    if (masterProduct == null || slaveBandList.length == 0 || slaveBandList[0] == null) {
      targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
      return;
    }
    if (resamplingType.contains("String_Node_Str") && !extent.equals(MASTER_EXTENT)) {
      throw new OperatorException("String_Node_Str");
    }
    if (appendToMaster) {
      extent=MASTER_EXTENT;
    }
switch (extent) {
case MASTER_EXTENT:
      targetProduct=new Product(masterProduct.getName(),masterProduct.getProductType(),masterProduct.getSceneRasterWidth(),masterProduct.getSceneRasterHeight());
    ProductUtils.copyProductNodes(masterProduct,targetProduct);
  break;
case MIN_EXTENT:
determinMinExtents();
break;
default :
determinMaxExtents();
break;
}
if (appendToMaster) {
for (Band b : masterProduct.getBands()) {
if (!(b instanceof VirtualBand)) {
final Band targetBand=new Band(b.getName(),b.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(b,targetBand);
targetBand.setSourceImage(b.getSourceImage());
masterProductBands.add(b.getName());
sourceRasterMap.put(targetBand,b);
targetProduct.addBand(targetBand);
}
}
}
String suffix="String_Node_Str";
if (!appendToMaster) {
for (final Band srcBand : slaveBandList) {
if (srcBand == masterBands[0] || (masterBands.length > 1 && srcBand == masterBands[1])) {
suffix="String_Node_Str" + StackUtils.createBandTimeStamp(srcBand.getProduct());
final Band targetBand=new Band(srcBand.getName() + suffix,srcBand.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
if (extent.equals(MASTER_EXTENT)) {
targetBand.setSourceImage(srcBand.getSourceImage());
}
masterProductBands.add(targetBand.getName());
sourceRasterMap.put(targetBand,srcBand);
targetProduct.addBand(targetBand);
}
}
}
int cnt=1;
if (appendToMaster) {
for (Band trgBand : targetProduct.getBands()) {
final String name=trgBand.getName();
if (name.contains("String_Node_Str" + cnt)) ++cnt;
}
}
for (final Band srcBand : slaveBandList) {
if (!(srcBand == masterBands[0] || (masterBands.length > 1 && srcBand == masterBands[1]))) {
if (srcBand.getUnit() != null && srcBand.getUnit().equals(Unit.IMAGINARY)) {
}
 else {
suffix="String_Node_Str" + cnt++ + StackUtils.createBandTimeStamp(srcBand.getProduct());
}
final String tgtBandName=srcBand.getName() + suffix;
if (targetProduct.getBand(tgtBandName) == null) {
final Product srcProduct=srcBand.getProduct();
final Band targetBand=new Band(tgtBandName,srcBand.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
if (extent.equals(MASTER_EXTENT) && (srcProduct == masterProduct || srcProduct.isCompatibleProduct(targetProduct,1.0e-3f))) {
targetBand.setSourceImage(srcBand.getSourceImage());
}
if (srcBand.getProduct() == masterProduct) {
masterProductBands.add(tgtBandName);
}
sourceRasterMap.put(targetBand,srcBand);
targetProduct.addBand(targetBand);
}
}
}
copySlaveMetadata();
StackUtils.saveMasterProductBandNames(targetProduct,masterProductBands.toArray(new String[masterProductBands.size()]));
saveSlaveProductNames(targetProduct,sourceRasterMap);
updateMetadata();
final ProductNodeGroup<Placemark> masterGCPgroup=masterProduct.getGcpGroup();
if (masterGCPgroup.getNodeCount() > 0) {
OperatorUtils.copyGCPsToTarget(masterGCPgroup,GCPManager.instance().getGcpGroup(targetProduct.getBandAt(0)),targetProduct.getSceneGeoCoding());
}
if (!resamplingType.contains("String_Node_Str")) {
selectedResampling=ResamplingFactory.createResampling(resamplingType);
}
 else {
if (initialOffsetMethod.equals(INITIAL_OFFSET_GEOLOCATION)) {
computeTargetSlaveCoordinateOffsets_GCP();
}
if (initialOffsetMethod.equals(INITIAL_OFFSET_ORBIT)) {
computeTargetSlaveCoordinateOffsets_Orbits();
}
}
}
 catch (Throwable e) {
OperatorUtils.catchOperatorException(getId(),e);
}
}

Fixed version (ground truth):
@Override public void initialize() throws OperatorException {
  try {
    if (sourceProduct == null) {
      return;
    }
    if (sourceProduct.length < 2) {
      throw new OperatorException("String_Node_Str");
    }
    for (    final Product prod : sourceProduct) {
      final InputProductValidator validator=new InputProductValidator(prod);
      if (validator.isTOPSARProduct() && !validator.isDebursted()) {
        throw new OperatorException("String_Node_Str");
      }
      if (prod.getSceneGeoCoding() == null) {
        throw new OperatorException(MessageFormat.format("String_Node_Str",prod.getName()));
      }
    }
    if (masterBandNames == null || masterBandNames.length == 0 || getMasterProduct(masterBandNames[0]) == null) {
      final Product defaultProd=sourceProduct[0];
      if (defaultProd != null) {
        final Band defaultBand=defaultProd.getBandAt(0);
        if (defaultBand != null) {
          if (defaultBand.getUnit() != null && defaultBand.getUnit().equals(Unit.REAL))           masterBandNames=new String[]{defaultProd.getBandAt(0).getName(),defaultProd.getBandAt(1).getName()};
 else           masterBandNames=new String[]{defaultBand.getName()};
        }
      }
      if (masterBandNames.length == 0) {
        targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
        return;
      }
    }
    masterProduct=getMasterProduct(masterBandNames[0]);
    if (masterProduct == null) {
      targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
      return;
    }
    appendToMaster=AbstractMetadata.getAbstractedMetadata(masterProduct).getAttributeInt(AbstractMetadata.coregistered_stack,0) == 1;
    final List<String> masterProductBands=new ArrayList<>(masterProduct.getNumBands());
    final Band[] slaveBandList=getSlaveBands();
    if (masterProduct == null || slaveBandList.length == 0 || slaveBandList[0] == null) {
      targetProduct=OperatorUtils.createDummyTargetProduct(sourceProduct);
      return;
    }
    if (resamplingType.contains("String_Node_Str") && !extent.equals(MASTER_EXTENT)) {
      throw new OperatorException("String_Node_Str");
    }
    if (appendToMaster) {
      extent=MASTER_EXTENT;
    }
switch (extent) {
case MASTER_EXTENT:
      targetProduct=new Product(masterProduct.getName(),masterProduct.getProductType(),masterProduct.getSceneRasterWidth(),masterProduct.getSceneRasterHeight());
    ProductUtils.copyProductNodes(masterProduct,targetProduct);
  break;
case MIN_EXTENT:
determinMinExtents();
break;
default :
determinMaxExtents();
break;
}
if (appendToMaster) {
for (Band b : masterProduct.getBands()) {
if (!(b instanceof VirtualBand)) {
final Band targetBand=new Band(b.getName(),b.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(b,targetBand);
targetBand.setSourceImage(b.getSourceImage());
masterProductBands.add(b.getName());
sourceRasterMap.put(targetBand,b);
targetProduct.addBand(targetBand);
}
}
}
String suffix="String_Node_Str";
if (!appendToMaster) {
for (final Band srcBand : slaveBandList) {
if (srcBand == masterBands[0] || (masterBands.length > 1 && srcBand == masterBands[1])) {
suffix="String_Node_Str" + StackUtils.createBandTimeStamp(srcBand.getProduct());
final Band targetBand=new Band(srcBand.getName() + suffix,srcBand.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
if (extent.equals(MASTER_EXTENT)) {
targetBand.setSourceImage(srcBand.getSourceImage());
}
masterProductBands.add(targetBand.getName());
sourceRasterMap.put(targetBand,srcBand);
targetProduct.addBand(targetBand);
}
}
}
int cnt=1;
if (appendToMaster) {
for (Band trgBand : targetProduct.getBands()) {
final String name=trgBand.getName();
if (name.contains("String_Node_Str" + cnt)) ++cnt;
}
}
for (final Band srcBand : slaveBandList) {
if (!(srcBand == masterBands[0] || (masterBands.length > 1 && srcBand == masterBands[1]))) {
if (srcBand.getUnit() != null && srcBand.getUnit().equals(Unit.IMAGINARY)) {
}
 else {
suffix="String_Node_Str" + cnt++ + StackUtils.createBandTimeStamp(srcBand.getProduct());
}
final String tgtBandName=srcBand.getName() + suffix;
if (targetProduct.getBand(tgtBandName) == null) {
final Product srcProduct=srcBand.getProduct();
final Band targetBand=new Band(tgtBandName,srcBand.getDataType(),targetProduct.getSceneRasterWidth(),targetProduct.getSceneRasterHeight());
ProductUtils.copyRasterDataNodeProperties(srcBand,targetBand);
if (extent.equals(MASTER_EXTENT) && (srcProduct == masterProduct || srcProduct.isCompatibleProduct(targetProduct,1.0e-3f))) {
targetBand.setSourceImage(srcBand.getSourceImage());
}
if (srcBand.getProduct() == masterProduct) {
masterProductBands.add(tgtBandName);
}
sourceRasterMap.put(targetBand,srcBand);
targetProduct.addBand(targetBand);
}
}
}
copySlaveMetadata();
StackUtils.saveMasterProductBandNames(targetProduct,masterProductBands.toArray(new String[masterProductBands.size()]));
saveSlaveProductNames(targetProduct,sourceRasterMap);
updateMetadata();
final ProductNodeGroup<Placemark> masterGCPgroup=masterProduct.getGcpGroup();
if (masterGCPgroup.getNodeCount() > 0) {
OperatorUtils.copyGCPsToTarget(masterGCPgroup,GCPManager.instance().getGcpGroup(targetProduct.getBandAt(0)),targetProduct.getSceneGeoCoding());
}
if (!resamplingType.contains("String_Node_Str")) {
selectedResampling=ResamplingFactory.createResampling(resamplingType);
}
 else {
if (initialOffsetMethod.equals(INITIAL_OFFSET_GEOLOCATION)) {
computeTargetSlaveCoordinateOffsets_GCP();
}
if (initialOffsetMethod.equals(INITIAL_OFFSET_ORBIT)) {
computeTargetSlaveCoordinateOffsets_Orbits();
}
}
}
 catch (Throwable e) {
OperatorUtils.catchOperatorException(getId(),e);
}
}