IDEMPIERE-2318: Handling NPE and providing meaning full error message

This commit is contained in:
Carlos Ruiz 2014-11-19 08:40:49 -05:00
parent 7c106e3dda
commit a44979a33a
1 changed files with 5 additions and 1 deletions

View File

@ -211,7 +211,7 @@ public class MMovementLine extends X_M_MovementLine
// Mandatory Instance // Mandatory Instance
MProduct product = getProduct(); MProduct product = getProduct();
if (getM_AttributeSetInstance_ID() == 0) { if (getM_AttributeSetInstance_ID() == 0) {
if(product.getAttributeSet()==null){ if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue()); log.saveError("NoAttributeSet", product.getValue());
return false; return false;
} }
@ -231,6 +231,10 @@ public class MMovementLine extends X_M_MovementLine
setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID());
} }
if (product != null && product.getAttributeSet()==null) {
log.saveError("NoAttributeSet", product.getValue());
return false;
}
if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0) if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0)
{ {
if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) { if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false /*incoming*/)) {