From 4d1bdf787ce8c996d64b9c32db72cdf1cf98e283 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 18 Dec 2024 12:26:01 -0800 Subject: [PATCH] Fix "`NullPointerException`: Access key ID cannot be blank" --- .../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);