Copilot commented on code in PR #13065:
URL: https://github.com/apache/cloudstack/pull/13065#discussion_r3132526158
##########
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java:
##########
@@ -551,7 +550,7 @@ private Long translateUuidToInternalId(final String uuid,
final Parameter annota
}
// Return on first non-null Id for the uuid entity
if (internalId != null){
- CallContext.current().putApiResourceUuid(annotation.name(),
UUID.fromString(uuid));
+ CallContext.current().putApiResourceUuid(annotation.name(),
uuid);
CallContext.current().putContextParameter(entity, uuid);
Review Comment:
The change to store raw String UUIDs (including non-RFC UUID values) in
CallContext is not covered by unit tests. Please add/extend a
ParamProcessWorkerTest case that exercises translateUuidToInternalId with a
non-UUID resource identifier (e.g., an entity whose Identity#getUuid returns a
non-UUID string) and asserts that parameter processing completes and the value
is available via BaseCmd#getResourceUuid/CallContext#getApiResourceUuid.
```suggestion
String entityUuid = uuid;
if (objVO instanceof Identity) {
entityUuid = ((Identity)objVO).getUuid();
}
CallContext.current().putApiResourceUuid(annotation.name(),
entityUuid);
CallContext.current().putContextParameter(entity,
internalId);
```
--
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]