mchades commented on code in PR #12585:
URL: https://github.com/apache/gravitino/pull/12585#discussion_r4266945002
##########
core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.java:
##########
@@ -218,20 +221,43 @@ public void testConnection(
String comment,
Map<String, String> properties)
throws Exception {
- // TODO(#12566): Support event dispatching for testConnection
- dispatcher.testConnection(ident, type, provider, comment, properties);
+ // Do not put properties on the event payload - they may contain
credentials (#12566).
+ eventBus.dispatchEvent(new
TestConnectionPreEvent(PrincipalUtils.getCurrentUserName(), ident));
+ try {
+ dispatcher.testConnection(ident, type, provider, comment, properties);
+ eventBus.dispatchEvent(new
TestConnectionEvent(PrincipalUtils.getCurrentUserName(), ident));
+ } catch (Exception e) {
+ eventBus.dispatchEvent(
+ new TestConnectionFailureEvent(PrincipalUtils.getCurrentUserName(),
ident, e));
+ throw e;
+ }
Review Comment:
The three overloads now share a private helper that captures the username
once and passes their respective request context to the events. Pre-event veto
behavior and original exception propagation are preserved.
--
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]