db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/dsfactory AbstractDataSourceFactory.java PerUserPoolDataSourceFactory.java SharedPoolDataSourceFactory.java
Date Wed, 29 Dec 2004 10:50:49 GMT
henning     2004/12/29 02:50:49

  Modified:    src/java/org/apache/torque Tag: TORQUE_3_1_BRANCH
                        TorqueInstance.java
               src/java/org/apache/torque/dsfactory Tag: TORQUE_3_1_BRANCH
                        AbstractDataSourceFactory.java
                        PerUserPoolDataSourceFactory.java
                        SharedPoolDataSourceFactory.java
  Log:
  Add a few sanity tests for configuration objects. These should
  strictly spoken not be necessary, but better safe than sorry IMHO.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.5.2.7   +8 -9      db-torque/src/java/org/apache/torque/TorqueInstance.java
  
  Index: TorqueInstance.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/TorqueInstance.java,v
  retrieving revision 1.5.2.6
  retrieving revision 1.5.2.7
  diff -u -r1.5.2.6 -r1.5.2.7
  --- TorqueInstance.java	13 Dec 2004 17:08:27 -0000	1.5.2.6
  +++ TorqueInstance.java	29 Dec 2004 10:50:49 -0000	1.5.2.7
  @@ -123,7 +123,7 @@
               return;
           }
   
  -        if (conf == null)
  +        if (conf == null || conf.isEmpty())
           {
               throw new TorqueException("Torque cannot be initialized without "
                       + "a valid configuration. Please check the log files "
  @@ -138,7 +138,7 @@
   
           Configuration subConf = conf.subset("torque");
   
  -        if (!subConf.isEmpty())
  +        if (subConf != null && !subConf.isEmpty())
           {
               setConfiguration(subConf);
           }
  @@ -174,7 +174,11 @@
           adapterMap = new HashMap();
           Configuration c = conf.subset("database");
   
  -        if (c != null)
  +        if (c == null || c.isEmpty())
  +        {
  +            log.warn("No Database definitions found!");
  +        }
  +        else
           {
               boolean foundAdapters = false;
   
  @@ -207,11 +211,6 @@
                   throw new TorqueException(e);
               }
           }
  -        else
  -        {
  -            log.warn("No Database definitions found!");
  -        }
  -
       }
   
       /**
  
  
  
  No                   revision
  No                   revision
  1.12.2.5  +7 -2      db-torque/src/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
  
  Index: AbstractDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java,v
  retrieving revision 1.12.2.4
  retrieving revision 1.12.2.5
  diff -u -r1.12.2.4 -r1.12.2.5
  --- AbstractDataSourceFactory.java	19 Dec 2004 12:06:17 -0000	1.12.2.4
  +++ AbstractDataSourceFactory.java	29 Dec 2004 10:50:49 -0000	1.12.2.5
  @@ -84,6 +84,11 @@
       protected void setProperty(String property, Configuration c, Object ds)
           throws Exception
       {
  +        if (c == null || c.isEmpty())
  +        {
  +            return;
  +        }
  +
           String key = property;
           Class dsClass = ds.getClass();
           int dot = property.indexOf('.');
  @@ -214,7 +219,7 @@
           ConnectionPoolDataSource cpds = new DriverAdapterCPDS();
           Configuration c = Torque.getConfiguration();
   
  -        if (c == null)
  +        if (c == null || c.isEmpty())
           {
               log.warn("Global Configuration not set,"
                       + " no Default connection pool data source configured!");
  
  
  
  1.1.2.4   +2 -2      db-torque/src/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java
  
  Index: PerUserPoolDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- PerUserPoolDataSourceFactory.java	13 Dec 2004 17:08:27 -0000	1.1.2.3
  +++ PerUserPoolDataSourceFactory.java	29 Dec 2004 10:50:49 -0000	1.1.2.4
  @@ -83,7 +83,7 @@
           PerUserPoolDataSource ds = new PerUserPoolDataSource();
           Configuration c = Torque.getConfiguration();
   
  -        if (c == null)
  +        if (c == null || c.isEmpty())
           {
               log.warn("Global Configuration not set,"
                       + " no Default pool data source configured!");
  
  
  
  1.1.2.4   +2 -2      db-torque/src/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java
  
  Index: SharedPoolDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- SharedPoolDataSourceFactory.java	13 Dec 2004 17:08:27 -0000	1.1.2.3
  +++ SharedPoolDataSourceFactory.java	29 Dec 2004 10:50:49 -0000	1.1.2.4
  @@ -83,7 +83,7 @@
           SharedPoolDataSource ds = new SharedPoolDataSource();
           Configuration c = Torque.getConfiguration();
   
  -        if (c == null)
  +        if (c == null || c.isEmpty())
           {
               log.warn("Global Configuration not set,"
                       + " no Default pool data source configured!");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message