[
https://issues.apache.org/jira/browse/CAMEL-24610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117283#comment-18117283
]
Andrea Cosentino commented on CAMEL-24610:
------------------------------------------
Fixed via #26066 (merged). Resolving — the merge landed but the issue was left
In Progress.
_Claude Code on behalf of Andrea Cosentino (@oscerd)_
> 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)