Skip to content

Commit c1204cd

Browse files
fix: use method overloads
1 parent 8a60af2 commit c1204cd

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
@@ -253,14 +253,7 @@ public boolean refreshNow() throws InterruptedException {
253253
* @return The cached GetSecretValue result.
254254
*/
255255
public GetSecretValueResponse getSecretValue() {
256-
synchronized (lock) {
257-
refresh();
258-
if (null == this.data) {
259-
if (null != this.exception) { throw this.exception; }
260-
}
261-
262-
return this.getSecretValue(this.getResult());
263-
}
256+
return getSecretValue(null, null);
264257
}
265258

266259
/**

0 commit comments

Comments
 (0)