pgoldstein    2002/08/12 11:36:53

  Modified:    src/java/org/apache/james/transport/mailets
                        JDBCListserv.java
  Log:
  An older (but still working) revision was committed in the last patch.  This
  version uses common methods in a helper class rather than redefining its
  own.
  
  Revision  Changes    Path
  1.8       +6 -58     
jakarta-james/src/java/org/apache/james/transport/mailets/JDBCListserv.java
  
  Index: JDBCListserv.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/JDBCListserv.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDBCListserv.java 12 Aug 2002 07:41:36 -0000      1.7
  +++ JDBCListserv.java 12 Aug 2002 18:36:53 -0000      1.8
  @@ -155,7 +155,7 @@
           } catch (Exception e) {
               throw new MessagingException("Error initializing JDBCListserv", e);
           } finally {
  -            closeJdbcConnection(conn);
  +            theJDBCUtil.closeJDBCConnection(conn);
           }
       }
   
  @@ -242,11 +242,11 @@
                   ResultSet localRS = rs;
                   // Clear reference to result set
                   rs = null;
  -                closeJdbcResultSet(localRS);
  +                theJDBCUtil.closeJDBCResultSet(localRS);
                   Statement localStmt = stmt;
                   // Clear reference to statement
                   stmt = null;
  -                closeJdbcStatement(localStmt);
  +                theJDBCUtil.closeJDBCStatement(localStmt);
               }
   
               stmt = conn.prepareStatement(listservQuery);
  @@ -286,65 +286,13 @@
           } catch (SQLException sqle) {
               throw new MailetException("Problem loading settings", sqle);
           } finally {
  -            closeJdbcResultSet(rs);
  -            closeJdbcStatement(stmt);
  -            closeJdbcConnection(conn);
  +            theJDBCUtil.closeJDBCResultSet(rs);
  +            theJDBCUtil.closeJDBCStatement(stmt);
  +            theJDBCUtil.closeJDBCConnection(conn);
           }
       }
   
       public String getMailetInfo() {
           return "JDBC listserv mailet";
       }
  -
  -    /**
  -     * Closes database connection and prints to the log if an error
  -     * is encountered
  -     *
  -     * @conn the connection to be closed
  -     */
  -    private void closeJdbcConnection(Connection conn) {
  -        try {
  -            if (conn != null) {
  -                conn.close();
  -            }
  -        } catch (SQLException sqle) {
  -            // Log exception and continue
  -            log("JDBCListserv : Unexpected exception while closing database 
connection.");
  -        }
  -    }
  -
  -    /**
  -     * Closes database statement and prints to the log if an error
  -     * is encountered
  -     *
  -     * @stmt the statement to be closed
  -     */
  -    private void closeJdbcStatement(Statement stmt) {
  -        try {
  -            if (stmt != null) {
  -                stmt.close();
  -            }
  -        } catch (SQLException sqle) {
  -            // Log exception and continue
  -            log("JDBCListserv : Unexpected exception while closing database 
statement.");
  -        }
  -    }
  -
  -    /**
  -     * Closes database result set and prints to the log if an error
  -     * is encountered
  -     *
  -     * @aResultSet the result set to be closed
  -     */
  -    private void closeJdbcResultSet(ResultSet aResultSet ) {
  -        try {
  -            if (aResultSet != null) {
  -                aResultSet.close();
  -            }
  -        } catch (SQLException sqle) {
  -            // Log exception and continue
  -            log("JDBCListserv : Unexpected exception while closing database result 
set.");
  -        }
  -    }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to