Andrea Cosentino created CAMEL-24349:
----------------------------------------
Summary: camel-google-functions: createFunction fails with an
opaque NPE when required headers are missing
Key: CAMEL-24349
URL: https://issues.apache.org/jira/browse/CAMEL-24349
Project: Camel
Issue Type: Bug
Components: camel-google-functions
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
{{createFunction}} passes header values straight into protobuf setters:
{code:java}
// GoogleCloudFunctionsProducer.java:185-193
final String entryPoint =
exchange.getIn().getHeader(GoogleCloudFunctionsConstants.ENTRY_POINT,
String.class);
final String runtime =
exchange.getIn().getHeader(GoogleCloudFunctionsConstants.RUNTIME, String.class);
final String sourceArchiveUrl =
exchange.getIn().getHeader(GoogleCloudFunctionsConstants.SOURCE_ARCHIVE_URL,
String.class);
CloudFunction function = CloudFunction.newBuilder()
.setName(...).setEntryPoint(entryPoint)
.setRuntime(runtime).setHttpsTrigger(HttpsTrigger.getDefaultInstance())
.setSourceArchiveUrl(sourceArchiveUrl).build();
{code}
Protobuf setters reject null, so a missing header produces a bare NPE instead
of a message naming the header that is required.
Also {{listFunctions}} (:96-101) sets {{setPageSize(Integer.MAX_VALUE)}} while
already iterating with {{iterateAll()}}, which handles pagination itself - the
explicit page size should be dropped or set to a value the API accepts.
Found during a source audit of the {{components/camel-google}} module family
against main @ c3b01310be15.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)