Tonitzpp commented on code in PR #13022:
URL: https://github.com/apache/cloudstack/pull/13022#discussion_r3247996577


##########
server/src/main/java/org/apache/cloudstack/acl/ProjectRoleManagerImpl.java:
##########
@@ -168,9 +168,9 @@ public ProjectRole findProjectRole(Long roleId, Long 
projectId) {
 
     @Override
     public List<ProjectRole> findProjectRoles(Long projectId, String keyword) {
-        if (projectId == null || projectId < 1L || 
projectDao.findById(projectId) == null) {
-            logger.warn("Invalid project ID provided");
-            return null;
+        if (projectId == null) {

Review Comment:
   Previously, the API returned an NPE with `projectid = -1` because here it 
returns null, and in the calling method, it tries to iterate through this null 
object. Now it doesn't return the NPE because an empty list will be returned in 
`projRoleDao.findAllRoles;` since there's no need to query the database, I'll 
change it to keep the if statement the same and return an empty list directly.



-- 
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]

Reply via email to