Fix configuration folder log message
diff --git a/core/org.eclipse.smila.utils/code/src/org/eclipse/smila/utils/config/ConfigUtils.java b/core/org.eclipse.smila.utils/code/src/org/eclipse/smila/utils/config/ConfigUtils.java
index 285fa8b..eb671b9 100644
--- a/core/org.eclipse.smila.utils/code/src/org/eclipse/smila/utils/config/ConfigUtils.java
+++ b/core/org.eclipse.smila.utils/code/src/org/eclipse/smila/utils/config/ConfigUtils.java
@@ -2,7 +2,7 @@
* Copyright (c) 2008 empolis GmbH and brox IT Solutions GmbH. All rights reserved. This program and the accompanying
* materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors: Ivan Churkin (brox IT Solutions GmbH) - initial creator Sebastian Voigt (brox IT Solutions GmbH)
**********************************************************************************************************************/
package org.eclipse.smila.utils.config;
@@ -33,7 +33,7 @@
* </ul>
* The configs are attempted to be loaded in the order of the list above.
* <p>
- *
+ *
* The central config folder is determined in this order from the first non-blank location (the last will always
* succeed!)
* <ol>
@@ -41,7 +41,7 @@
* <li>an environment variable set to <code>org.eclipse.smila.utils.config.root=<path> </code></li>
* <li><code><org.eclipse.core.runtime.Platform.getInstallLocation()>/configuration.</code></li>
* </ol>
- *
+ *
*/
public final class ConfigUtils {
@@ -54,10 +54,10 @@
/** PRIOTIZED_PATHS. */
private static final String[] PRIOTIZED_PATHS = new String[] { System.getProperty(PROPERTY_CONFIG_ROOT) //
- , System.getenv(PROPERTY_CONFIG_ROOT) //
- // the use Platform can cause problems ---> org.eclipse.core.runtime should be started (level1 !?, default doesn't
- // help sometimes)
- , Platform.getInstallLocation().getURL().getFile() + CONFIGURATION_FOLDER_NAME };
+ , System.getenv(PROPERTY_CONFIG_ROOT) //
+ // the use Platform can cause problems ---> org.eclipse.core.runtime should be started (level1 !?, default doesn't
+ // help sometimes)
+ , Platform.getInstallLocation().getURL().getFile() + CONFIGURATION_FOLDER_NAME };
/** The Constant CONFIGURATION_FOLDER. */
private static final File CONFIGURATION_FOLDER = determineFolder();
@@ -70,7 +70,7 @@
/**
* Determine folder.
- *
+ *
* @return the file
*/
private static File determineFolder() {
@@ -114,7 +114,7 @@
* <strong>Note</strong>: While this methods supports the bundle name to be an arbitrary string that is not the name
* of the bundle for "normal" configs the defaultConfigPath will only work if the given bundle name is actually the
* name of the bundle.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
@@ -123,19 +123,20 @@
* @param defaultConfigPath
* the default config path to a resource that is contained in the bundle itself if the configPath doesnt
* resolve to an existing file.
- *
+ *
* @throws ConfigurationLoadException
* if the denoted config file doesnt exist or cannot be opened.
*/
public static InputStream getConfigStream(final String bundleName, final String configPath,
final String defaultConfigPath) {
- String effectivePath = "CONFIGURATION_FOLDER" + File.separator + new File(bundleName, configPath).getPath();
+ String effectivePath = CONFIGURATION_FOLDER + File.separator + new File(bundleName, configPath).getPath();
if (getConfigurationFolder() != null) {
final File bundleConfigRoot = new File(getConfigurationFolder(), bundleName);
if (bundleConfigRoot.exists()) {
final File configFile = new File(configPath);
- final File effectiveConfigFile = configFile.isAbsolute() ? configFile : new File(bundleConfigRoot, configPath);
+ final File effectiveConfigFile =
+ configFile.isAbsolute() ? configFile : new File(bundleConfigRoot, configPath);
effectivePath = effectiveConfigFile.getAbsolutePath();
if (effectiveConfigFile.exists()) {
try {
@@ -147,8 +148,8 @@
}
}
if (defaultConfigPath == null) {
- throw new ConfigurationLoadException(String.format("Configuration resource %s for the bundle %s not found",
- configPath, bundleName));
+ throw new ConfigurationLoadException(
+ String.format("Configuration resource %s for the bundle %s not found", configPath, bundleName));
}
final Bundle bundle = Platform.getBundle(bundleName);
if (bundle == null) {
@@ -156,9 +157,9 @@
}
final URL url = bundle.getEntry(defaultConfigPath);
if (url == null) {
- throw new ConfigurationLoadException(String.format(
- "Unable to find config file '%s' nor fallback config '%s' in bundle '%s'", effectivePath, defaultConfigPath,
- bundleName));
+ throw new ConfigurationLoadException(
+ String.format("Unable to find config file '%s' nor fallback config '%s' in bundle '%s'", effectivePath,
+ defaultConfigPath, bundleName));
}
try {
return url.openStream();
@@ -169,12 +170,12 @@
/**
* Gets the configuration folder.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
* the configuration name
- *
+ *
* @return the configuration folder
* @deprecated use the more correctly named {@link #getConfigFile(String, String)} as this may also return
* non-directory entries.
@@ -186,7 +187,7 @@
/**
* Gets the config file as denoted by the given arguments, or null if it doesnt exist.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
@@ -209,7 +210,7 @@
/**
* Gets the File object denoting the path as defined by the given arguments. Note that the file/folder may not exist.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
@@ -222,12 +223,12 @@
/**
* Gets the configuration stream.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
* the configuration path
- *
+ *
* @return the configuration stream
*/
public static InputStream getConfigStream(final String bundleName, final String configPath) {
@@ -236,12 +237,12 @@
/**
* Gets the files.
- *
+ *
* @param bundleName
* the bundle name
* @param configPath
* the config name
- *
+ *
* @return the configuration stream
*/
public static List<String> getConfigEntries(final String bundleName, final String configPath) {
@@ -251,7 +252,8 @@
file = new File(file, configPath);
if (file.exists()) {
if (!file.isDirectory()) {
- throw new ConfigurationLoadException("configPath does not denote a directory: " + file.getAbsolutePath());
+ throw new ConfigurationLoadException(
+ "configPath does not denote a directory: " + file.getAbsolutePath());
}
final String[] files = file.list();
return Arrays.asList(files);
@@ -272,14 +274,14 @@
}
return entries;
} catch (final Exception e) {
- throw new ConfigurationLoadException(String.format("Unable to find configuration resource %s in the bundle %s",
- configPath, bundleName));
+ throw new ConfigurationLoadException(
+ String.format("Unable to find configuration resource %s in the bundle %s", configPath, bundleName));
}
}
/**
* Gets the root configuration folder as set thru the env var/system propery {@value #PROPERTY_CONFIG_ROOT}.
- *
+ *
* @return the cONFIGURATION_FOLDER
*/
public static File getConfigurationFolder() {
@@ -288,11 +290,12 @@
/**
* Gets the config properties.
- *
+ *
* @see {@link #getConfigStream(String, String)} as it is called.
- *
+ *
*/
- public static Properties getConfigProperties(final String bundleName, final String configPath) throws IOException {
+ public static Properties getConfigProperties(final String bundleName, final String configPath)
+ throws IOException {
final Properties properties = new Properties();
final InputStream configStream = getConfigStream(bundleName, configPath);
try {
@@ -305,7 +308,7 @@
/**
* gets content of an configuration file as a string, assuming UTF-8 as the encoding.
- *
+ *
* @see {@link #getConfigStream(String, String)} as it is called.
*/
public static String getConfigContent(final String bundleName, final String configPath) throws IOException {