dlr 01/08/20 20:36:01
Modified: src/java/org/apache/torque/adapter DBFactory.java
Log:
Corrected spelling (adpator -> adapter). Handled both cases to
support older properties files.
Revision Changes Path
1.4 +23 -10
jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBFactory.java
Index: DBFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- DBFactory.java 2001/08/15 21:18:54 1.3
+++ DBFactory.java 2001/08/21 03:36:01 1.4
@@ -59,6 +59,7 @@
import java.util.Vector;
import org.apache.commons.collections.ExtendedProperties;
+import org.apache.commons.util.StringUtils;
import org.apache.log4j.Category;
/**
@@ -69,7 +70,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Ralf Stranzenbach</a>
- * @version $Id: DBFactory.java,v 1.3 2001/08/15 21:18:54 dlr Exp $
+ * @version $Id: DBFactory.java,v 1.4 2001/08/21 03:36:01 dlr Exp $
*/
public class DBFactory
{
@@ -93,9 +94,9 @@
}
// This static code creates the list of possible drivers and adds
- // the "NO DATABASE" adaptor to this list. After all the
+ // the "NO DATABASE" adapter to this list. After all the
// configuration is queried to get a list of JDBC drivers and
- // their associated adaptors.
+ // their associated adapters.
public static void init()
{
drivers = new Hashtable();
@@ -103,13 +104,25 @@
// Add the null db driver.
registerDriver("", DBNone.class);
- Enumeration adaptors =
- configuration.getVector("database.adaptor").elements();
- while (adaptors.hasMoreElements())
+ Enumeration adapters =
+ configuration.getVector("database.adapter").elements();
+ if (!adapters.hasMoreElements())
{
- String adaptor = (String)adaptors.nextElement();
+ // Unfortunately, once upon a time this property was
+ // spelled incorrectly.
+ adapters = configuration.getVector("database.adaptor").elements();
+ }
+ while (adapters.hasMoreElements())
+ {
+ String adapter = (String) adapters.nextElement();
String driver =
- configuration.getString("database.adaptor." + adaptor);
+ configuration.getString("database.adapter." + adapter);
+ if (!StringUtils.isValid(driver))
+ {
+ // Also previously spelled incorrectly.
+ driver =
+ configuration.getString("database.adaptor." + adapter);
+ }
Class c = null;
try
@@ -118,13 +131,13 @@
// This needs to be configurable, or set
// in a hidden property file.
c = Class.forName(
- "org.apache.torque.adapter." + adaptor);
+ "org.apache.torque.adapter." + adapter);
}
catch (ClassNotFoundException ign1)
{
try
{
- c = Class.forName(adaptor);
+ c = Class.forName(adapter);
}
catch (ClassNotFoundException ign2)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]