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

This commit is contained in:
Redhuan D. Oon 2008-02-19 13:35:38 +00:00
parent b352e3960b
commit 78f067a5b6
1 changed files with 6 additions and 11 deletions

View File

@ -21,7 +21,7 @@ package org.adempiere.util;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.*;
import java.util.logging.Level;
import org.compiere.Adempiere;
import org.compiere.util.CLogMgt;
@ -125,31 +125,26 @@ public class GenerateModel
//
int count = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
while (rs.next())
{
new ModelInterfaceGenerator(rs.getInt(1), directory, packageName);
new ModelClassGenerator(rs.getInt(1), directory, packageName);
count++;
}
rs.close();
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
log.severe("main - " + e);
}
finally
{
try {
if (pstmt != null)
pstmt.close ();
} catch (Exception e) { /* ignored */ }
pstmt = null;
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
log.info("Generated = " + count);
}