cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [06/34] git commit: updated refs/heads/master to 7a57ce3
Date Mon, 15 Jun 2015 09:14:39 GMT
Fix 2 findbugs ClassCastExceptions getDetails() isn't called anywhere in the code, either way,
implementation is wrong since details is a Map\<String, String\> and not a Map\<String,
Map\<String,String\>\> If this piece of could would get run, it would just fail trying
to cast String to HashMap\<String,String\> Removed nonsense comment about casting a
Collection to a Map obviously giving exception

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/master
Commit: 9c4162ac7f451fc3e2155418dcfff224c8c08a4a
Parents: a7a39a6
Author: Rafael da Fonseca <rsafonseca@gmail.com>
Authored: Sun Jun 14 15:33:50 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Jun 15 12:09:18 2015 +0300

----------------------------------------------------------------------
 .../api/command/user/vm/ScaleVMCmd.java           | 18 ++----------------
 .../api/command/user/vm/UpgradeVMCmd.java         | 13 +------------
 2 files changed, 3 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9c4162ac/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 661100b..9a74fc6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -81,22 +81,8 @@ public class ScaleVMCmd extends BaseAsyncCmd {
         return serviceOfferingId;
     }
 
-    //instead of reading a map directly we are using collections.
-    //it is because details.values() cannot be cast to a map.
-    //it gives a exception
     public Map<String, String> getDetails() {
-        Map<String, String> customparameterMap = new HashMap<String, String>();
-        if (details != null && details.size() != 0) {
-            Collection parameterCollection = details.values();
-            Iterator iter = parameterCollection.iterator();
-            while (iter.hasNext()) {
-                HashMap<String, String> value = (HashMap<String, String>)iter.next();
-                for (String key : value.keySet()) {
-                    customparameterMap.put(key, value.get(key));
-                }
-            }
-        }
-        return customparameterMap;
+        return details;
     }
 
     /////////////////////////////////////////////////////
@@ -159,4 +145,4 @@ public class ScaleVMCmd extends BaseAsyncCmd {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9c4162ac/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index b105555..a64d712 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -80,18 +80,7 @@ public class UpgradeVMCmd extends BaseCmd {
     }
 
     public Map<String, String> getDetails() {
-        Map<String, String> customparameterMap = new HashMap<String, String>();
-        if (details != null && details.size() != 0) {
-            Collection parameterCollection = details.values();
-            Iterator iter = parameterCollection.iterator();
-            while (iter.hasNext()) {
-                HashMap<String, String> value = (HashMap<String, String>)iter.next();
-                for (String key : value.keySet()) {
-                    customparameterMap.put(key, value.get(key));
-                }
-            }
-        }
-        return customparameterMap;
+        return details;
     }
 
     /////////////////////////////////////////////////////


Mime
View raw message