Claus Ibsen created CAMEL-27743:
-----------------------------------

             Summary: camel-tensorflow-serving: NPE without modelName, version 
label overrides version number
                 Key: CAMEL-27743
                 URL: https://issues.apache.org/jira/browse/CAMEL-27743
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-tensorflow-serving for 
CAMEL-23832 (commit 
https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. No modelName option or header fails with a NullPointerException, even 
when the request in the body names the model
{{TensorFlowServingProducer.modelSpec()}} calls 
{{Model.ModelSpec.newBuilder().setName(modelName)}} with the value of the 
{{CamelTensorFlowServingModelName}} header or else the {{modelName}} option. 
When both are missing the value is null, and the protobuf setter throws a 
{{NullPointerException}} without a message. This happens before the request of 
the body is merged, so a {{PredictRequest}} (or any other request) whose 
{{model_spec}} names the model still fails, for every api.
Proposed change: call {{setName}} only when a name is set, so the 
{{model_spec}} of the body can name the model, and fail with a clear message 
(for example an {{IllegalArgumentException}} that names the option and the 
header) when neither the option, the header nor the body gives a model name.

h4. 2. A version label always wins over a version number, also over a version 
number from a header
{{TensorFlowServingProducer.modelSpec()}} resolves the version and the version 
label separately (header, or else option) and then calls {{setVersion}} and 
{{setVersionLabel}}. Both are in the {{version_choice}} oneof of {{ModelSpec}}, 
so the second call replaces the first: when both are set, the version number is 
dropped without a warning. With {{modelVersionLabel=stable}} on the endpoint, a 
{{CamelTensorFlowServingModelVersion}} header has no effect, so a message 
cannot pick a version number on such an endpoint.
Proposed change: let a version from a header replace a label from the options 
(and the other way round), and fail when the options, or the headers, set both 
a version and a label.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to