rafaelweingartner commented on a change in pull request #3058: CLOUDSTACK-3049: 
update dynamic role for an account
URL: https://github.com/apache/cloudstack/pull/3058#discussion_r236738293
 
 

 ##########
 File path: server/src/main/java/com/cloud/user/AccountManagerImpl.java
 ##########
 @@ -1714,23 +1720,37 @@ public AccountVO updateAccount(UpdateAccountCmd cmd) {
         // Check if user performing the action is allowed to modify this 
account
         checkAccess(getCurrentCallingAccount(), 
_domainMgr.getDomain(account.getDomainId()));
 
-        // check if the given account name is unique in this domain for 
updating
-        Account duplicateAcccount = 
_accountDao.findActiveAccount(newAccountName, domainId);
-        if (duplicateAcccount != null && duplicateAcccount.getId() != 
account.getId()) {
-            throw new InvalidParameterValueException(
-                    "There already exists an account with the name:" + 
newAccountName + " in the domain:" + domainId + " with existing account id:" + 
duplicateAcccount.getId());
+        if(newAccountName != null) {
 
 Review comment:
   good catch. I was not paying attention to this detail. Then, I would simply 
do `newAccountName != null && StringUtils.isBlank(newAccountName)`. 
   
   That is only a suggestion. You can leave the code as is if you think it is 
better this way.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to