elk-util-parent/elk-util-common/src/main/java/org/semanticweb/elk/config/ConfigurationFactory.java
public void saveConfiguration(File configOnDisk, BaseConfiguration config)
			throws ConfigurationException, IOException {
		/*
		 * Unfortunately, we can't directly write the config on disk because the
		 * parameters in it may be just a subset of those on disk. So we load it
		 * first (alternatively one may use a singleton, which I typically try
		 * to avoid). It should work reasonably well unless there're too many
		 * parameters (in which case we should think of a mini key-value store).
		 */
		InputStream stream = null;
		BaseConfiguration loadedConfig = null;
		Properties diskProps = new Properties();

		try {
			stream = new FileInputStream(configOnDisk);
			loadedConfig = getConfiguration(stream, "", config.getClass());
			// copy parameters
			copyParameters(loadedConfig, diskProps);
		} catch (Throwable e) {
			LOGGER_.info("Overwriting configuration since it can't be loaded (perhaps doesn't exist?)");
		} finally {
			IOUtils.closeQuietly(stream);
		}

		copyParameters(config, diskProps);
		// now save it to the file
		saveProperties(diskProps, configOnDisk);
	}
public void saveConfiguration(File configOnDisk, BaseConfiguration config)
			throws ConfigurationException, IOException {
		/*
		 * Unfortunately, we can't directly write the config on disk because the
		 * parameters in it may be just a subset of those on disk. So we load it
		 * first (alternatively one may use a singleton, which I typically try
		 * to avoid). It should work reasonably well unless there're too many
		 * parameters (in which case we should think of a mini key-value store).
		 */
		InputStream stream = null;
		BaseConfiguration loadedConfig = null;
		Properties diskProps = new Properties();

		try {
			stream = new FileInputStream(configOnDisk);
			loadedConfig = getConfiguration(stream, "", config.getClass());
			// copy parameters
			copyParameters(loadedConfig, diskProps);
		} catch (Throwable e) {
			LOGGER_.info("Overwriting configuration since it can't be loaded (perhaps doesn't exist?)");
		} finally {
			IOUtils.closeQuietly(stream);
		}

		copyParameters(config, diskProps);
		// now save it to the file
		saveProperties(diskProps, configOnDisk);
	}
public void saveConfiguration ( File configOnDisk , BaseConfiguration config ) throws ConfigurationException , IOException { /*
		 * Unfortunately, we can't directly write the config on disk because the
		 * parameters in it may be just a subset of those on disk. So we load it
		 * first (alternatively one may use a singleton, which I typically try
		 * to avoid). It should work reasonably well unless there're too many
		 * parameters (in which case we should think of a mini key-value store).
		 */ InputStream stream = null ; BaseConfiguration loadedConfig = null ; Properties diskProps = new Properties ( ) ; try { stream = new FileInputStream ( configOnDisk ) ; loadedConfig = getConfiguration ( stream , "" , config . getClass ( ) ) ; // copy parameters copyParameters ( loadedConfig , diskProps ) ; } catch ( Throwable e ) { LOGGER_ . info ( "Overwriting configuration since it can't be loaded (perhaps doesn't exist?)" ) ; } finally { IOUtils . closeQuietly ( stream ) ; } copyParameters ( config , diskProps ) ; // now save it to the file saveProperties ( diskProps , configOnDisk ) ; }
Not a thread-safe method. Shouldn't be invoked concurrently.

@param configOnDisk
@param config
@throws ConfigurationException
@throws IOException
Not a thread - safe method . Shouldn t be invoked concurrently .