BF [ 1874419 ] JDBC Statement not close in a finally block
done.
This commit is contained in:
parent
f709cb5203
commit
f8d99975df
|
@ -66,11 +66,12 @@ public class MClient extends X_AD_Client
|
||||||
{
|
{
|
||||||
ArrayList<MClient> list = new ArrayList<MClient>();
|
ArrayList<MClient> list = new ArrayList<MClient>();
|
||||||
String sql = "SELECT * FROM AD_Client";
|
String sql = "SELECT * FROM AD_Client";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MClient client = new MClient (ctx, rs, null);
|
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);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
MClient[] retValue = new MClient[list.size ()];
|
MClient[] retValue = new MClient[list.size ()];
|
||||||
list.toArray (retValue);
|
list.toArray (retValue);
|
||||||
|
|
Loading…
Reference in New Issue