BF [ 1874419 ] JDBC Statement not close in a finally block - fixed for FormFrame
* organized imports for FormFrame
This commit is contained in:
parent
1dc1281bb4
commit
b4414a594f
|
@ -16,17 +16,34 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.apps.form;
|
package org.compiere.apps.form;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Cursor;
|
||||||
import java.awt.event.*;
|
import java.awt.Event;
|
||||||
import java.sql.*;
|
import java.awt.event.ActionEvent;
|
||||||
import java.util.*;
|
import java.awt.event.ActionListener;
|
||||||
import java.util.logging.*;
|
import java.awt.event.KeyEvent;
|
||||||
import javax.swing.*;
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.apps.*;
|
import javax.swing.JFrame;
|
||||||
import org.compiere.model.*;
|
import javax.swing.JMenu;
|
||||||
import org.compiere.swing.*;
|
import javax.swing.JMenuBar;
|
||||||
import org.compiere.util.*;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
|
import org.compiere.apps.AEnv;
|
||||||
|
import org.compiere.apps.AGlassPane;
|
||||||
|
import org.compiere.apps.AMenu;
|
||||||
|
import org.compiere.apps.Help;
|
||||||
|
import org.compiere.apps.WindowMenu;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
|
import org.compiere.model.MUser;
|
||||||
|
import org.compiere.swing.CFrame;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Trace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form Framework
|
* Form Framework
|
||||||
|
@ -224,10 +241,11 @@ public class FormFrame extends CFrame
|
||||||
+ "FROM AD_Form f INNER JOIN AD_Form_Trl t"
|
+ "FROM AD_Form f INNER JOIN AD_Form_Trl t"
|
||||||
+ " ON (f.AD_Form_ID=t.AD_Form_ID AND AD_Language=?)"
|
+ " ON (f.AD_Form_ID=t.AD_Form_ID AND AD_Language=?)"
|
||||||
+ "WHERE f.AD_Form_ID=?";
|
+ "WHERE f.AD_Form_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
if (trl)
|
if (trl)
|
||||||
{
|
{
|
||||||
pstmt.setString(1, Env.getAD_Language(ctx));
|
pstmt.setString(1, Env.getAD_Language(ctx));
|
||||||
|
@ -235,7 +253,7 @@ public class FormFrame extends CFrame
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pstmt.setInt(1, AD_Form_ID);
|
pstmt.setInt(1, AD_Form_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
name = rs.getString(1);
|
name = rs.getString(1);
|
||||||
|
@ -243,13 +261,16 @@ public class FormFrame extends CFrame
|
||||||
className = rs.getString(3);
|
className = rs.getString(3);
|
||||||
m_Help = rs.getString(4);
|
m_Help = rs.getString(4);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (className == null)
|
if (className == null)
|
||||||
return false;
|
return false;
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue