From f0f643dffe25977ebc7ee3ee869cf6213c73825d Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 8 Feb 2011 14:06:06 -0800 Subject: [PATCH] adding exceptions so that we can use login and logout commands via 8080 --- server/src/com/cloud/api/ApiServer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index c5b8989010c..1819990e9f9 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -345,10 +345,12 @@ public class ApiServer implements HttpRequestHandler { response = queueCommand(cmdObj, paramMap); buildAuditTrail(auditTrailSb, command[0], response); } else { - String errorString = "Unknown API command: " + ((command == null) ? "null" : command[0]); - s_logger.warn(errorString); - auditTrailSb.append(" " +errorString); - throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, errorString); + if(!command[0].equalsIgnoreCase("login") && !command[0].equalsIgnoreCase("logout")) { + String errorString = "Unknown API command: " + ((command == null) ? "null" : command[0]); + s_logger.warn(errorString); + auditTrailSb.append(" " +errorString); + throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, errorString); + } } } } catch (Exception ex) { @@ -532,7 +534,7 @@ public class ApiServer implements HttpRequestHandler { return true; }else{ //check against every available command to see if the command exists or not - if(!isCommandAvailable(commandName)){ + if(!isCommandAvailable(commandName) && !commandName.equals("login") && !commandName.equals("logout")){ s_logger.warn("The given command:"+commandName+" does not exist"); throw new InvalidParameterException("The given command:"+commandName+" does not exist"); }