commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r831690 - /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java
Date Sun, 01 Nov 2009 15:51:29 GMT
Author: psteitz
Date: Sun Nov  1 15:51:29 2009
New Revision: 831690

URL: http://svn.apache.org/viewvc?rev=831690&view=rev
Log:
Added null statement key field check in makeObject.

Modified:
    commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java

Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java?rev=831690&r1=831689&r2=831690&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java (original)
+++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/PoolingConnection.java Sun
Nov  1 15:51:29 2009
@@ -193,14 +193,18 @@
      */
     public Object makeObject(Object obj) throws Exception {
         if(null == obj || !(obj instanceof PStmtKey)) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("Prepared statement key is null or invalid.");
         } else {
             // _openPstmts++;
             PStmtKey key = (PStmtKey)obj;
             if(null == key._resultSetType && null == key._resultSetConcurrency) {
                 return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql),key,_pstmtPool,this);
             } else {
-                return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql,key._resultSetType.intValue(),key._resultSetConcurrency.intValue()),key,_pstmtPool,this);
+                if (null == key._resultSetType || null == key._resultSetConcurrency) {
+                    throw new IllegalArgumentException("Invalid prepared statement key.");
+                }
+                return new PoolablePreparedStatement(getDelegate().prepareStatement(
+                        key._sql,key._resultSetType.intValue(),key._resultSetConcurrency.intValue()),key,_pstmtPool,this);
             }
         }
     }



Mime
View raw message