commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From george stewart <gstew...@us-south.net>
Subject [dbutils] patch to DbUtils
Date Tue, 11 Mar 2003 21:37:15 GMT
rethrow doesn't guard against null vals.  The method fillStatement does.

Index: DbUtils.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v
retrieving revision 1.14
diff -u -r1.14 DbUtils.java
--- DbUtils.java	10 Mar 2003 19:35:42 -0000	1.14
+++ DbUtils.java	11 Mar 2003 21:34:56 -0000
@@ -155,10 +155,12 @@
     }
     
     static void rethrow(SQLException cause, String sql,Object[] vals )throws SQLException{
-        
-        String msg = cause.getMessage() + " in query " + sql +
-        java.util.Arrays.asList(vals).toString();
-        SQLException newsqle = new SQLException(msg);
+        StringBuffer msg = 
+            new StringBuffer(cause.getMessage() + " in query " + sql);
+        if (vals != null) {
+            msg.append(java.util.Arrays.asList(vals).toString());
+        }
+        SQLException newsqle = new SQLException(msg.toString());
         newsqle.setNextException(cause);
         throw newsqle;


---------------------------------------------------------------------
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