andrew4699 commented on code in PR #437:
URL: https://github.com/apache/polaris/pull/437#discussion_r1833529577
##########
polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java:
##########
@@ -128,9 +128,18 @@ case StorageException e when
doesAnyThrowableContainInsensitive(
* @return whether any throwable in the exception chain
case-insensitive-contains the given
* message
*/
- static boolean doesAnyThrowableContainInsensitive(Exception e, String
message) {
- String messageLower = message.toLowerCase(Locale.ENGLISH);
+ static boolean doesAnyThrowableContainAccessDeniedHint(Exception e) {
return Arrays.stream(ExceptionUtils.getThrowables(e))
- .anyMatch(t ->
t.getMessage().toLowerCase(Locale.ENGLISH).contains(messageLower));
+ .anyMatch(t -> containsAnyAccessDeniedHint(t.getMessage()));
+ }
+
+ public static boolean containsAnyAccessDeniedHint(String message) {
+ String messageLower = message.toLowerCase(Locale.ENGLISH);
+ return Arrays.stream(ACCESS_DENIED_HINTS).anyMatch(messageLower::contains);
Review Comment:
Updated to a Set since semantically it is one.
##########
polaris-service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java:
##########
@@ -128,9 +128,18 @@ case StorageException e when
doesAnyThrowableContainInsensitive(
* @return whether any throwable in the exception chain
case-insensitive-contains the given
* message
*/
- static boolean doesAnyThrowableContainInsensitive(Exception e, String
message) {
- String messageLower = message.toLowerCase(Locale.ENGLISH);
+ static boolean doesAnyThrowableContainAccessDeniedHint(Exception e) {
return Arrays.stream(ExceptionUtils.getThrowables(e))
- .anyMatch(t ->
t.getMessage().toLowerCase(Locale.ENGLISH).contains(messageLower));
+ .anyMatch(t -> containsAnyAccessDeniedHint(t.getMessage()));
+ }
+
+ public static boolean containsAnyAccessDeniedHint(String message) {
+ String messageLower = message.toLowerCase(Locale.ENGLISH);
+ return Arrays.stream(ACCESS_DENIED_HINTS).anyMatch(messageLower::contains);
Review Comment:
Updated to a Set since semantically it is indeed one.
--
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]