dgraham 2003/10/14 20:30:01 Modified: dbutils/src/java/org/apache/commons/dbutils DbUtils.java Log: Made default scoped methods private, simplified fillStatement logic. Revision Changes Path 1.27 +28 -23 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.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- DbUtils.java 15 Oct 2003 02:41:41 -0000 1.26 +++ DbUtils.java 15 Oct 2003 03:30:01 -0000 1.27 @@ -69,12 +69,15 @@ import java.sql.Statement; import java.sql.Types; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; public final class DbUtils { - static public java.util.Map DEFAULTS = new java.util.Hashtable(); + private static Map DEFAULTS = new HashMap(); static{ @@ -192,33 +195,35 @@ } - static void rethrow(SQLException cause, String sql,Object[] vals )throws SQLException{ - - StringBuffer msg = - new StringBuffer(cause.getMessage() + " in query " + sql); + private static void rethrow(SQLException cause, String sql, Object[] vals) + throws SQLException { + + StringBuffer msg = new StringBuffer(cause.getMessage() + " in query " + sql); if (vals != null) { - msg.append(java.util.Arrays.asList(vals).toString()); + msg.append(Arrays.asList(vals).toString()); } + SQLException newsqle = new SQLException(msg.toString()); newsqle.setNextException(cause); - throw newsqle; + throw newsqle; } - - - - - static void fillStatement(PreparedStatement stmt, Object[] vals)throws SQLException { - if (vals != null) { - int size = vals.length; - for (int i = 0; i < size; i++) { - if( vals[i] != null ){ - stmt.setObject((i + 1), vals[i]); - }else{ - stmt.setNull((i + 1), Types.OTHER); - } + + private static void fillStatement(PreparedStatement stmt, Object[] vals) + throws SQLException { + + if (vals == null) { + return; + } + + for (int i = 0; i < vals.length; i++) { + if (vals[i] != null) { + stmt.setObject((i + 1), vals[i]); + } else { + stmt.setNull((i + 1), Types.OTHER); } } + } public static int executeUpdate(Connection connection, String query,Object[] vals)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]