From 9b342180e0c6d215be74dd27fe5ebf51deb5b0de Mon Sep 17 00:00:00 2001 From: Ethan Katnic Date: Thu, 29 Aug 2024 16:13:02 -0700 Subject: [PATCH] Clean up unused changes --- .../config/AwsCredentialsProviderPropertyValueDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AwsCredentialsProviderPropertyValueDecoder.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AwsCredentialsProviderPropertyValueDecoder.java index 9a3f4599..4cdd702e 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AwsCredentialsProviderPropertyValueDecoder.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AwsCredentialsProviderPropertyValueDecoder.java @@ -113,7 +113,7 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode } 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); } @@ -123,6 +123,8 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode Method createMethod = clazz.getDeclaredMethod("create"); if (Modifier.isStatic(createMethod.getModifiers())) { provider = constructProvider(providerName, () -> clazz.cast(createMethod.invoke(null))); + } else { + log.warn("Found non-static create() method in {}", providerName); } } catch (NoSuchMethodException e) { // No create() method found for class @@ -188,11 +190,10 @@ class AwsCredentialsProviderPropertyValueDecoder implements IPropertyValueDecode private static T constructProvider( final String providerName, final CredentialsProviderConstructor constructor) { try { - // Try to create an instance using the given constructor return constructor.construct(); } catch (NoSuchMethodException ignored) { // ignore - } catch (IllegalAccessException | InvocationTargetException | InstantiationException | RuntimeException e) { + } catch (IllegalAccessException | InstantiationException | InvocationTargetException | RuntimeException e) { log.warn("Failed to construct {}", providerName, e); } return null;