[ 
https://issues.apache.org/jira/browse/CAMEL-23819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-23819:
--------------------------------
    Priority: Minor  (was: Major)

> camel-milo (browse): NullPointerException in Camel Milo Browse with Siemens S7
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-23819
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23819
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-milo
>    Affects Versions: 4.20.0
>            Reporter: Robin Mattes
>            Priority: Minor
>             Fix For: 4.21.0
>
>
> Component: camel-milo (OPC UA Browse Producer)
> *Problem:*
> When browsing the OPC UA node tree of a Siemens S7 PLC, a 
> NullPointerException occurred in MiloBrowseProducer. The S7's OPC UA server 
> returns null for BrowseResult.getReferences() on certain nodes (e.g., leaf 
> nodes or nodes without child references), rather than returning an empty 
> array. The stream pipeline in the browse result processing did not account 
> for this, causing a NPE when Stream::of was called on a null reference array.
> *Root Cause:*
> The code at MiloBrowseProducer.java:114 assumed that 
> BrowseResult.getReferences() always returns a non-null array. The Siemens S7 
> OPC UA server implementation violates this assumption by returning null 
> references for nodes that have no children or for which browsing is not 
> applicable.
> *Solution:*
> A .filter(Objects::nonNull) step was added to the stream pipeline between 
> .map(BrowseResult::getReferences) and .flatMap(Stream::of). This filters out 
> any null reference arrays before they are passed to Stream::of, gracefully 
> skipping nodes without references instead of crashing.
> _Claude Code on behalf of Robin Mattes_



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

Reply via email to