vmassol 2002/07/28 06:36:55
Modified: framework/src/java/share/org/apache/cactus/util
Configuration.java
Log:
prevent an exception when cactus.properties is not found (as it is now optional)
Revision Changes Path
1.11 +11 -5
jakarta-cactus/framework/src/java/share/org/apache/cactus/util/Configuration.java
Index: Configuration.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/util/Configuration.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Configuration.java 26 Jul 2002 18:50:29 -0000 1.10
+++ Configuration.java 28 Jul 2002 13:36:55 -0000 1.11
@@ -63,6 +63,7 @@
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import java.util.Enumeration;
+import java.util.MissingResourceException;
/**
* Provides access to the Cactus configuration parameters that are independent
@@ -135,8 +136,13 @@
if (configOverride == null) {
// Try to read the default cactus configuration file from the
// classpath
- config = ClassLoaderUtils.loadPropertyResourceBundle(
- DEFAULT_CONFIG_NAME, Configuration.class);
+ try {
+ config = ClassLoaderUtils.loadPropertyResourceBundle(
+ DEFAULT_CONFIG_NAME, Configuration.class);
+ } catch (MissingResourceException e) {
+ // Cannot find cactus properties file. Do nothing.
+ return;
+ }
} else {
// Try to read from specified properties file
try {
@@ -144,8 +150,8 @@
new FileInputStream(configOverride));
} catch (IOException e) {
throw new ChainedRuntimeException(
- "Cannot read cactus configuration file ["
- + configOverride + "]", e);
+ "Cannot read cactus configuration file ["
+ + configOverride + "]", e);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>