Skip to content

Commit ff47f11

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

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,7 @@ public Long getServiceOfferingId() {
9999
//it is because details.values() cannot be cast to a map.
100100
//it gives a exception
101101
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-
}
102+
Map<String, String> customparameterMap = convertDetailsToMap(details);
113103

114104
if (shrinkOk != null) customparameterMap.put(ApiConstants.SHRINK_OK, String.valueOf(isShrinkOk()));
115105
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 & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,7 @@ public Long getServiceOfferingId() {
9595
}
9696

9797
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-
}
98+
Map<String, String> customparameterMap = convertDetailsToMap(details);
10999

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

0 commit comments

Comments
 (0)