beardt commented on code in PR #13168: URL: https://github.com/apache/kafka/pull/13168#discussion_r1107962390
########## clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java: ########## @@ -389,22 +389,27 @@ public void logUnused() { private <T> T getConfiguredInstance(Object klass, Class<T> t, Map<String, Object> configPairs) { if (klass == null) return null; + Object o = null; + try { + if (klass instanceof String) { + try { + o = Utils.newInstance((String) klass, t); + } catch (ClassNotFoundException e) { + throw new KafkaException("Class " + klass + " cannot be found", e); + } + } else if (klass instanceof Class<?>) { + o = Utils.newInstance((Class<?>) klass); + } else + throw new KafkaException("Unexpected element of type " + klass.getClass().getName() + ", expected String or Class"); + if (!t.isInstance(o)) + throw new KafkaException(klass + " is not an instance of " + t.getName()); + if (o instanceof Configurable) + ((Configurable) o).configure(configPairs); + } catch (Exception e) { + maybeClose(o, "AutoCloseable object constructed and configured during failed call to getConfiguredInstance"); + throw e; + } Review Comment: @C0urante: I removed all extra blank lines `getConfiguredInstance` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org