pgoldstein    2002/09/27 00:48:41

  Modified:    src/java/org/apache/james/util/mordred JdbcDataSource.java
  Log:
  Reverting class loader change that disabled the JDBC code.
  Adding comments and additional error logging around this code.
  
  Revision  Changes    Path
  1.16      +12 -3     
jakarta-james/src/java/org/apache/james/util/mordred/JdbcDataSource.java
  
  Index: JdbcDataSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/util/mordred/JdbcDataSource.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JdbcDataSource.java       25 Sep 2002 23:29:39 -0000      1.15
  +++ JdbcDataSource.java       27 Sep 2002 07:48:40 -0000      1.16
  @@ -234,14 +234,23 @@
                   if (getLogger().isDebugEnabled()) {
                       getLogger().debug("Loading new driver: " + jdbcDriver);
                   }
  -                
Thread.currentThread().getContextClassLoader().loadClass(jdbcDriver);
  +                // TODO: Figure out why this breaks when we change the 
Class.forName to
  +                //       a loadClass method call on the class loader.
  +                // DO NOT MESS WITH THIS UNLESS YOU ARE WILLING TO TEST
  +                // AND FIX THE PROBLEMS!
  +                Class.forName(jdbcDriver, true, 
Thread.currentThread().getContextClassLoader());
  +                // These variations do NOT work:
  +                // getClass().getClassLoader().loadClass(jdbcDriver);               
     -- DON'T USE -- BROKEN!!
  +                // 
Thread.currentThread().getContextClassLoader().loadClass(jdbcDriver); -- DON'T USE -- 
BROKEN!!
               } catch(ClassNotFoundException cnfe) {
                   StringBuffer exceptionBuffer =
                       new StringBuffer(128)
                               .append("'")
                               .append(jdbcDriver)
                               .append("' could not be found in classloader.  Please 
specify a valid JDBC driver");
  -                throw new ConfigurationException(exceptionBuffer.toString());
  +                String exceptionMessage = exceptionBuffer.toString();
  +                getLogger().error(exceptionMessage);
  +                throw new ConfigurationException(exceptionMessage);
               }
               if(jdbcURL == null) {
                   throw new ConfigurationException("You need to specify a valid JDBC 
connection string, e.g., <dburl>jdbc:driver:database</dburl>");
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to