From 9982615c4e3ce4b141ded07adfef0e5a4efcfca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=B0=E9=9C=96?= Date: Tue, 12 Nov 2024 19:27:25 +0800 Subject: [PATCH] fix SofaRpcMetricsCollector npe --- .../sofa/rpc/metrics/prometheus/SofaRpcMetricsCollector.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metrics/metrics-prometheus/src/main/java/com/alipay/sofa/rpc/metrics/prometheus/SofaRpcMetricsCollector.java b/metrics/metrics-prometheus/src/main/java/com/alipay/sofa/rpc/metrics/prometheus/SofaRpcMetricsCollector.java index 4c872bbc6..2a5171a3d 100644 --- a/metrics/metrics-prometheus/src/main/java/com/alipay/sofa/rpc/metrics/prometheus/SofaRpcMetricsCollector.java +++ b/metrics/metrics-prometheus/src/main/java/com/alipay/sofa/rpc/metrics/prometheus/SofaRpcMetricsCollector.java @@ -200,9 +200,9 @@ public void close() throws Exception { EventBus.unRegister(ConsumerSubEvent.class, subscriber); } - private static Long getLongAvoidNull(Object object) { + private static long getLongAvoidNull(Object object) { if (object == null) { - return null; + return 0L; } if (object instanceof Integer) {