Clean up unused changes
This commit is contained in:
parent
921781b9f9
commit
9b342180e0
1 changed files with 4 additions and 3 deletions
|
|
@ -113,7 +113,7 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
// fallback to invoke a public no-arg constructor
|
// regardless of parameters, fallback to invoke a public no-arg constructor
|
||||||
provider = constructProvider(providerName, clazz::newInstance);
|
provider = constructProvider(providerName, clazz::newInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,6 +123,8 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode
|
||||||
Method createMethod = clazz.getDeclaredMethod("create");
|
Method createMethod = clazz.getDeclaredMethod("create");
|
||||||
if (Modifier.isStatic(createMethod.getModifiers())) {
|
if (Modifier.isStatic(createMethod.getModifiers())) {
|
||||||
provider = constructProvider(providerName, () -> clazz.cast(createMethod.invoke(null)));
|
provider = constructProvider(providerName, () -> clazz.cast(createMethod.invoke(null)));
|
||||||
|
} else {
|
||||||
|
log.warn("Found non-static create() method in {}", providerName);
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
// No create() method found for class
|
// No create() method found for class
|
||||||
|
|
@ -188,11 +190,10 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode
|
||||||
private static <T extends AwsCredentialsProvider> T constructProvider(
|
private static <T extends AwsCredentialsProvider> T constructProvider(
|
||||||
final String providerName, final CredentialsProviderConstructor<T> constructor) {
|
final String providerName, final CredentialsProviderConstructor<T> constructor) {
|
||||||
try {
|
try {
|
||||||
// Try to create an instance using the given constructor
|
|
||||||
return constructor.construct();
|
return constructor.construct();
|
||||||
} catch (NoSuchMethodException ignored) {
|
} catch (NoSuchMethodException ignored) {
|
||||||
// ignore
|
// ignore
|
||||||
} catch (IllegalAccessException | InvocationTargetException | InstantiationException | RuntimeException e) {
|
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | RuntimeException e) {
|
||||||
log.warn("Failed to construct {}", providerName, e);
|
log.warn("Failed to construct {}", providerName, e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue