From b120e19280b994df940fd4fe6711a761eb174cad Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 17 Jan 2013 17:59:25 -0800 Subject: [PATCH] ApiDispatcher: In case of incorrect long int value or uuid, throw error Signed-off-by: Rohit Yadav --- server/src/com/cloud/api/ApiDispatcher.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 04b46e5a579..129ef7d4a2e 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -349,7 +349,6 @@ public class ApiDispatcher { try { internalId = Long.parseLong(uuid); } catch(NumberFormatException e) { - // In case regex failed, and it's still uuid string internalId = null; } if (internalId != null) @@ -381,10 +380,8 @@ public class ApiDispatcher { if (s_logger.isDebugEnabled()) { s_logger.debug("Object entity with uuid=" + uuid + " does not exist in the database."); } - if (annotation.required()) { - throw new InvalidParameterValueException("Invalid parameter with uuid=" + uuid - + ". Entity not found, or an annotation bug."); - } + throw new InvalidParameterValueException("Invalid parameter value=" + uuid + + " due to incorrect long value, entity not found, or an annotation bug."); } return internalId; }