You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/07/22 19:36:33 UTC

git commit: updated refs/heads/master to d042290

Updated Branches:
  refs/heads/master 18fbbcfc5 -> d0422904d


CLOUDSTACK-3711: return descriptive error message to the regular user when his resource limit has exceed. No harm in returning this info as the user aware of the resource limits/number of resources available for allocation, for his account

Conflicts:
	server/src/com/cloud/api/ApiServer.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d0422904
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d0422904
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d0422904

Branch: refs/heads/master
Commit: d0422904d741c4b533a94a46194991574cbd91ae
Parents: 18fbbcf
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jul 22 10:24:22 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jul 22 10:28:42 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java | 38 ++++++++--------------------
 1 file changed, 11 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0422904/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 57a4eaf..08af964 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -385,16 +385,13 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                     }
                 }
             }
-        }
-        catch (InvalidParameterValueException ex){
+        } catch (InvalidParameterValueException ex){
             s_logger.info(ex.getMessage());
             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage(), ex);
-        }
-        catch (IllegalArgumentException ex){
+        } catch (IllegalArgumentException ex){
             s_logger.info(ex.getMessage());
             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage(), ex);
-        }
-        catch (PermissionDeniedException ex){
+        } catch (PermissionDeniedException ex){
             ArrayList<ExceptionProxyObject> idList = ex.getIdProxyList();
             if (idList != null) {
                 StringBuffer buf = new StringBuffer();
@@ -409,31 +406,21 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 s_logger.info("PermissionDenied: " + ex.getMessage());
             }
             throw new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, ex.getMessage(), ex);
-        }
-        catch (AccountLimitException ex){
+        } catch (AccountLimitException ex){
             s_logger.info(ex.getMessage());
             throw new ServerApiException(ApiErrorCode.ACCOUNT_RESOURCE_LIMIT_ERROR, ex.getMessage(), ex);
-        }
-        catch (InsufficientCapacityException ex){
+        } catch (InsufficientCapacityException ex){
             s_logger.info(ex.getMessage());
             String errorMsg = ex.getMessage();
             if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN){
                 // hide internal details to non-admin user for security reason
                 errorMsg = BaseCmd.USER_ERROR_MESSAGE;
-
             }
             throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, errorMsg, ex);
-        }
-        catch (ResourceAllocationException ex){
+        } catch (ResourceAllocationException ex){
             s_logger.info(ex.getMessage());
-            String errorMsg = ex.getMessage();
-            if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN){
-                // hide internal details to non-admin user for security reason
-                errorMsg = BaseCmd.USER_ERROR_MESSAGE;
-            }
-            throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, errorMsg, ex);
-        }
-        catch (ResourceUnavailableException ex){
+            throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR, ex.getMessage(), ex);
+        } catch (ResourceUnavailableException ex){
             s_logger.info(ex.getMessage());
             String errorMsg = ex.getMessage();
             if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN){
@@ -441,16 +428,13 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 errorMsg = BaseCmd.USER_ERROR_MESSAGE;
             }
             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, errorMsg, ex);
-        }
-        catch (AsyncCommandQueued ex){
+        } catch (AsyncCommandQueued ex){
             s_logger.error("unhandled exception executing api command: " + ((command == null) ? "null" : command[0]), ex);
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Internal server error, unable to execute request.");
-        }
-        catch (ServerApiException ex){
+        } catch (ServerApiException ex){
             s_logger.info(ex.getDescription());
             throw ex;
-        }
-        catch (Exception ex){
+        } catch (Exception ex){
             s_logger.error("unhandled exception executing api command: " + ((command == null) ? "null" : command[0]), ex);
             String errorMsg = ex.getMessage();
             if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN){