You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by to...@apache.org on 2004/06/16 22:34:22 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/configuration/impl ConfigurationAbstractImpl.java
tomdz 2004/06/16 13:34:22
Modified: src/java/org/apache/ojb/broker/util/configuration/impl
ConfigurationAbstractImpl.java
Log:
Changed logging so that a warning is printed when OJB's properties was not found except if the user explictly set the properties filename to an empty string via the system property
Revision Changes Path
1.15 +22 -7 db-ojb/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java
Index: ConfigurationAbstractImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ConfigurationAbstractImpl.java 1 Jun 2004 21:42:21 -0000 1.14
+++ ConfigurationAbstractImpl.java 16 Jun 2004 20:34:22 -0000 1.15
@@ -412,29 +412,44 @@
protected void load()
{
properties = new Properties();
+
+ String filename = getFilename();
+
try
{
- URL url = ClassHelper.getResource(getFilename());
+ URL url = ClassHelper.getResource(filename);
+
if (url == null)
{
- url = (new File(getFilename())).toURL();
+ url = (new File(filename)).toURL();
}
- logger.info("OJB.properties: " + url);
+
+ logger.info("Loading OJB's properties from file " + url);
InputStream strIn = url.openStream();
+
properties.load(strIn);
strIn.close();
}
catch (FileNotFoundException ex)
{
- // [tomdz] Promoted to info status as this is per se not an error
- logger.info("Could not load properties file "+getFilename()+". Using default settings!");
+ // [tomdz] If the filename is explicitly reset (null or empty string) then we'll
+ // output an info message because the user did this on purpose
+ // Otherwise, we'll output a warning
+ if ((filename == null) || (filename.length() == 0))
+ {
+ logger.info("Starting OJB without a properties file. OJB is using default settings instead.");
+ }
+ else
+ {
+ logger.warn("Could not load properties file '"+filename+"'. Using default settings!", ex);
+ }
// [tomdz] There seems to be no use of this setting ?
//properties.put("valid", "false");
}
catch (Exception ex)
{
- throw new MetadataException("An error happend while loading the properties file "+getFilename(), ex);
+ throw new MetadataException("An error happend while loading the properties file '"+filename+"'", ex);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org