[ https://issues.apache.org/jira/browse/CLOUDSTACK-9251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15123707#comment-15123707 ]
ASF GitHub Bot commented on CLOUDSTACK-9251: -------------------------------------------- Github user alexandrelimassantana commented on the pull request: https://github.com/apache/cloudstack/pull/1363#issuecomment-176851830 @ustcweizhou there are some modifications you could do to make this code a little more clean and readable. **1)** You are duplicating code, since two classes have the same code written. You should reallocate this method to a common superclass. **2)** You could change lines **84-86** (ScaleVMCmd.java file) from line comments to the Javadoc's pattern, which can be done much like a block comment, but with double asterisks /** Javadoc **/ ```Java /** * I am a Javadoc and this is general information about the method * @param This is a param documentation. * @return This is a method's return documentation. **/ ``` **3)** You should use **!details.isEmpty()** instead of **details.size() != 0**. It better states what you are looking for and it's performance is slightly better than the comparison you are using. **4)** It's a good practice to declare the variables as the first statements of the method, that will help when someone is reading inside conditionals, the same method written with these changes would look like: ```Java public Map<String, String> getDetails(){ Map<String, String> customparameterMap = new HashMap<String, String>(); Collection parameterCollection; Iterator iter; HashMap<String, String> value; if (details == null || details.isEmpty()) return customparameterMap; parameterCollection = details.values(); iter = parameterCollection.iterator(); while (iter.hasNext()) { value = (HashMap<String, String>)iter.next(); for (String key : value.keySet()) customparameterMap.put(key, value.get(key)); } return customparameterMap; } ``` > error while change instance offering to custom offering > ------------------------------------------------------- > > Key: CLOUDSTACK-9251 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9251 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API > Affects Versions: 4.7.0, 4.7.1 > Environment: ACS 4.7.1 - > https://dist.apache.org/repos/dist/dev/cloudstack/4.7.1/ > Reporter: Tomasz Zieba > > Changing compute offering to custom offering end with: > Step to reproduce: > 1. Create and run new instance with offering eg. 1 core / 1GB > 2. Create Custom Offering eg 2 core / 2 GB > 3. Stop the instance > 4. Try to change offering of the instance > 5. Error: Invalid cpu cores value, specify a value between 1 and 2147483647 -- This message was sent by Atlassian JIRA (v6.3.4#6332)