Copilot commented on code in PR #11761:
URL: https://github.com/apache/cloudstack/pull/11761#discussion_r2393691588
##########
server/src/main/java/com/cloud/user/AccountManagerImpl.java:
##########
@@ -1398,6 +1398,9 @@ public Pair<Long, Account>
doInTransaction(TransactionStatus status) {
- New role should not be of type Admin with domain other than ROOT domain
*/
protected void validateRoleChange(Account account, Role role, Account
caller) {
+ if (account.getRoleId() == role.getId()) {
Review Comment:
Use equals() method instead of == for comparing Long objects. The current
comparison may fail if the Long objects are not the same instance, even when
they represent the same value.
```suggestion
if (account.getRoleId() != null &&
account.getRoleId().equals(role.getId())) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]