diff --git a/framework/base/src/org/ofbiz/base/util/Debug.java b/framework/base/src/org/ofbiz/base/util/Debug.java index 8e7fb3b700..ebe7a5fff2 100644 --- a/framework/base/src/org/ofbiz/base/util/Debug.java +++ b/framework/base/src/org/ofbiz/base/util/Debug.java @@ -66,8 +66,12 @@ public final class Debug { // initialize levelOnCache Properties properties = UtilProperties.createProperties("debug.properties"); - for (int i = 0; i < levelOnCache.length; i++) { - levelOnCache[i] = (i == Debug.ALWAYS || "true".equalsIgnoreCase(properties.getProperty(levelProps[i]))); + if (properties != null) { + for (int i = 0; i < levelOnCache.length; i++) { + levelOnCache[i] = (i == Debug.ALWAYS || "true".equalsIgnoreCase(properties.getProperty(levelProps[i]))); + } + } else { + throw new IllegalStateException("debug.properties file not found"); } } diff --git a/framework/base/src/org/ofbiz/base/util/UtilProperties.java b/framework/base/src/org/ofbiz/base/util/UtilProperties.java index 655adbd563..0c48c16480 100644 --- a/framework/base/src/org/ofbiz/base/util/UtilProperties.java +++ b/framework/base/src/org/ofbiz/base/util/UtilProperties.java @@ -287,9 +287,10 @@ public class UtilProperties implements Serializable { * properties files before OFBiz has been fully initialized.

* * @param fileName The full name of the properties file ("foo.properties") - * @return A new Properties instance created from fileName + * @return A new Properties instance created from fileName, or + * null if the file was not found * @throws IllegalArgumentException if fileName is empty - * @throws IllegalStateException if there were any problems reading the file + * @throws IllegalStateException if there was a problem reading the file */ public static Properties createProperties(String fileName) { Assert.notEmpty("fileName", fileName); @@ -297,14 +298,14 @@ public class UtilProperties implements Serializable { try { URL url = Thread.currentThread().getContextClassLoader().getResource(fileName); if (url == null) { - throw new IllegalStateException(fileName + " not found"); + return null; } inStream = url.openStream(); Properties properties = new Properties(); properties.load(inStream); return properties; } catch (Exception e) { - throw new IllegalStateException("Exception thrown while reading debug.properties: " + e); + throw new IllegalStateException("Exception thrown while reading " + fileName + ": " + e); } finally { if (inStream != null) { try {