Skip to content

Commit 8e73a29

Browse files
fix:fix NPE when using getConfigItem. (#77)
同意合入
1 parent 9f8f469 commit 8e73a29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dubbo-plugins/dubbo-metadatareport-polaris/src/main/java/com/tencent/polaris/dubbo/metadata/report/PolarisMetadataReport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public MetadataInfo getAppMetadata(SubscriberMetadataIdentifier identifier, Map<
153153
Optional<ServiceContractProto.ServiceContract> result = getServiceContract(request);
154154
if (!result.isPresent()) {
155155
// 降级,由兜底的 MetadataReport 进行处理
156-
return another.map(proxyReport -> proxyReport.getMetadataReport().getAppMetadata(identifier, instanceMetadata)).orElse(MetadataInfo.EMPTY);
156+
return another.map(proxyReport -> proxyReport.getMetadataReport().getAppMetadata(identifier, instanceMetadata)).orElse(null);
157157
}
158158

159159
Map<String, MetadataInfo.ServiceInfo> serviceInfos = new HashMap<>();
@@ -397,7 +397,7 @@ public void run() {
397397
// -------- 仅用于 multi-metadata-report 情况下使用
398398
@Override
399399
public ConfigItem getConfigItem(String key, String group) {
400-
return another.map(proxyReport -> proxyReport.getConfigItem(key, group)).orElse(null);
400+
return another.map(proxyReport -> proxyReport.getConfigItem(key, group)).orElse(new ConfigItem());
401401
}
402402

403403
@Override

0 commit comments

Comments
 (0)