added null check for Parent_ID element.

This commit is contained in:
Heng Sin Low 2010-12-24 11:55:02 +08:00
parent 7d4f9afb08
commit cc04468c7d
1 changed files with 11 additions and 9 deletions

View File

@ -106,11 +106,13 @@ public class MenuElementHandler extends AbstractElementHandler {
Element parentElement = element.properties.get("Parent_ID"); Element parentElement = element.properties.get("Parent_ID");
int parentId = 0; int parentId = 0;
if (ReferenceUtils.isIDLookup(parentElement) || ReferenceUtils.isUUIDLookup(parentElement)) { if (parentElement != null) {
parentId = ReferenceUtils.resolveReference(ctx, parentElement); if (ReferenceUtils.isIDLookup(parentElement) || ReferenceUtils.isUUIDLookup(parentElement)) {
} else { parentId = ReferenceUtils.resolveReference(ctx, parentElement);
String parent = getStringValue(element, "Parent_ID"); } else {
parentId = findIdByName(ctx, "AD_Menu", parent); String parent = getStringValue(element, "Parent_ID");
parentId = findIdByName(ctx, "AD_Menu", parent);
}
} }
StringBuffer updateSQL = null; StringBuffer updateSQL = null;