Aias00 opened a new issue, #6860:
URL: https://github.com/apache/shenyu/issues/6860

   ## Description
   Line 335: the null guard `Objects.nonNull(path) && 
Objects.nonNull(path.getBackend().getService())` calls 
`path.getBackend().getService()` without first checking `path.getBackend()` for 
null — if `getBackend()` is null, the guard itself NPEs. Line 339: 
`annotations.get(IngressConstants.UPSTREAMS_PROTOCOL_ANNOTATION_KEY).split(",")`
 — (a) `annotations` is passed from `ingress.getMetadata().getAnnotations()` 
which can be null (ingress with no annotations); (b) even if non-null, `.get()` 
returns null when the annotation is absent, and `.split(",")` on null NPEs. 
Contrast with `DivideIngressParser` (line 306) which null-guards both 
`annotations` and the key before splitting.
   
   ## Location
   - 
`shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/DubboIngressParser.java:335,339`
   
   ## Impact
   A Dubbo ingress without the `upstreams-protocol` annotation (the common 
case) NPEs during reconcile, preventing Dubbo routing from being configured.
   
   ## Suggested fix
   Fix the guard to `Objects.nonNull(path) && 
Objects.nonNull(path.getBackend()) && 
Objects.nonNull(path.getBackend().getService())`. Guard line 339 with `if 
(Objects.nonNull(annotations) && annotations.containsKey(KEY))` before 
splitting, defaulting to `null` protocol (as `DivideIngressParser` does).
   
   ## Related existing
   None — distinct from #6598 and GOV-T6 (#6679).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to