dgraham 2004/09/03 06:01:58 Modified: dbutils/src/java/org/apache/commons/dbutils DbUtils.java Log: Minor cleanup. Revision Changes Path 1.5 +17 -26 jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java Index: DbUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DbUtils.java 28 Feb 2004 00:12:23 -0000 1.4 +++ DbUtils.java 3 Sep 2004 13:01:58 -0000 1.5 @@ -70,24 +70,22 @@ * <code>ResultSet</code>. Avoid closing if null and hide any * SQLExceptions that occur. */ - public static void closeQuietly( - Connection conn, - Statement stmt, - ResultSet rs) { - + public static void closeQuietly(Connection conn, Statement stmt, + ResultSet rs) { + closeQuietly(rs); closeQuietly(stmt); closeQuietly(conn); } /** - * Close a <code>ResultSet</code>, avoid closing if null and hide - * any SQLExceptions that occur. + * Close a <code>ResultSet</code>, avoid closing if null and hide any + * SQLExceptions that occur. */ public static void closeQuietly(ResultSet rs) { try { close(rs); - } catch (SQLException sqle) { + } catch (SQLException e) { // quiet } } @@ -99,7 +97,7 @@ public static void closeQuietly(Statement stmt) { try { close(stmt); - } catch (SQLException sqle) { + } catch (SQLException e) { // quiet } } @@ -121,7 +119,7 @@ public static void commitAndCloseQuietly(Connection conn) { try { commitAndClose(conn); - } catch (SQLException sqle) { + } catch (SQLException e) { // quiet } } @@ -136,34 +134,27 @@ return true; } catch (ClassNotFoundException e) { - // TODO Logging? - //e.printStackTrace(); return false; } catch (IllegalAccessException e) { - // TODO Logging? - //e.printStackTrace(); - // Constructor is private, OK for DriverManager contract return true; } catch (InstantiationException e) { - // TODO Logging? - //e.printStackTrace(); return false; - } catch (Throwable t) { + } catch (Throwable e) { return false; } } - public static void printStackTrace(SQLException sqle) { - printStackTrace(sqle, new PrintWriter(System.err)); + public static void printStackTrace(SQLException e) { + printStackTrace(e, new PrintWriter(System.err)); } - public static void printStackTrace(SQLException sqle, PrintWriter pw) { + public static void printStackTrace(SQLException e, PrintWriter pw) { - SQLException next = sqle; + SQLException next = e; while (next != null) { next.printStackTrace(pw); next = next.getNextException(); @@ -173,16 +164,16 @@ } } - public static void printWarnings(Connection connection) { - printWarnings(connection, new PrintWriter(System.err)); + public static void printWarnings(Connection conn) { + printWarnings(conn, new PrintWriter(System.err)); } public static void printWarnings(Connection conn, PrintWriter pw) { if (conn != null) { try { printStackTrace(conn.getWarnings(), pw); - } catch (SQLException sqle) { - printStackTrace(sqle, pw); + } catch (SQLException e) { + printStackTrace(e, pw); } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]