Closed
Description
Describe the bug
When nacos inner publish a SlowEvent
to NotifyCenter
without subscribers.
the code will throw NullPointerException because get null
from subscribe map
com.alibaba.nacos.common.notify.DefaultSharePublisher line 98
Set<Subscriber> subscribers = subMappings.get(slowEventType);
Expected behavior
If no subscriber for event, it should be ignore. At most print one warn log.
Acutally behavior
throw NullPointerException
[nacos.publisher-com.alibaba.nacos.common.notify.SlowEvent] ERROR com.alibaba.nacos.common.notify.NotifyCenter - Event listener exception : {}
java.lang.NullPointerException: null
at com.alibaba.nacos.common.notify.DefaultSharePublisher.receiveEvent(DefaultSharePublisher.java:101)
at com.alibaba.nacos.common.notify.DefaultPublisher.openEventHandler(DefaultPublisher.java:117)
at com.alibaba.nacos.common.notify.DefaultPublisher.run(DefaultPublisher.java:94)
How to Reproduce
Steps to reproduce the behavior:
NotifyCenter.publishEvent
any slowEvent without subscriber- See error log
Desktop (please complete the following information):
- OS: Any
- Version: nacos-client 1.3.2
- Module Any
- SDK original
Additional context
Add any other context about the problem here.