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>
This commit is contained in:
Rafael da Fonseca 2015-06-14 15:33:50 +02:00 committed by Rohit Yadav
parent a7a39a608c
commit 9c4162ac7f
2 changed files with 3 additions and 28 deletions

View File

@ -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");
}
}
}
}

View File

@ -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;
}
/////////////////////////////////////////////////////