nikitanagar08 opened a new pull request, #10162:
URL: https://github.com/apache/gravitino/pull/10162

   ### What changes were proposed in this pull request?
   
   Add an explicit null check using `Preconditions.checkNotNull` at the start 
of `EventBus.dispatchEvent()` to prevent `NullPointerException` when 
`baseEvent` is null.
   
   ### Why are the changes needed?
   
   When `baseEvent` is null, the `else` branch in `dispatchEvent` builds an 
error message using `baseEvent.getClass().getSimpleName()`, which throws a 
`NullPointerException` instead of a clear error message.
   
   Fix: [#10129](https://github.com/apache/gravitino/issues/10129)
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestEventBus` with a unit test verifying that dispatching a null 
event throws `NullPointerException` with a clear message instead of an 
uncontrolled NPE.
   
   Signed-off-by: Nikita Nagar <[email protected]>


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