Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Commit 436e55d

Browse files
leodotcloudAlena Prokharchyk
authored andcommitted
checking for null pointer
1 parent f4d4d33 commit 436e55d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

code/iaas/api-logic/src/main/java/io/cattle/platform/iaas/api/filter/secret/SecretValidationFilter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ public class SecretValidationFilter extends AbstractDefaultResourceManagerFilter
1414
@Override
1515
public Object create(String type, ApiRequest request, ResourceManager next) {
1616
Secret s = request.proxyRequestObject(Secret.class);
17-
if (!Base64.isBase64(s.getValue())) {
17+
String secretValue = s.getValue();
18+
if (secretValue == null) {
19+
throw new ValidationErrorException("EmptySecret", "value", "Secret cannot be empty");
20+
}
21+
if (!Base64.isBase64(secretValue)) {
1822
throw new ValidationErrorException("InvalidBase64", "value", "Invalid base64 content");
1923

2024
};

0 commit comments

Comments
 (0)