BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
9e328e0500
commit
1cfcf92f6a
|
@ -220,21 +220,25 @@ public class MWindow extends X_AD_Window
|
||||||
public static int getWindow_ID(String windowName) {
|
public static int getWindow_ID(String windowName) {
|
||||||
int retValue = 0;
|
int retValue = 0;
|
||||||
String SQL = "SELECT AD_Window_ID FROM AD_Window WHERE Name = ?";
|
String SQL = "SELECT AD_Window_ID FROM AD_Window WHERE Name = ?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
pstmt = DB.prepareStatement(SQL, null);
|
||||||
pstmt.setString(1, windowName);
|
pstmt.setString(1, windowName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
retValue = rs.getInt(1);
|
retValue = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, SQL, e);
|
s_log.log(Level.SEVERE, SQL, e);
|
||||||
retValue = -1;
|
retValue = -1;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
//end vpj-cd e-evolution
|
//end vpj-cd e-evolution
|
||||||
|
|
Loading…
Reference in New Issue