Andrea Cosentino created CAMEL-24765:
----------------------------------------

             Summary: camel-huaweicloud-functiongraph: include the region in 
the invoke URN when endpoint is set, and read the response body robustly
                 Key: CAMEL-24765
                 URL: https://issues.apache.org/jira/browse/CAMEL-24765
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


Two functional issues in camel-huaweicloud-functiongraph, found by a gap audit 
(verified against main):

* The ClientConfigurations constructor sets EITHER endpoint OR region (if 
endpoint is set, region is never copied, even when the user also set region). 
composeUrn then formats urn:fss:%s:... with a null region, producing 
urn:fss:null:<projectId>:function:... which FunctionGraph rejects. Any route 
configured with the endpoint URI param invokes with a malformed URN. Fix: 
populate region independently of the endpoint/region client-init choice so the 
URN always carries the region when it was supplied.
* FunctionGraphUtils.extractJsonFieldAsString reads the response body via 
gson.fromJson(json, JsonObject.class).getAsJsonObject("body").toString(), which 
throws ClassCastException when body is a JSON string/primitive (the normal 
shape for HTTP-triggered functions) and NPE when body is absent. Fix: fetch the 
element with get(), null-check it, and stringify it directly.

Also fixes the proxy guard that used ObjectHelper.isNotEmpty(getProxyPort()) on 
a primitive int (always true) so a proxyHost with no proxyPort configured a 
proxy on port 0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to