Skip to content

Commit b120e19

Browse files
committed
ApiDispatcher: In case of incorrect long int value or uuid, throw error
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent cd37e22 commit b120e19

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎server/src/com/cloud/api/ApiDispatcher.java‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ private static Long translateUuidToInternalId(String uuid, Parameter annotation)
349349
try {
350350
internalId = Long.parseLong(uuid);
351351
} catch(NumberFormatException e) {
352-
// In case regex failed, and it's still uuid string
353352
internalId = null;
354353
}
355354
if (internalId != null)
@@ -381,10 +380,8 @@ private static Long translateUuidToInternalId(String uuid, Parameter annotation)
381380
if (s_logger.isDebugEnabled()) {
382381
s_logger.debug("Object entity with uuid=" + uuid + " does not exist in the database.");
383382
}
384-
if (annotation.required()) {
385-
throw new InvalidParameterValueException("Invalid parameter with uuid=" + uuid
386-
+ ". Entity not found, or an annotation bug.");
387-
}
383+
throw new InvalidParameterValueException("Invalid parameter value=" + uuid
384+
+ " due to incorrect long value, entity not found, or an annotation bug.");
388385
}
389386
return internalId;
390387
}

0 commit comments

Comments
 (0)