diff --git a/src/main/java/com/aliyun/oss/common/auth/STSAssumeRoleSessionCredentialsProvider.java b/src/main/java/com/aliyun/oss/common/auth/STSAssumeRoleSessionCredentialsProvider.java index f3b2dd37..348d59b2 100644 --- a/src/main/java/com/aliyun/oss/common/auth/STSAssumeRoleSessionCredentialsProvider.java +++ b/src/main/java/com/aliyun/oss/common/auth/STSAssumeRoleSessionCredentialsProvider.java @@ -84,7 +84,10 @@ public Credentials getCredentials() { if (credentials == null || credentials.willSoonExpire()) { synchronized (this) { if (credentials == null || credentials.willSoonExpire()) { - credentials = getNewSessionCredentials(); + BasicCredentials newCredentials = getNewSessionCredentials(); + if(newCredentials != null) { + credentials = newCredentials; + } } } }