Win2k sp2, jdk1.3.1, idea #612

package pt.keysoft.ztest;


import java.sql.Connection;
import java.sql.Statement;
import java.sql.SQLException;

public class TestInspection {

        void test() throws SQLException {
                Connection connection = getConnection();
                Statement statement = null;
                try {
                        statement = connection.createStatement();
                        statement.executeUpdate("set lock mode to wait 10");
                        statement.close();
                }
                catch (SQLException ex) {
                        connection.close();
                        throw ex;
                }
                finally {
                        if (statement != null) statement.close();
                }
        }

        private Connection getConnection() {
                return null;
        }

}

Inspection erroneously suggests:

Condition statement != null (within finally block) is always true.

Also, connection.close() in the catch block isn't flagged as a possible 
NPE.

Carlos

-- 
Carlos Costa e Silva <[EMAIL PROTECTED]>


_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to