fmaximus commented on a change in pull request #1554: CLOUDSTACK-9602: API: 
improve resource limits comprehension
URL: https://github.com/apache/cloudstack/pull/1554#discussion_r147157311
 
 

 ##########
 File path: 
api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
 ##########
 @@ -96,4 +117,24 @@ public void execute() {
         response.setResponseName(getCommandName());
         this.setResponseObject(response);
     }
+
+    private Resource.ResourceType getResourceTypeEnum() {
+        // Map resource type
+        Resource.ResourceType resourceTypeResult = null;
+        if (resourceTypeName != null) {
+            try {
+                resourceTypeResult = 
Resource.ResourceType.valueOf(resourceTypeName);
+            } catch (IllegalArgumentException e) {
+                throw new InvalidParameterValueException("Please specify a 
valid resource type name.");
+            }
+        } else if (resourceType != null) {
+            try {
+                resourceTypeResult = 
Resource.ResourceType.values()[resourceType];
 
 Review comment:
   The code here assumes that the ResourceType.getOrdinal() is always in the 
same order as the enum values.
   This might at one moment not be the case..
   I would prefer to search for the ResourceType returning the correct value 
when calling type.getOrdinal()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to