MProductPO:
BF [ 1874419 ] JDBC Statement not close in a finally block organized imports
This commit is contained in:
parent
8885aa8bb7
commit
c5fe2c9873
|
|
@ -16,10 +16,9 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
import java.util.logging.*;
|
import java.util.Properties;
|
||||||
import org.compiere.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product PO Model
|
* Product PO Model
|
||||||
|
|
@ -29,6 +28,9 @@ import org.compiere.util.*;
|
||||||
*/
|
*/
|
||||||
public class MProductPO extends X_M_Product_PO
|
public class MProductPO extends X_M_Product_PO
|
||||||
{
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current PO of Product
|
* Get current PO of Product
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
|
@ -38,45 +40,14 @@ public class MProductPO extends X_M_Product_PO
|
||||||
*/
|
*/
|
||||||
public static MProductPO[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
public static MProductPO[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
|
||||||
{
|
{
|
||||||
ArrayList<MProductPO> list = new ArrayList<MProductPO>();
|
final String whereClause = "M_Product_ID=? AND IsActive=?";
|
||||||
String sql = "SELECT * FROM M_Product_PO "
|
List<MProductPO> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||||
+ "WHERE M_Product_ID=? AND IsActive='Y' "
|
.setParameters(new Object[]{M_Product_ID, "Y"})
|
||||||
+ "ORDER BY IsCurrentVendor DESC";
|
.setOrderBy("IsCurrentVendor DESC")
|
||||||
PreparedStatement pstmt = null;
|
.list();
|
||||||
try
|
return list.toArray(new MProductPO[list.size()]);
|
||||||
{
|
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
|
||||||
pstmt.setInt (1, M_Product_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
|
||||||
while (rs.next ())
|
|
||||||
list.add(new MProductPO (ctx, rs, trxName));
|
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (SQLException ex)
|
|
||||||
{
|
|
||||||
s_log.log(Level.SEVERE, sql, ex);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
//
|
|
||||||
MProductPO[] retValue = new MProductPO[list.size()];
|
|
||||||
list.toArray(retValue);
|
|
||||||
return retValue;
|
|
||||||
} // getOfProduct
|
} // getOfProduct
|
||||||
|
|
||||||
|
|
||||||
/** Static Logger */
|
|
||||||
private static CLogger s_log = CLogger.getCLogger(MProductPO.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persistency Constructor
|
* Persistency Constructor
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue