Peer review 11504, be careful, you need to check retValue for null to avoid NPE

refactored to use common MProduct constructor
Remove SQL code and Replace for Query
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Carlos Ruiz 2010-02-27 19:54:34 +00:00
parent 94812caebc
commit 1210dab275
1 changed files with 7 additions and 9 deletions

View File

@ -716,14 +716,12 @@ public class MProductPricing
{ {
if (m_M_Product_ID == 0) if (m_M_Product_ID == 0)
return; return;
//
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 MProduct product = MProduct.get(Env.getCtx(), m_M_Product_ID);
final String whereClause = "M_Product_ID=?"; if (product != null) {
MProduct retValue = new Query(Env.getCtx(), I_M_Product.Table_Name, whereClause, null) m_C_UOM_ID = product.getC_UOM_ID();
.setParameters(m_M_Product_ID) m_M_Product_Category_ID = product.getM_Product_Category_ID();
.first(); }
m_C_UOM_ID = retValue.getC_UOM_ID();
m_M_Product_Category_ID = retValue.getM_Product_Category_ID();
} // setBaseInfo } // setBaseInfo