Skip to content

Commit

Permalink
Enhanced definition validation checking the instance of the actual de…
Browse files Browse the repository at this point in the history
…finition before validating required properties (as might throw a class cast exception if the actual definition is not of type ModelImpl)
  • Loading branch information
Nestor Tarin Burriel authored and RobWin committed Apr 20, 2018
1 parent eb13a1f commit e4bf37e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void validateDefinition(String definitionName, Model actualDefinition, M
schemaObjectResolver.resolvePropertiesFromExpected(expectedDefinition),
definitionName);

if (expectedDefinition instanceof ModelImpl) {
if (expectedDefinition instanceof ModelImpl && actualDefinition instanceof ModelImpl) {
validateDefinitionRequiredProperties(((ModelImpl) actualDefinition).getRequired(),
((ModelImpl) expectedDefinition).getRequired(),
definitionName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void validateDefinition(String definitionName, Model actualDefinition, M
schemaObjectResolver.resolvePropertiesFromExpected(expectedDefinition),
definitionName);

if (expectedDefinition instanceof ModelImpl) {
if (expectedDefinition instanceof ModelImpl && actualDefinition instanceof ModelImpl) {
validateDefinitionRequiredProperties(((ModelImpl) actualDefinition).getRequired(),
((ModelImpl) expectedDefinition).getRequired(),
definitionName);
Expand Down

0 comments on commit e4bf37e

Please sign in to comment.