Bugs-1874419 ] JDBC Statement not close in a finally block

Trying out with one case for review. If ok, will do the rest
This commit is contained in:
Redhuan D. Oon 2008-02-01 10:34:10 +00:00
parent 53d68602fd
commit 4f3b666ef4
1 changed files with 6 additions and 9 deletions

View File

@ -90,6 +90,7 @@ public class AArchive implements ActionListener
sql.append(" OR C_BPartner_ID=?");
sql.append(" GROUP BY IsReport");
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql.toString(), null);
@ -97,7 +98,7 @@ public class AArchive implements ActionListener
pstmt.setInt(2, m_Record_ID);
if (m_AD_Table_ID == MBPartner.Table_ID)
pstmt.setInt(3, m_Record_ID);
ResultSet rs = pstmt.executeQuery ();
rs = pstmt.executeQuery ();
while (rs.next ())
{
if ("Y".equals(rs.getString(1)))
@ -113,16 +114,12 @@ public class AArchive implements ActionListener
{
log.log(Level.SEVERE, sql.toString(), e);
}
try
finally
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
//
if (documentCount > 0)
{