Source:
public void doExport(String productBranding, String productVersion) { Validate.notNull(productBranding, "invalid null product branding"); Validate.notNull(productVersion, "invalid null product version"); final String ddfHome = System.getProperty("ddf.home"); final Properties systemProperties = System.getProperties(); String customSystemPropertiesFile = ""; try { customSystemPropertiesFile = new String( Files.readAllBytes(MigrationContextImpl.METADATA_CUSTOM_SYSTEM_PROPERTIES_PATH)); } catch (IOException e) { LOGGER.error("Could not read custom system properties file."); } LOGGER.debug( "Exporting product under with version to [{}]...", productBranding, productVersion, ddfHome, MigrationContextImpl.CURRENT_VERSION, exportFile); metadata.put(MigrationContextImpl.METADATA_VERSION, MigrationContextImpl.CURRENT_VERSION); metadata.put(MigrationContextImpl.METADATA_PRODUCT_BRANDING, productBranding); metadata.put(MigrationContextImpl.METADATA_PRODUCT_VERSION, productVersion); metadata.put(MigrationContextImpl.METADATA_DATE, new Date().toString()); metadata.put(MigrationContextImpl.METADATA_DDF_HOME, ddfHome); metadata.put(MigrationContextImpl.METADATA_CUSTOM_SYSTEM_PROPERTIES, systemProperties); metadata.put( MigrationContextImpl.METADATA_CUSTOM_SYSTEM_PROPERTIES_FILE, customSystemPropertiesFile); metadata.put( MigrationContextImpl.METADATA_MIGRATABLES, contexts .values() .stream() .map(ExportMigrationContextImpl::doExport) .collect( LinkedHashMap::new, LinkedHashMap::putAll, LinkedHashMap::putAll)); LOGGER.debug("Exported metadata: {}", metadata); }

Target:
public final void doExport(String productBranding, String productVersion) { Validate.notNull(productBranding, "invalid null product branding"); Validate.notNull(productVersion, "invalid null product version"); final String ddfHome = System.getProperty("ddf.home"); final Path ddfHomePath = Paths.get(ddfHome); final Properties systemProperties = AccessUtils.doPrivileged(() -> System.getProperties()); final String systemPropertiesFile = getPropertiesFile(ddfHomePath.resolve(SYSTEM_PROPERTIES_PATH)); final String customSystemPropertiesFile = getPropertiesFile(ddfHomePath.resolve(CUSTOM_SYSTEM_PROPERTIES_PATH)); LOGGER.debug( "Exporting product under with version to [{}]...", productBranding, productVersion, ddfHome, MigrationContextImpl.CURRENT_VERSION, exportFile); metadata.put(MigrationContextImpl.METADATA_VERSION, MigrationContextImpl.CURRENT_VERSION); metadata.put(MigrationContextImpl.METADATA_PRODUCT_BRANDING, productBranding); metadata.put(MigrationContextImpl.METADATA_PRODUCT_VERSION, productVersion); metadata.put(MigrationContextImpl.METADATA_DATE, new Date().toString()); metadata.put(MigrationContextImpl.METADATA_DDF_HOME, ddfHome); metadata.put(MigrationContextImpl.METADATA_EXPANDED_SYSTEM_PROPERTIES, systemProperties); metadata.put( MigrationContextImpl.METADATA_SYSTEM_PROPERTIES_PATH.toString(), systemPropertiesFile); metadata.put( MigrationContextImpl.METADATA_CUSTOM_SYSTEM_PROPERTIES_PATH.toString(), customSystemPropertiesFile); metadata.put( MigrationContextImpl.METADATA_MIGRATABLES, contexts .values() .stream() .map(ExportMigrationContextImpl::doExport) .collect( LinkedHashMap::new, LinkedHashMap::putAll, LinkedHashMap::putAll)); LOGGER.debug("Exported metadata: {}", metadata); }