Skip to content

Commit 039d9ba

Browse files
authored
fix: remove usage of deprecated newInstance() method (#203)
1 parent 9156fda commit 039d9ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ List<LoggingEnhancer> getEnhancers() {
9090
Class<? extends LoggingEnhancer> clz =
9191
(Class<? extends LoggingEnhancer>)
9292
ClassLoader.getSystemClassLoader().loadClass(e_name);
93-
enhancers.add(clz.newInstance());
93+
enhancers.add(clz.getDeclaredConstructor().newInstance());
9494
}
9595
}
9696
return enhancers;
@@ -122,7 +122,7 @@ private Filter getFilterProperty(String name, Filter defaultValue) {
122122
try {
123123
if (stringFilter != null) {
124124
Class clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
125-
return (Filter) clz.newInstance();
125+
return (Filter) clz.getDeclaredConstructor().newInstance();
126126
}
127127
} catch (Exception ex) {
128128
// If we cannot create the filter we fall back to default value
@@ -135,7 +135,7 @@ private Formatter getFormatterProperty(String name, Formatter defaultValue) {
135135
try {
136136
if (stringFilter != null) {
137137
Class clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
138-
return (Formatter) clz.newInstance();
138+
return (Formatter) clz.getDeclaredConstructor().newInstance();
139139
}
140140
} catch (Exception ex) {
141141
// If we cannot create the filter we fall back to default value

0 commit comments

Comments
 (0)