fix: prevent NPE in gRPC, Dubbo and Sofa ingress parsers (#6861) - #7057
Open
juicewcode wants to merge 3 commits into
Open
juicewcode wants to merge 3 commits into
juicewcode wants to merge 3 commits into
Conversation
Guard against null ingress labels before iterating over them, and skip labels that reference a missing Kubernetes Service. Add unit tests covering existing Services, missing Services, and ingress resources without labels.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR hardens gRPC, Dubbo, and Sofa ingress parsing against missing labels and referenced Services.
Changes:
- Added null checks for ingress labels.
- Skipped missing Service references.
- Added shared null-safety tests for all three parsers.
File summaries
| File | Description |
|---|---|
| shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/parser/RpcIngressParserNullSafetyTest.java | Updated as part of this pull request. |
| shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/SofaParser.java | Updated as part of this pull request. |
| shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/GrpcParser.java | Updated as part of this pull request. |
| shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/DubboIngressParser.java | Updated as part of this pull request. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (Objects.isNull(service)) { | ||
| continue; | ||
| } | ||
| Map<String, String> metadataAnnotations = service.getMetadata().getAnnotations(); |
| if (Objects.isNull(service)) { | ||
| continue; | ||
| } | ||
| Map<String, String> metadataAnnotations = service.getMetadata().getAnnotations(); |
| if (Objects.isNull(service)) { | ||
| continue; | ||
| } | ||
| Map<String, String> metadataAnnotations = service.getMetadata().getAnnotations(); |
Aias00
approved these changes
Sep 19, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Approved as PMC (Aias00). Small, well-scoped fix with regression tests; green CI, mergeable. Reviewed the diff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6861
Summary
Test
RpcIngressParserNullSafetyTest.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.