BF [ 2548216 ] Process Param Panel is not showing any parameter if error
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2548216&group_id=176962 ProcessModalDialog, ProcessDialog: close resultset and preparedstatement in a finally block
This commit is contained in:
parent
d1c1d8996a
commit
ef1b9a5fd7
|
@ -34,6 +34,7 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.print.ReportCtl;
|
import org.compiere.print.ReportCtl;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -231,13 +232,15 @@ public class ProcessDialog extends CFrame
|
||||||
+ "FROM AD_Process p, AD_Process_Trl t "
|
+ "FROM AD_Process p, AD_Process_Trl t "
|
||||||
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
|
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
|
||||||
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
|
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_AD_Process_ID);
|
pstmt.setInt(1, m_AD_Process_ID);
|
||||||
if (trl)
|
if (trl)
|
||||||
pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
|
pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_Name = rs.getString(1);
|
m_Name = rs.getString(1);
|
||||||
|
@ -255,14 +258,15 @@ public class ProcessDialog extends CFrame
|
||||||
if (!rs.wasNull())
|
if (!rs.wasNull())
|
||||||
m_messageText.append("<p>").append(s).append("</p>");
|
m_messageText.append("<p>").append(s).append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
throw new DBException(e, sql);
|
||||||
return false;
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Name == null) {
|
if (m_Name == null) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import javax.swing.JEditorPane;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
import org.compiere.swing.CDialog;
|
import org.compiere.swing.CDialog;
|
||||||
|
@ -233,13 +234,15 @@ public class ProcessModalDialog extends CDialog
|
||||||
+ "FROM AD_Process p, AD_Process_Trl t "
|
+ "FROM AD_Process p, AD_Process_Trl t "
|
||||||
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
|
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
|
||||||
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
|
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_AD_Process_ID);
|
pstmt.setInt(1, m_AD_Process_ID);
|
||||||
if (trl)
|
if (trl)
|
||||||
pstmt.setString(2, Env.getAD_Language(m_ctx));
|
pstmt.setString(2, Env.getAD_Language(m_ctx));
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_Name = rs.getString(1);
|
m_Name = rs.getString(1);
|
||||||
|
@ -257,14 +260,15 @@ public class ProcessModalDialog extends CDialog
|
||||||
if (!rs.wasNull())
|
if (!rs.wasNull())
|
||||||
m_messageText.append("<p>").append(s).append("</p>");
|
m_messageText.append("<p>").append(s).append("</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
throw new DBException(e, sql);
|
||||||
return false;
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Name == null)
|
if (m_Name == null)
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.logging.Level;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.grid.ed.VEditor;
|
import org.compiere.grid.ed.VEditor;
|
||||||
import org.compiere.grid.ed.VEditorFactory;
|
import org.compiere.grid.ed.VEditorFactory;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
|
@ -52,6 +53,8 @@ import org.compiere.util.Env;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
* @author Juan David Arboleda (arboleda), GlobalQSS, [ 1795398 ] Process
|
* @author Juan David Arboleda (arboleda), GlobalQSS, [ 1795398 ] Process
|
||||||
* Parameter: add display and readonly logic
|
* Parameter: add display and readonly logic
|
||||||
|
* @author Teo Sarca, www.arhipac.ro
|
||||||
|
* <li>BF [ 2548216 ] Process Param Panel is not showing any parameter if error
|
||||||
* @version 2006-12-01
|
* @version 2006-12-01
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
|
@ -225,7 +228,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe
|
||||||
}
|
}
|
||||||
catch(SQLException e)
|
catch(SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
throw new DBException(e, sql);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue