From a232820b8cbc79e3cf4ba298daf8885c811c2f55 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Sun, 14 Jun 2015 15:25:33 +0200 Subject: [PATCH 1/2] Fix findbugs ClassCastException in UpgradeSystemVMCmd.java getDetails() isn't called anywhere in the code, either way, implementation is wrong since details is a Map and not a Map> If this piece of could would get run, it would just fail trying to cast String to HashMap in line 83 --- .../command/admin/systemvm/UpgradeSystemVMCmd.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index f087077bc164..409b9b22810b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -75,18 +75,7 @@ public Long getServiceOfferingId() { } public Map getDetails() { - Map customparameterMap = new HashMap(); - if (details != null && details.size() != 0) { - Collection parameterCollection = details.values(); - Iterator iter = parameterCollection.iterator(); - while (iter.hasNext()) { - HashMap value = (HashMap)iter.next(); - for (Map.Entryentry : value.entrySet()) { - customparameterMap.put(entry.getKey(), entry.getValue()); - } - } - } - return customparameterMap; + return details; } ///////////////////////////////////////////////////// From 30d7171c3b014a87040ae4fcd02d16ade0a1d783 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Sun, 14 Jun 2015 15:59:16 +0200 Subject: [PATCH 2/2] Remove unused imports to fix checkstyle warnings --- .../api/command/admin/systemvm/UpgradeSystemVMCmd.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 409b9b22810b..4e0547ad1a0d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -16,9 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import org.apache.log4j.Logger;