mirror of https://github.com/grpc/grpc-java.git
context: Fix ErrorProne ClassNewInstance
http://errorprone.info/bugpattern/ClassNewInstance
This commit is contained in:
parent
21bca9a475
commit
cfb6bd0fe2
|
|
@ -128,13 +128,11 @@ public class Context {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName("io.grpc.ContextStorageOverride");
|
Class<?> clazz = Class.forName("io.grpc.ContextStorageOverride");
|
||||||
storage = (Storage) clazz.newInstance();
|
storage = (Storage) clazz.getConstructor().newInstance();
|
||||||
return storage;
|
return storage;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.log(Level.FINE, "Storage override doesn't exist. Using default.", e);
|
log.log(Level.FINE, "Storage override doesn't exist. Using default.", e);
|
||||||
} catch (InstantiationException e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Failed to initialize Storage implementation", e);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new RuntimeException("Failed to initialize Storage implementation", e);
|
throw new RuntimeException("Failed to initialize Storage implementation", e);
|
||||||
}
|
}
|
||||||
storage = new ThreadLocalContextStorage();
|
storage = new ThreadLocalContextStorage();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue