Skip to content

Commit 53a271b

Browse files
fix: use method overloads
1 parent 1f35491 commit 53a271b

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

src/main/java/com/amazonaws/secretsmanager/caching/SecretCache.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,7 @@ private SecretCacheItem getCachedSecret(final String secretId) {
128128
* @return The string secret
129129
*/
130130
public String getSecretString(final String secretId) {
131-
SecretCacheItem secret = this.getCachedSecret(secretId);
132-
GetSecretValueResponse gsv = secret.getSecretValue();
133-
if (null == gsv) {
134-
return null;
135-
}
136-
return gsv.secretString();
131+
return getSecretString(secretId, null, null);
137132
}
138133

139134
/**
@@ -163,12 +158,7 @@ public String getSecretString(final String secretId, final String versionId, fin
163158
* @return The binary secret
164159
*/
165160
public ByteBuffer getSecretBinary(final String secretId) {
166-
SecretCacheItem secret = this.getCachedSecret(secretId);
167-
GetSecretValueResponse gsv = secret.getSecretValue();
168-
if (null == gsv) {
169-
return null;
170-
}
171-
return gsv.secretBinary().asByteBuffer();
161+
return getSecretBinary(secretId, null, null);
172162
}
173163

174164
/**

src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheItem.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ private SecretCacheVersion getVersion(DescribeSecretResponse describeResponse, S
165165
*/
166166
@Override
167167
protected GetSecretValueResponse getSecretValue(DescribeSecretResponse describeResponse) {
168-
SecretCacheVersion version = getVersion(describeResponse, null, null);
169-
if (null == version) { return null; }
170-
return version.getSecretValue();
168+
return getSecretValue(describeResponse, null, null);
171169
}
172170

173171
/**

src/main/java/com/amazonaws/secretsmanager/caching/cache/SecretCacheObject.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,7 @@ public boolean refreshNow() throws InterruptedException {
247247
* @return The cached GetSecretValue result.
248248
*/
249249
public GetSecretValueResponse getSecretValue() {
250-
synchronized (lock) {
251-
refresh();
252-
if (null == this.data) {
253-
if (null != this.exception) { throw this.exception; }
254-
}
255-
256-
return this.getSecretValue(this.getResult());
257-
}
250+
return getSecretValue(null, null);
258251
}
259252

260253
/**

0 commit comments

Comments
 (0)