Community
Participate
Working Groups
The following leak is correctly detected up-to 4.3 M1 but not with M2+ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class Bla { public static void bla(Connection c) { PreparedStatement stmt = null; try { stmt = c.prepareStatement("SELECT Bla"); // expect warning here // stmt.close(); stmt = c.prepareStatement("SELECT Bli"); stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if( stmt != null ) { try { stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } Note that this test requires a JRE 7+ to consider PreparedStatement as a resource.
I'll try to fix this regression in time for Kepler.
Regression is caused by the fix for bug 388996. Out-of-order analysis of finally before try block gets the analysis confused here, or more precisely: attempts to cope with this out-of-order analysis from bug 388996 are over eager.
I didn't find the time to fix this for Kepler.
Java 8 work had priority during 4.4, deferring to 4.5
Too much on my plate for 4.6. Bulk deferral to 4.7
Ran out of time for 4.7. Bulk move to 4.8.
bulk move out of 4.8