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

done.
This commit is contained in:
Redhuan D. Oon 2008-02-04 18:09:23 +00:00
parent f709cb5203
commit f8d99975df
1 changed files with 7 additions and 11 deletions

View File

@ -66,11 +66,12 @@ public class MClient extends X_AD_Client
{
ArrayList<MClient> list = new ArrayList<MClient>();
String sql = "SELECT * FROM AD_Client";
PreparedStatement pstmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, null);
ResultSet rs = pstmt.executeQuery ();
rs = pstmt.executeQuery ();
while (rs.next ())
{
MClient client = new MClient (ctx, rs, null);
@ -85,15 +86,10 @@ public class MClient extends X_AD_Client
{
s_log.log(Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
MClient[] retValue = new MClient[list.size ()];
list.toArray (retValue);