mirror of https://github.com/apache/cloudstack.git
add entity-type to message when no UUID is found for a DB ID (#5163)
* add entity-type to message * Update server/src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java * update for review comments * syntax * Avoid NPE when entity type is null, and throw appropriate exception Co-authored-by: Daan Hoogland <dahn@onecht.net> Co-authored-by: Suresh Kumar Anaparti <suresh.anaparti@shapeblue.com>
This commit is contained in:
parent
84e52c9263
commit
1f8b34f5c5
|
|
@ -117,12 +117,16 @@ public class UUIDManagerImpl implements UUIDManager {
|
|||
if (customId == null) {
|
||||
return null;
|
||||
}
|
||||
if (entityType == null ) {
|
||||
throw new InvalidParameterValueException("Unknown entity type");
|
||||
}
|
||||
|
||||
Identity identity = (Identity) this._entityMgr.findById(entityType, customId);
|
||||
if (identity == null) {
|
||||
throw new InvalidParameterValueException("Unable to find UUID for id " + customId);
|
||||
throw new InvalidParameterValueException(String.format("Unable to find UUID for id [%s] of type [%s]",
|
||||
customId, entityType.getSimpleName()));
|
||||
|
||||
}
|
||||
return identity.getUuid();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue