wy471x opened a new pull request, #7485:
URL: https://github.com/apache/shenyu/pull/7485

   ## What
   
   Part of #6609 (remaining null guard from the hardening pass).
   
   The Dubbo, gRPC and Sofa ingress parsers iterate over ingress labels and 
read the annotations of the referenced Service to build rule and metadata 
entries:
   
   ```java
   V1Service service = 
serviceLister.namespace(namespace).get(labels.get(label));
   if (Objects.isNull(service)) {
       continue;
   }
   Map<String, String> metadataAnnotations = 
service.getMetadata().getAnnotations();
   List<ConditionData> ruleConditionList = 
getRuleConditionList(metadataAnnotations); // NPE when annotations are absent
   ```
   
   A Service that exists but carries no annotations returns `null` from 
`getAnnotations()`, and every subsequent annotation lookup 
(`getRuleConditionList`, `createRuleData`, `parseMetaData`) throws 
`NullPointerException` during reconciliation.
   
   This change skips the label when the referenced Service has no annotations, 
matching the existing skip-and-defer handling for Services that are not yet in 
the cache, and adds regression coverage for all three parsers.
   
   ## Scope
   
   - #6484 (missing Dubbo endpoints) is already addressed by #7220 and is 
intentionally not duplicated here.
   - No changes to `IngressReconciler` / `EndpointsReconciler` to avoid 
overlapping with the in-flight reconciler work.
   
   ## Verification
   
   - New test 
`RpcIngressParserNullSafetyTest#shouldSkipServiceWithoutAnnotations` fails with 
the reported NPE before the fix and passes after it.
   - Full `shenyu-kubernetes-controller` suite: 142 tests, 0 failures, 0 errors.
   - Checkstyle passes.


-- 
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