Commit ec046d19 by Venkatesh Seetharam

BUG-38723 add trait to an entity which already has the trait throws a 500

parent ce61caae
......@@ -331,6 +331,9 @@ public class DefaultMetadataService implements MetadataService {
// ensure trait type is already registered with the TS
Preconditions.checkArgument(typeSystem.isRegistered(traitName),
"trait=%s should be defined in type system before it can be added", traitName);
// ensure trait is not already defined
Preconditions.checkArgument(getTraitNames(guid).contains(traitName),
"trait=%s is already defined for entity=%s", traitName, guid);
repository.addTrait(guid, traitInstance);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment