This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 1f8b34f add entity-type to message when no UUID is found for a DB ID
(#5163)
1f8b34f is described below
commit 1f8b34f5c55086fce2185c4393baea5d8df167ce
Author: dahn <[email protected]>
AuthorDate: Wed Jul 21 13:01:08 2021 +0200
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 <[email protected]>
Co-authored-by: Suresh Kumar Anaparti <[email protected]>
---
.../src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java
b/server/src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java
index 8f3e9a1..9b6ac8a 100644
--- a/server/src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java
+++ b/server/src/main/java/com/cloud/uuididentity/UUIDManagerImpl.java
@@ -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();
-
}
-
}