Currently, if a entity type is not defined, the defs in
StatefulEntityType will be none, then the access to self.defs will raise
error, finally the parser will be crushed. this patch will enhance it.
JIRA: PARSER-153
Change-Id: I5db50102e9c63428298ce6c8ecbf38e3bd8e57f8
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
self.nodetype = ntype
self.properties = None
self.custom_def = custom_def
- if self.PROPERTIES in self.defs:
+ if self.defs and self.PROPERTIES in self.defs:
self.properties = self.defs[self.PROPERTIES]
self.parent_capabilities = self._get_parent_capabilities(custom_def)
elif custom_def and entitytype in list(custom_def.keys()):
self.defs = custom_def[entitytype]
else:
- self.defs = None
+ # avoid errors if self.defs = none
+ self.defs = {}
ExceptionCollector.appendException(
InvalidTypeError(what=entitytype))
self.type = entitytype