From 1210dab2754afc510fc64abb470177e66069f179 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 27 Feb 2010 19:54:34 +0000 Subject: [PATCH] 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 --- base/src/org/compiere/model/MProductPricing.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/base/src/org/compiere/model/MProductPricing.java b/base/src/org/compiere/model/MProductPricing.java index ce7a321b2d..163d48896b 100644 --- a/base/src/org/compiere/model/MProductPricing.java +++ b/base/src/org/compiere/model/MProductPricing.java @@ -716,15 +716,13 @@ public class MProductPricing { if (m_M_Product_ID == 0) return; - // - //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 - final String whereClause = "M_Product_ID=?"; - MProduct retValue = new Query(Env.getCtx(), I_M_Product.Table_Name, whereClause, null) - .setParameters(m_M_Product_ID) - .first(); - m_C_UOM_ID = retValue.getC_UOM_ID(); - m_M_Product_Category_ID = retValue.getM_Product_Category_ID(); - + + MProduct product = MProduct.get(Env.getCtx(), m_M_Product_ID); + if (product != null) { + m_C_UOM_ID = product.getC_UOM_ID(); + m_M_Product_Category_ID = product.getM_Product_Category_ID(); + } + } // setBaseInfo /**