Eclipse 4 では、stmt
が閉じられていない可能性があり、リソース リークが発生する可能性があるという警告が表示されます。
class Test {
public void test() {
PreparedStatement stmt = null;
try {
stmt = HibernateSession.instance().connection().prepareStatement("");
} catch (final SQLException e) {
e.printStackTrace();
} finally {
if (stmt != null)
try {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
}
}
}
}
それはどのような状況で起こりますか?