Program: 11427
Project: 11427
Buggy source:
/** 
 * Update the abstracted metadata in the target product.
 */
private void updateAbstractedMetadata(){
  final MetadataElement absRoot=AbstractMetadata.getAbstractedMetadata(targetProduct);
  absRoot.setAttributeUTC(AbstractMetadata.first_line_time,new ProductData.UTC(subSwathInfo[subSwathIndex - 1].burstFirstLineTime[firstBurstIndex - 1] / Constants.secondsInDay));
  absRoot.setAttributeUTC(AbstractMetadata.last_line_time,new ProductData.UTC(subSwathInfo[subSwathIndex - 1].burstLastLineTime[lastBurstIndex - 1] / Constants.secondsInDay));
  absRoot.setAttributeDouble(AbstractMetadata.line_time_interval,subSwathInfo[subSwathIndex - 1].azimuthTimeInterval);
  absRoot.setAttributeDouble(AbstractMetadata.slant_range_to_first_pixel,subSwathInfo[subSwathIndex - 1].slrTimeToFirstPixel * Constants.lightSpeed);
  absRoot.setAttributeDouble(AbstractMetadata.range_spacing,subSwathInfo[subSwathIndex - 1].rangePixelSpacing);
  absRoot.setAttributeDouble(AbstractMetadata.azimuth_spacing,subSwathInfo[subSwathIndex - 1].azimuthPixelSpacing);
  absRoot.setAttributeInt(AbstractMetadata.num_output_lines,subSwathInfo[subSwathIndex - 1].linesPerBurst * (lastBurstIndex - firstBurstIndex + 1));
  absRoot.setAttributeInt(AbstractMetadata.num_samples_per_line,subSwathInfo[subSwathIndex - 1].numOfSamples);
  final int cols=subSwathInfo[subSwathIndex - 1].latitude[0].length;
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_near_lat,subSwathInfo[subSwathIndex - 1].latitude[firstBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_near_long,subSwathInfo[subSwathIndex - 1].longitude[firstBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_far_lat,subSwathInfo[subSwathIndex - 1].latitude[firstBurstIndex - 1][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_far_long,subSwathInfo[subSwathIndex - 1].longitude[firstBurstIndex - 1][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_near_lat,subSwathInfo[subSwathIndex - 1].latitude[lastBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_near_long,subSwathInfo[subSwathIndex - 1].longitude[lastBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_far_lat,subSwathInfo[subSwathIndex - 1].latitude[lastBurstIndex - 1][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_far_long,subSwathInfo[subSwathIndex - 1].longitude[lastBurstIndex - 1][cols - 1]);
  final double incidenceNear=OperatorUtils.getIncidenceAngle(targetProduct).getPixelDouble(0,targetProduct.getSceneRasterHeight() / 2);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.incidence_near,incidenceNear);
  final double incidenceFar=OperatorUtils.getIncidenceAngle(targetProduct).getPixelDouble(targetProduct.getSceneRasterWidth() - 1,targetProduct.getSceneRasterHeight() / 2);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.incidence_far,incidenceFar);
  absRoot.setAttributeString(AbstractMetadata.swath,subswath);
  for (int i=0; i < selectedPolarisations.length; i++) {
    if (i == 0) {
      absRoot.setAttributeString(AbstractMetadata.mds1_tx_rx_polar,selectedPolarisations[i]);
    }
 else     if (i == 1) {
      absRoot.setAttributeString(AbstractMetadata.mds2_tx_rx_polar,selectedPolarisations[i]);
    }
 else     if (i == 2) {
      absRoot.setAttributeString(AbstractMetadata.mds3_tx_rx_polar,selectedPolarisations[i]);
    }
 else {
      absRoot.setAttributeString(AbstractMetadata.mds4_tx_rx_polar,selectedPolarisations[i]);
    }
  }
  final MetadataElement[] bandMetadataList=AbstractMetadata.getBandAbsMetadataList(absRoot);
  for (  MetadataElement bandMeta : bandMetadataList) {
    boolean include=false;
    if (bandMeta.getName().contains(subswath)) {
      for (      String pol : selectedPolarisations) {
        if (bandMeta.getName().contains(pol)) {
          include=true;
          break;
        }
      }
    }
    if (!include) {
      absRoot.removeElement(bandMeta);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the abstracted metadata in the target product.
 */
private void updateAbstractedMetadata(){
  final MetadataElement absRoot=AbstractMetadata.getAbstractedMetadata(targetProduct);
  absRoot.setAttributeUTC(AbstractMetadata.first_line_time,new ProductData.UTC(subSwathInfo[subSwathIndex - 1].burstFirstLineTime[firstBurstIndex - 1] / Constants.secondsInDay));
  absRoot.setAttributeUTC(AbstractMetadata.last_line_time,new ProductData.UTC(subSwathInfo[subSwathIndex - 1].burstLastLineTime[lastBurstIndex - 1] / Constants.secondsInDay));
  absRoot.setAttributeDouble(AbstractMetadata.line_time_interval,subSwathInfo[subSwathIndex - 1].azimuthTimeInterval);
  absRoot.setAttributeDouble(AbstractMetadata.slant_range_to_first_pixel,subSwathInfo[subSwathIndex - 1].slrTimeToFirstPixel * Constants.lightSpeed);
  absRoot.setAttributeDouble(AbstractMetadata.range_spacing,subSwathInfo[subSwathIndex - 1].rangePixelSpacing);
  absRoot.setAttributeDouble(AbstractMetadata.azimuth_spacing,subSwathInfo[subSwathIndex - 1].azimuthPixelSpacing);
  absRoot.setAttributeInt(AbstractMetadata.num_output_lines,subSwathInfo[subSwathIndex - 1].linesPerBurst * (lastBurstIndex - firstBurstIndex + 1));
  absRoot.setAttributeInt(AbstractMetadata.num_samples_per_line,subSwathInfo[subSwathIndex - 1].numOfSamples);
  final int cols=subSwathInfo[subSwathIndex - 1].latitude[0].length;
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_near_lat,subSwathInfo[subSwathIndex - 1].latitude[firstBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_near_long,subSwathInfo[subSwathIndex - 1].longitude[firstBurstIndex - 1][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_far_lat,subSwathInfo[subSwathIndex - 1].latitude[firstBurstIndex - 1][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.first_far_long,subSwathInfo[subSwathIndex - 1].longitude[firstBurstIndex - 1][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_near_lat,subSwathInfo[subSwathIndex - 1].latitude[lastBurstIndex][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_near_long,subSwathInfo[subSwathIndex - 1].longitude[lastBurstIndex][0]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_far_lat,subSwathInfo[subSwathIndex - 1].latitude[lastBurstIndex][cols - 1]);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.last_far_long,subSwathInfo[subSwathIndex - 1].longitude[lastBurstIndex][cols - 1]);
  final double incidenceNear=OperatorUtils.getIncidenceAngle(targetProduct).getPixelDouble(0,targetProduct.getSceneRasterHeight() / 2);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.incidence_near,incidenceNear);
  final double incidenceFar=OperatorUtils.getIncidenceAngle(targetProduct).getPixelDouble(targetProduct.getSceneRasterWidth() - 1,targetProduct.getSceneRasterHeight() / 2);
  AbstractMetadata.setAttribute(absRoot,AbstractMetadata.incidence_far,incidenceFar);
  absRoot.setAttributeString(AbstractMetadata.swath,subswath);
  for (int i=0; i < selectedPolarisations.length; i++) {
    if (i == 0) {
      absRoot.setAttributeString(AbstractMetadata.mds1_tx_rx_polar,selectedPolarisations[i]);
    }
 else     if (i == 1) {
      absRoot.setAttributeString(AbstractMetadata.mds2_tx_rx_polar,selectedPolarisations[i]);
    }
 else     if (i == 2) {
      absRoot.setAttributeString(AbstractMetadata.mds3_tx_rx_polar,selectedPolarisations[i]);
    }
 else {
      absRoot.setAttributeString(AbstractMetadata.mds4_tx_rx_polar,selectedPolarisations[i]);
    }
  }
  final MetadataElement[] bandMetadataList=AbstractMetadata.getBandAbsMetadataList(absRoot);
  for (  MetadataElement bandMeta : bandMetadataList) {
    boolean include=false;
    if (bandMeta.getName().contains(subswath)) {
      for (      String pol : selectedPolarisations) {
        if (bandMeta.getName().contains(pol)) {
          include=true;
          break;
        }
      }
    }
    if (!include) {
      absRoot.removeElement(bandMeta);
    }
  }
}