From 0561959220b7459ed402619f438f7f87c923e536 Mon Sep 17 00:00:00 2001 From: Joseph Zhang Date: Wed, 30 Nov 2022 23:46:46 +0800 Subject: [PATCH] Fix NPE bug in LogSlot#entry when recording rule ID (#2980) --- .../java/com/alibaba/csp/sentinel/slots/logger/LogSlot.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/logger/LogSlot.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/logger/LogSlot.java index e70457f5e8..f521e84e57 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/logger/LogSlot.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/logger/LogSlot.java @@ -38,12 +38,11 @@ public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode fireEntry(context, resourceWrapper, obj, count, prioritized, args); } catch (BlockException e) { EagleEyeLogUtil.log(resourceWrapper.getName(), e.getClass().getSimpleName(), e.getRuleLimitApp(), - context.getOrigin(), e.getRule().getId(), count); + context.getOrigin(), e.getRule() != null ? e.getRule().getId() : null, count); throw e; } catch (Throwable e) { RecordLog.warn("Unexpected entry exception", e); } - } @Override