serge 2003/01/26 17:14:16
Modified: src/java/org/apache/james/util JDBCUtil.java
Log:
Small code formatting cleanups (using Jacobe)
Revision Changes Path
1.6 +15 -14 jakarta-james/src/java/org/apache/james/util/JDBCUtil.java
Index: JDBCUtil.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/util/JDBCUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JDBCUtil.java 14 Jan 2003 13:42:02 -0000 1.5
+++ JDBCUtil.java 27 Jan 2003 01:14:16 -0000 1.6
@@ -7,6 +7,7 @@
*/
package org.apache.james.util;
+
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
@@ -14,6 +15,7 @@
import java.sql.Statement;
import java.util.Locale;
+
/**
* <p>Helper class for managing common JDBC tasks.</p>
*
@@ -23,15 +25,15 @@
*
*
*/
-abstract public class JDBCUtil
-{
+public abstract class JDBCUtil {
+
/**
* An abstract method which child classes override to handle logging of
* errors in their particular environments.
*
* @param errorString the error message generated
*/
- abstract protected void delegatedLog(String errorString);
+ protected abstract void delegatedLog(String errorString);
/**
* Checks database metadata to see if a table exists.
@@ -43,10 +45,10 @@
* @throws SQLException if an exception is encountered while accessing the
database
*/
public boolean tableExists(DatabaseMetaData dbMetaData, String tableName)
- throws SQLException {
- return ( tableExistsCaseSensitive(dbMetaData, tableName) ||
- tableExistsCaseSensitive(dbMetaData,
tableName.toUpperCase(Locale.US)) ||
- tableExistsCaseSensitive(dbMetaData,
tableName.toLowerCase(Locale.US)) );
+ throws SQLException {
+ return (tableExistsCaseSensitive(dbMetaData, tableName)
+ || tableExistsCaseSensitive(dbMetaData,
tableName.toUpperCase(Locale.US))
+ || tableExistsCaseSensitive(dbMetaData,
tableName.toLowerCase(Locale.US)));
}
/**
@@ -59,10 +61,12 @@
* @throws SQLException if an exception is encountered while accessing the
database
*/
public boolean tableExistsCaseSensitive(DatabaseMetaData dbMetaData, String
tableName)
- throws SQLException {
+ throws SQLException {
ResultSet rsTables = dbMetaData.getTables(null, null, tableName, null);
+
try {
boolean found = rsTables.next();
+
return found;
} finally {
closeJDBCResultSet(rsTables);
@@ -109,7 +113,7 @@
*
* @param aResultSet the result set to be closed
*/
- public void closeJDBCResultSet(ResultSet aResultSet ) {
+ public void closeJDBCResultSet(ResultSet aResultSet) {
try {
if (aResultSet != null) {
aResultSet.close();
@@ -128,13 +132,10 @@
* @param logString the raw string to be passed to the logging method
implemented
* by the subclass
*/
- private void subclassLogWrapper(String logString)
- {
+ private void subclassLogWrapper(String logString) {
try {
delegatedLog(logString);
- }
- catch(Throwable t) {
- // Throwables generated by the logging system are ignored
+ } catch (Throwable t) {// Throwables generated by the logging system are
ignored
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>