Copilot commented on code in PR #13022:
URL: https://github.com/apache/cloudstack/pull/13022#discussion_r3115376375
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java:
##########
@@ -72,7 +72,15 @@ public String getRoleName() {
@Override
public void execute() {
- List<ProjectRole> projectRoles = new ArrayList<>();
+ Project project = null;
+ if (getProjectId() != null && getProjectId() > 0) {
Review Comment:
`Project` is referenced in `execute()` but there is no corresponding import
in this file (e.g., `com.cloud.projects.Project`), which will cause a
compilation failure. Add the missing import or fully-qualify the type.
##########
api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java:
##########
@@ -72,7 +72,15 @@ public String getRoleName() {
@Override
public void execute() {
- List<ProjectRole> projectRoles = new ArrayList<>();
+ Project project = null;
+ if (getProjectId() != null && getProjectId() > 0) {
+ project = _projectService.getProject(getProjectId());
+ if (project == null) {
+ throw new InvalidParameterValueException("Unable to find
project by ID.");
+ }
Review Comment:
PR description says the new behavior should return the message `Failed to
find project by ID`, but the thrown exception message here is `Unable to find
project by ID.`. Please align the error message with the intended wording (and
keep it consistent with similar project-ID validation errors).
--
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]