Author: bayard
Date: Wed Nov 23 12:09:26 2005
New Revision: 348539

URL: http://svn.apache.org/viewcvs?rev=348539&view=rev
Log:
It can be confusing to get a NullPointerException when you forget to set the 
DataSource or include the Connection parameter, so I've added a dedicated 
exception for this event

Modified:
    
jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java

Modified: 
jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java?rev=348539&r1=348538&r2=348539&view=diff
==============================================================================
--- 
jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java
 (original)
+++ 
jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java
 Wed Nov 23 12:09:26 2005
@@ -186,6 +186,9 @@
      * @since DbUtils 1.1
      */
     protected Connection prepareConnection() throws SQLException {
+        if(this.getDataSource() == null) {
+            throw new SQLException("QueryRunner requires a DataSource to be 
invoked in this way, or a Connection should be passed in");
+        }
         return this.getDataSource().getConnection();
     }
 



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

Reply via email to