From 6d844a6f5480e115965b823c7386deea376bd649 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 18 Dec 2024 12:32:12 -0800 Subject: [PATCH] Fix "`NullPointerException`: Access key ID cannot be blank" (#260) --- .../jenkins/plugins/awscredentials/AWSCredentialsImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java b/src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java index bfe5c8d..61b6481 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java @@ -167,17 +167,17 @@ public boolean requiresToken() { @Override public AwsCredentials resolveCredentials() { - AwsCredentials initialCredentials = AwsBasicCredentials.create(accessKey, secretKey.getPlainText()); if (StringUtils.isBlank(iamRoleArn)) { - return initialCredentials; + return AwsBasicCredentials.create(accessKey, secretKey.getPlainText()); } else { AwsCredentialsProvider baseProvider; // Handle the case of delegation to instance profile if (StringUtils.isBlank(accessKey) && StringUtils.isBlank(secretKey.getPlainText())) { baseProvider = null; } else { - baseProvider = StaticCredentialsProvider.create(initialCredentials); + baseProvider = StaticCredentialsProvider.create( + AwsBasicCredentials.create(accessKey, secretKey.getPlainText())); } StsClient client = buildStsClient(baseProvider);