dimas-b commented on code in PR #1758: URL: https://github.com/apache/polaris/pull/1758#discussion_r2116031829
########## quarkus/service/src/test/java/org/apache/polaris/service/quarkus/config/DefaultConfigurationStoreTest.java: ########## @@ -87,8 +90,8 @@ public void before(TestInfo testInfo) { .formatted( testInfo.getTestMethod().map(java.lang.reflect.Method::getName).orElse("test"), System.nanoTime()); - RealmContext realmContext = () -> realmName; - QuarkusMock.installMockForType(realmContext, RealmContext.class); + // RealmContext realmContext = () -> realmName; Review Comment: why keep this comment? ########## service/common/src/main/java/org/apache/polaris/service/config/DefaultConfigurationStore.java: ########## @@ -51,19 +51,25 @@ public DefaultConfigurationStore( @Override public <T> @Nullable T getConfiguration(@Nonnull PolarisCallContext ctx, String configName) { - if (!realmContextInstance.isUnsatisfied()) { - RealmContext realmContext = realmContextInstance.get(); - String realm = realmContext.getRealmIdentifier(); - LOGGER.debug("Get configuration value for {} with realm {}", configName, realm); - @SuppressWarnings("unchecked") - T confgValue = - (T) - Optional.ofNullable(realmOverrides.getOrDefault(realm, Map.of()).get(configName)) - .orElseGet(() -> getDefaultConfiguration(configName)); - return confgValue; - } else { - LOGGER.debug( - "No RealmContext is injected when lookup value for configuration {} ", configName); + try { + if (realmContextInstance.isResolvable()) { + RealmContext realmContext = realmContextInstance.get(); + String realm = realmContext.getRealmIdentifier(); + LOGGER.debug("Get configuration value for {} with realm {}", configName, realm); + @SuppressWarnings("unchecked") + T confgValue = + (T) + Optional.ofNullable(realmOverrides.getOrDefault(realm, Map.of()).get(configName)) + .orElseGet(() -> getDefaultConfiguration(configName)); + return confgValue; + } else { + LOGGER.debug( + "No RealmContext is injected when lookup value for configuration {} ", configName); + return getDefaultConfiguration(configName); + } + } catch (Exception e) { + LOGGER.debug("Exception encountered when lookup value for configuration {}", configName, e); + // fall back to the default behavior return getDefaultConfiguration(configName); Review Comment: I'm not sure this is a robust impl. for `getConfiguration`... The exception can be anything. Could we make conditions and error handling more specific? -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org