ProductUtils.copySpectralBandProperties(radianceBand, toaReflBand);
toaReflBand.setNoDataValueUsed(true);
toaReflBand.setNoDataValue(NO_DATA_VALUE);
bandMap.put(toaReflBand, radianceBand);
}
<BUG>ProductUtils.copyFlagBands(sourceProduct, targetProduct);

copyFlagSourceImages();
BandMathsOp bandArithmeticOp = BandMathsOp.createBooleanExpressionBand("l1_flags.INVALID", sourceProduct);
</BUG>
invalidBand = bandArithmeticOp.getTargetProduct().getBandAt(0);

ProductUtils.copySpectralBandProperties(radianceBand, toaReflBand);
toaReflBand.setNoDataValueUsed(true);
toaReflBand.setNoDataValue(NO_DATA_VALUE);
bandMap.put(toaReflBand, radianceBand);
}
ProductUtils.copyFlagBands(sourceProduct, targetProduct, true);
BandMathsOp bandArithmeticOp = BandMathsHelper.createBooleanExpressionBand("l1_flags.INVALID", sourceProduct);
