You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/09/03 08:05:00 UTC
[jira] [Work started] (CAMEL-24610) camel-langchain4j-web-search: NullPointerException unboxing maxResults when a custom WebSearchRequest omits it
[ https://issues.apache.org/jira/browse/CAMEL-24610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on CAMEL-24610 started by Andrea Cosentino.
------------------------------------------------
> camel-langchain4j-web-search: NullPointerException unboxing maxResults when a custom WebSearchRequest omits it
> --------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24610
> URL: https://issues.apache.org/jira/browse/CAMEL-24610
> Project: Camel
> Issue Type: Bug
> Components: camel-langchain4j-web-search
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.23.0
>
>
> LangChain4jWebSearchProducer.process() passes webSearchRequest.maxResults() into computeResponse(..., Integer maxResults), which does if (maxResults == 1) - an auto-unbox of a nullable Integer. In the advanced path, where the user supplies a custom WebSearchRequest (getConfiguration().getWebSearchRequest() != null) that does not set maxResults, langchain4j's WebSearchRequest.maxResults() is null, so the comparison throws NullPointerException. The default builder path is safe only because the configuration maxResults defaults to 1.
> Fix: null-guard the comparison, e.g. if (maxResults != null && maxResults == 1) (treating null as the multi-result branch), or default it before comparing.
> _Reported by an automated functional audit._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)