Skip to content

Commit

Permalink
fix: remove usage of deprecated newInstance() method (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-qlogic committed Aug 5, 2020
1 parent 9156fda commit 039d9ba
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -90,7 +90,7 @@ List<LoggingEnhancer> getEnhancers() {
Class<? extends LoggingEnhancer> clz =
(Class<? extends LoggingEnhancer>)
ClassLoader.getSystemClassLoader().loadClass(e_name);
enhancers.add(clz.newInstance());
enhancers.add(clz.getDeclaredConstructor().newInstance());
}
}
return enhancers;
Expand Down Expand Up @@ -122,7 +122,7 @@ private Filter getFilterProperty(String name, Filter defaultValue) {
try {
if (stringFilter != null) {
Class clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
return (Filter) clz.newInstance();
return (Filter) clz.getDeclaredConstructor().newInstance();
}
} catch (Exception ex) {
// If we cannot create the filter we fall back to default value
Expand All @@ -135,7 +135,7 @@ private Formatter getFormatterProperty(String name, Formatter defaultValue) {
try {
if (stringFilter != null) {
Class clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
return (Formatter) clz.newInstance();
return (Formatter) clz.getDeclaredConstructor().newInstance();
}
} catch (Exception ex) {
// If we cannot create the filter we fall back to default value
Expand Down

0 comments on commit 039d9ba

Please sign in to comment.