Set reference = null in finally block?

Posted by deamon on Stack Overflow See other posts from Stack Overflow or by deamon
Published on 2010-06-09T08:26:05Z Indexed on 2010/06/09 8:32 UTC
Read the original article Hit count: 208

A colleague of mine sets reference to null in finally blocks. I think this is nonsense.

public Something getSomething() {
    JDBCConnection jdbc=null;
    try {
        jdbc=JDBCManager.getConnection(JDBCTypes.MYSQL);
    }
    finally {
        JDBCManager.free(jdbc);
        jdbc=null; // <-- Useful or not?
    }
}

What do you think of it?

© Stack Overflow or respective owner

Related posts about java

Related posts about exception