Fixed a possible NPE.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@709549 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/src/main/java/org/apache/felix/main/Main.java b/main/src/main/java/org/apache/felix/main/Main.java
index 59368d9..69839be 100644
--- a/main/src/main/java/org/apache/felix/main/Main.java
+++ b/main/src/main/java/org/apache/felix/main/Main.java
@@ -57,6 +57,10 @@
* The default name used for the configuration properties file.
**/
public static final String CONFIG_PROPERTIES_FILE_VALUE = "config.properties";
+ /**
+ * Name of the configuration directory.
+ */
+ public static final String CONFIG_DIRECTORY = "conf";
private static Framework m_felix = null;
@@ -176,6 +180,13 @@
// Read configuration properties.
Properties configProps = Main.loadConfigProperties();
+ // If no configuration properties were found, then create
+ // an empty properties object.
+ if (configProps == null)
+ {
+ System.err.println("No " + CONFIG_PROPERTIES_FILE_VALUE + " found.");
+ configProps = new Properties();
+ }
// Copy framework properties from the system properties.
Main.copySystemProperties(configProps);
@@ -267,12 +278,12 @@
// directory of the felix.jar directory.
confDir = new File(
new File(new File(jarLocation).getAbsolutePath()).getParent(),
- "conf");
+ CONFIG_DIRECTORY);
}
else
{
// Can't figure it out so use the current directory as default.
- confDir = new File(System.getProperty("user.dir"));
+ confDir = new File(System.getProperty("user.dir"), CONFIG_DIRECTORY);
}
try
@@ -378,12 +389,12 @@
// directory of the felix.jar directory.
confDir = new File(
new File(new File(jarLocation).getAbsolutePath()).getParent(),
- "conf");
+ CONFIG_DIRECTORY);
}
else
{
// Can't figure it out so use the current directory as default.
- confDir = new File(System.getProperty("user.dir"));
+ confDir = new File(System.getProperty("user.dir"), CONFIG_DIRECTORY);
}
try