jerryshao commented on code in PR #12585:
URL: https://github.com/apache/gravitino/pull/12585#discussion_r4345889401
##########
core/src/main/java/org/apache/gravitino/listener/CatalogEventDispatcher.java:
##########
@@ -260,4 +267,26 @@ public void disableCatalog(NameIdentifier ident) throws
NoSuchCatalogException {
throw e;
}
}
+
+ private void dispatchTestConnection(
+ NameIdentifier ident,
+ @Nullable CatalogInfo catalogInfo,
+ @Nullable CatalogChange[] changes,
+ ConnectionTestAction action)
+ throws Exception {
+ String user = PrincipalUtils.getCurrentUserName();
+ eventBus.dispatchEvent(new TestConnectionPreEvent(user, ident,
catalogInfo, changes));
Review Comment:
Pre-event veto works in `CatalogEventDispatcher`, but both test-connection
REST methods (`CatalogOperations.java:226` and `:273`) pass the thrown
`ForbiddenException` to `handleTestConnectionException`
(`ExceptionHandlers.java:245`), which has no forbidden branch and returns HTTP
500 via `Utils.internalError`. Other catalog handlers map this to
`Utils.forbidden` (403). Please handle `ForbiddenException` there and add a
REST test for both endpoints so a synchronous pre-listener veto stays a 403 and
does not run the connection test.
--
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]