Program: 170390
Project: 170390
Buggy source:
@Override protected Product readProductNodesImpl() throws IOException {
  productDirectory=RapidEyeL1ReaderPlugin.getInput(getInput());
  String metadataFileName=productDirectory.findFirst(RapidEyeConstants.METADATA_FILE_SUFFIX);
  File metadataFile=productDirectory.getFile(metadataFileName);
  if (metadataFile.exists()) {
    logger.info("String_Node_Str");
    metadata=XmlMetadata.create(RapidEyeMetadata.class,metadataFile);
    if (metadata == null) {
      logger.warning(String.format("String_Node_Str",metadataFile.getName()));
    }
 else {
      metadata.setFileName(metadataFile.getName());
      String metadataProfile=metadata.getMetadataProfile();
      if (metadataProfile == null || !metadataProfile.startsWith(RapidEyeConstants.PROFILE_L1)) {
        IOException ex=new IOException("String_Node_Str");
        logger.log(Level.SEVERE,ex.getMessage(),ex);
        throw ex;
      }
    }
  }
 else {
    logger.info("String_Node_Str");
  }
  parseAdditionalMetadataFiles();
  try {
    String[] nitfFiles=getRasterFileNames(productDirectory);
    for (int i=0; i < nitfFiles.length; i++) {
      NITFReaderWrapper reader=new NITFReaderWrapper(productDirectory.getFile(nitfFiles[i]));
      if (product == null) {
        product=new Product(metadata != null ? metadata.getProductName() : RapidEyeConstants.PRODUCT_GENERIC_NAME,RapidEyeConstants.L1_FORMAT_NAMES[0],metadata != null ? metadata.getRasterWidth() : reader.getWidth(),metadata != null ? metadata.getRasterHeight() : reader.getHeight(),this);
        if (metadata != null) {
          product.setProductType(metadata.getMetadataProfile());
          product.setStartTime(metadata.getProductStartTime());
          product.setEndTime(metadata.getProductEndTime());
          product.getMetadataRoot().addElement(metadata.getRootElement());
          NITFMetadata nitfMetadata=reader.getMetadata();
          if (nitfMetadata != null)           product.getMetadataRoot().addElement(nitfMetadata.getMetadataRoot());
        }
        product.setPreferredTileSize(getPreferredTileSize());
      }
      addBandToProduct(product,reader,i);
    }
    if (product != null) {
      readMasks(productDirectory);
      initGeoCoding(product);
      product.setModified(false);
    }
  }
 catch (  IIOException e) {
    logger.severe("String_Node_Str");
  }
  return product;
}

Fixed version (ground truth):
@Override protected Product readProductNodesImpl() throws IOException {
  productDirectory=RapidEyeReader.getInput(getInput());
  String metadataFileName=productDirectory.findFirst(RapidEyeConstants.METADATA_FILE_SUFFIX);
  File metadataFile=productDirectory.getFile(metadataFileName);
  if (metadataFile.exists()) {
    logger.info("String_Node_Str");
    metadata=XmlMetadata.create(RapidEyeMetadata.class,metadataFile);
    if (metadata == null) {
      logger.warning(String.format("String_Node_Str",metadataFile.getName()));
    }
 else {
      metadata.setFileName(metadataFile.getName());
      String metadataProfile=metadata.getMetadataProfile();
      if (metadataProfile == null || !metadataProfile.startsWith(RapidEyeConstants.PROFILE_L1)) {
        IOException ex=new IOException("String_Node_Str");
        logger.log(Level.SEVERE,ex.getMessage(),ex);
        throw ex;
      }
    }
  }
 else {
    logger.info("String_Node_Str");
  }
  parseAdditionalMetadataFiles();
  try {
    String[] nitfFiles=getRasterFileNames(productDirectory);
    for (int i=0; i < nitfFiles.length; i++) {
      NITFReaderWrapper reader=new NITFReaderWrapper(productDirectory.getFile(nitfFiles[i]));
      if (product == null) {
        product=new Product(metadata != null ? metadata.getProductName() : RapidEyeConstants.PRODUCT_GENERIC_NAME,RapidEyeConstants.L1_FORMAT_NAMES[0],metadata != null ? metadata.getRasterWidth() : reader.getWidth(),metadata != null ? metadata.getRasterHeight() : reader.getHeight(),this);
        if (metadata != null) {
          product.setProductType(metadata.getMetadataProfile());
          product.setStartTime(metadata.getProductStartTime());
          product.setEndTime(metadata.getProductEndTime());
          product.getMetadataRoot().addElement(metadata.getRootElement());
          NITFMetadata nitfMetadata=reader.getMetadata();
          if (nitfMetadata != null)           product.getMetadataRoot().addElement(nitfMetadata.getMetadataRoot());
        }
        product.setPreferredTileSize(getPreferredTileSize());
      }
      addBandToProduct(product,reader,i);
    }
    if (product != null) {
      readMasks(productDirectory);
      initGeoCoding(product);
      product.setModified(false);
    }
  }
 catch (  IIOException e) {
    logger.severe("String_Node_Str");
  }
  return product;
}