BF [ 1874419 ] JDBC Statement not close in a finally block

This commit is contained in:
Heng Sin Low 2008-02-14 23:05:06 +00:00
parent 9e328e0500
commit 1cfcf92f6a
1 changed files with 8 additions and 4 deletions

View File

@ -220,21 +220,25 @@ public class MWindow extends X_AD_Window
public static int getWindow_ID(String windowName) {
int retValue = 0;
String SQL = "SELECT AD_Window_ID FROM AD_Window WHERE Name = ?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt = DB.prepareStatement(SQL, null);
pstmt.setString(1, windowName);
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
s_log.log(Level.SEVERE, SQL, e);
retValue = -1;
}
finally
{
DB.close(rs, pstmt);
}
return retValue;
}
//end vpj-cd e-evolution