sijie closed pull request #1199: Provide default values for LedgerIdFormatter and EntryFormatter URL: https://github.com/apache/bookkeeper/pull/1199
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java index 526912b8c..9c90c333e 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java @@ -96,6 +96,11 @@ // Enable authentication of the other connection end point (mutual authentication) protected static final String TLS_CLIENT_AUTHENTICATION = "tlsClientAuthentication"; + // Default formatter classes + protected static final Class<? extends EntryFormatter> DEFAULT_ENTRY_FORMATTER = StringEntryFormatter.class; + protected static final Class<? extends LedgerIdFormatter> DEFAULT_LEDGERID_FORMATTER = + LedgerIdFormatter.UUIDLedgerIdFormatter.class; + /** * This list will be passed to {@link SSLEngine#setEnabledCipherSuites(java.lang.String[]) }. * Please refer to official JDK JavaDocs @@ -486,9 +491,8 @@ public void setLedgerIdFormatterClass(Class<? extends LedgerIdFormatter> formatt */ public Class<? extends LedgerIdFormatter> getLedgerIdFormatterClass() throws ConfigurationException { - return ReflectionUtils.getClass(this, LEDGERID_FORMATTER_CLASS, - null, LedgerIdFormatter.UUIDLedgerIdFormatter.class, - LedgerIdFormatter.class.getClassLoader()); + return ReflectionUtils.getClass(this, LEDGERID_FORMATTER_CLASS, DEFAULT_LEDGERID_FORMATTER, + LedgerIdFormatter.class, DEFAULT_LOADER); } /** @@ -508,9 +512,8 @@ public void setEntryFormatterClass(Class<? extends EntryFormatter> formatterClas */ public Class<? extends EntryFormatter> getEntryFormatterClass() throws ConfigurationException { - return ReflectionUtils.getClass(this, ENTRY_FORMATTER_CLASS, - null, StringEntryFormatter.class, - EntryFormatter.class.getClassLoader()); + return ReflectionUtils.getClass(this, ENTRY_FORMATTER_CLASS, DEFAULT_ENTRY_FORMATTER, EntryFormatter.class, + DEFAULT_LOADER); } /** ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services