Skip to content

Commit 6d844a6

Browse files
authored
Fix "NullPointerException: Access key ID cannot be blank" (#260)
1 parent 6681a0e commit 6d844a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/cloudbees/jenkins/plugins/awscredentials/AWSCredentialsImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ public boolean requiresToken() {
167167

168168
@Override
169169
public AwsCredentials resolveCredentials() {
170-
AwsCredentials initialCredentials = AwsBasicCredentials.create(accessKey, secretKey.getPlainText());
171170

172171
if (StringUtils.isBlank(iamRoleArn)) {
173-
return initialCredentials;
172+
return AwsBasicCredentials.create(accessKey, secretKey.getPlainText());
174173
} else {
175174
AwsCredentialsProvider baseProvider;
176175
// Handle the case of delegation to instance profile
177176
if (StringUtils.isBlank(accessKey) && StringUtils.isBlank(secretKey.getPlainText())) {
178177
baseProvider = null;
179178
} else {
180-
baseProvider = StaticCredentialsProvider.create(initialCredentials);
179+
baseProvider = StaticCredentialsProvider.create(
180+
AwsBasicCredentials.create(accessKey, secretKey.getPlainText()));
181181
}
182182

183183
StsClient client = buildStsClient(baseProvider);

0 commit comments

Comments
 (0)