Skip to content

Commit 6d0088b

Browse files
committed
PR7769: use convertDetailsToMap in two other APIs
1 parent 7d379fd commit 6d0088b

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

api/src/main/java/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.vm;
1818

19-
import java.util.Collection;
20-
import java.util.HashMap;
21-
import java.util.Iterator;
2219
import java.util.List;
2320
import java.util.Map;
2421

@@ -99,17 +96,7 @@ public Long getServiceOfferingId() {
9996
//it is because details.values() cannot be cast to a map.
10097
//it gives a exception
10198
public Map<String, String> getDetails() {
102-
Map<String, String> customparameterMap = new HashMap<String, String>();
103-
if (details != null && details.size() != 0) {
104-
Collection parameterCollection = details.values();
105-
Iterator iter = parameterCollection.iterator();
106-
while (iter.hasNext()) {
107-
HashMap<String, String> value = (HashMap<String, String>)iter.next();
108-
for (String key : value.keySet()) {
109-
customparameterMap.put(key, value.get(key));
110-
}
111-
}
112-
}
99+
Map<String, String> customparameterMap = convertDetailsToMap(details);
113100

114101
if (shrinkOk != null) customparameterMap.put(ApiConstants.SHRINK_OK, String.valueOf(isShrinkOk()));
115102
if (autoMigrate != null) customparameterMap.put(ApiConstants.AUTO_MIGRATE, String.valueOf(getAutoMigrate()));

api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.vm;
1818

19-
import java.util.Collection;
20-
import java.util.HashMap;
21-
import java.util.Iterator;
2219
import java.util.Map;
2320

2421
import org.apache.log4j.Logger;
@@ -95,17 +92,7 @@ public Long getServiceOfferingId() {
9592
}
9693

9794
public Map<String, String> getDetails() {
98-
Map<String, String> customparameterMap = new HashMap<String, String>();
99-
if (details != null && details.size() != 0) {
100-
Collection parameterCollection = details.values();
101-
Iterator iter = parameterCollection.iterator();
102-
while (iter.hasNext()) {
103-
HashMap<String, String> value = (HashMap<String, String>)iter.next();
104-
for (String key : value.keySet()) {
105-
customparameterMap.put(key, value.get(key));
106-
}
107-
}
108-
}
95+
Map<String, String> customparameterMap = convertDetailsToMap(details);
10996

11097
if (shrinkOk != null) customparameterMap.put(ApiConstants.SHRINK_OK, String.valueOf(isShrinkOk()));
11198
if (autoMigrate != null) customparameterMap.put(ApiConstants.AUTO_MIGRATE, String.valueOf(getAutoMigrate()));

0 commit comments

Comments
 (0)