BF [ 1874419 ] JDBC Statement not close in a finally block
This commit is contained in:
parent
bef274f45e
commit
920c5f51ea
|
@ -424,7 +424,7 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
||||||
*/
|
*/
|
||||||
public static MPrintFormatItem createFromColumn (MPrintFormat format, int AD_Column_ID, int seqNo)
|
public static MPrintFormatItem createFromColumn (MPrintFormat format, int AD_Column_ID, int seqNo)
|
||||||
{
|
{
|
||||||
MPrintFormatItem pfi = new MPrintFormatItem (format.getCtx(), 0, null);
|
MPrintFormatItem pfi = new MPrintFormatItem (format.getCtx(), 0, format.get_TrxName());
|
||||||
pfi.setAD_PrintFormat_ID (format.getAD_PrintFormat_ID());
|
pfi.setAD_PrintFormat_ID (format.getAD_PrintFormat_ID());
|
||||||
pfi.setClientOrg(format);
|
pfi.setClientOrg(format);
|
||||||
pfi.setAD_Column_ID(AD_Column_ID);
|
pfi.setAD_Column_ID(AD_Column_ID);
|
||||||
|
@ -446,13 +446,15 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
||||||
+ "WHERE c.AD_Column_ID=?"
|
+ "WHERE c.AD_Column_ID=?"
|
||||||
+ " AND c.AD_Element_ID=e.AD_Element_ID"
|
+ " AND c.AD_Element_ID=e.AD_Element_ID"
|
||||||
+ " AND e.AD_Language=?";
|
+ " AND e.AD_Language=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, format.get_TrxName());
|
||||||
pstmt.setInt(1, AD_Column_ID);
|
pstmt.setInt(1, AD_Column_ID);
|
||||||
if (trl)
|
if (trl)
|
||||||
pstmt.setString(2, language.getAD_Language());
|
pstmt.setString(2, language.getAD_Language());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
String ColumnName = rs.getString(1);
|
String ColumnName = rs.getString(1);
|
||||||
|
@ -494,13 +496,15 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|
||||||
else
|
else
|
||||||
s_log.log(Level.SEVERE, "Not Found AD_Column_ID=" + AD_Column_ID
|
s_log.log(Level.SEVERE, "Not Found AD_Column_ID=" + AD_Column_ID
|
||||||
+ " Trl=" + trl + " " + language.getAD_Language());
|
+ " Trl=" + trl + " " + language.getAD_Language());
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (!pfi.save())
|
if (!pfi.save())
|
||||||
return null;
|
return null;
|
||||||
// pfi.dump();
|
// pfi.dump();
|
||||||
|
|
Loading…
Reference in New Issue