commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils DbUtils.java
Date Thu, 23 Oct 2003 00:01:47 GMT
dgraham     2003/10/22 17:01:47

  Modified:    dbutils/src/java/org/apache/commons/dbutils/driver
                        DriverWrapper.java
               dbutils/src/java/org/apache/commons/dbutils DbUtils.java
  Log:
  Renamed ensureLoaded() to more descriptive loadDriver().
  Also improved the name of the parameter to make things
  more self explanatory.
  
  Revision  Changes    Path
  1.4       +5 -5      jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/driver/DriverWrapper.java
  
  Index: DriverWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/driver/DriverWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DriverWrapper.java	19 Oct 2003 20:20:06 -0000	1.3
  +++ DriverWrapper.java	23 Oct 2003 00:01:47 -0000	1.4
  @@ -120,7 +120,7 @@
           }
           String classname = url.substring(0, idx);
   
  -        DbUtils.ensureLoaded(classname);
  +        DbUtils.loadDriver(classname);
   
           url = url.substring(idx + 1);
   
  @@ -149,7 +149,7 @@
           }
           String classname = url.substring(0, idx);
   
  -        DbUtils.ensureLoaded(classname);
  +        DbUtils.loadDriver(classname);
   
           url = url.substring(idx + 1);
   
  
  
  
  1.40      +31 -31    jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java
  
  Index: DbUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- DbUtils.java	19 Oct 2003 19:21:30 -0000	1.39
  +++ DbUtils.java	23 Oct 2003 00:01:47 -0000	1.40
  @@ -174,35 +174,35 @@
       }
       
       /**
  -     * Ensures that a database driver class is loaded.
  -     * If this succeeds, then it returns true, else it returns false.
  +     * Loads and registers a database driver class.
  +     * If this succeeds, it returns true, else it returns false.
        */
  -    public static boolean ensureLoaded(String name) {
  -        try {
  -            Class.forName(name).newInstance();
  -            return true;
  +	public static boolean loadDriver(String driverClassName) {
  +		try {
  +			Class.forName(driverClassName).newInstance();
  +			return true;
   
  -        } catch (ClassNotFoundException e) {
  -            // TODO Logging?
  -            //e.printStackTrace();
  -            return false;
  +		} catch (ClassNotFoundException e) {
  +			// TODO Logging?
  +			//e.printStackTrace();
  +			return false;
   
  -        } catch (IllegalAccessException e) {
  -            // TODO Logging?
  -            //e.printStackTrace();
  +		} catch (IllegalAccessException e) {
  +			// TODO Logging?
  +			//e.printStackTrace();
   
  -            // Constructor is private, OK for DriverManager contract
  -            return true;
  +			// Constructor is private, OK for DriverManager contract
  +			return true;
   
  -        } catch (InstantiationException e) {
  -            // TODO Logging?
  -            //e.printStackTrace();
  -            return false;
  +		} catch (InstantiationException e) {
  +			// TODO Logging?
  +			//e.printStackTrace();
  +			return false;
   
  -        } catch (Throwable t) {
  -            return false;
  -        }
  -    }
  +		} catch (Throwable t) {
  +			return false;
  +		}
  +	}
       
       public static void printStackTrace(SQLException sqle) {
           printStackTrace(sqle, new PrintWriter(System.err));
  
  
  

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


Mime
View raw message