Java 使用FindBugs检测连接泄漏

Java 使用FindBugs检测连接泄漏,java,findbugs,Java,Findbugs,我试图使用FindBugs来检测连接泄漏,但在以下两种情况下它都无法检测到 情景1 情景2 我想这是因为它以前从未听说过您的jdbutil类,并且没有设置为将其视为JDBC连接的开启者。不是为了破坏这一点,但是FindBugs是否没有警告整数的装箱和拆箱? public static int getSeq(Integer id) throws FatalException { PreparedStatement pstmt = null; ResultSe

我试图使用FindBugs来检测连接泄漏,但在以下两种情况下它都无法检测到

情景1 情景2
我想这是因为它以前从未听说过您的
jdbutil
类,并且没有设置为将其视为JDBC连接的开启者。不是为了破坏这一点,但是FindBugs是否没有警告整数的装箱和拆箱?
    public static int getSeq(Integer id) throws FatalException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Connection con = null;
        int commentSeq = 0;
        try {
            con = JDBCUtil.getConnection();
            pstmt = con.prepareStatement(GET_NEXT_COMMENT_ID);
            pstmt.setInt(1, id.intValue());

            rs = pstmt.executeQuery();

            if (rs.next()) {
                commentSeq = new Integer(rs.getInt(1)).intValue();
                return commentSeq;
            }
        } catch (SQLException e) {
            logError("getNextId", e);
        } finally {
            close(rs, pstmt);
        }
        return commentSeq;
    }
public void someMethod() {
    con = JDBCUtil.getConnection();
    doSomethingWithDb(con);
    //No Closing of the connection, but findbug does not complain
}