From 69e9b152383e5386e4b1aea03e1c8486acec5226 Mon Sep 17 00:00:00 2001 From: Hayden Baker Date: Mon, 28 Aug 2023 08:22:04 -0700 Subject: [PATCH] Validate the bool params --- .../aws/crt/internal/signer/V4aProperties.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/http-auth-aws-crt/src/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/signer/V4aProperties.java b/core/http-auth-aws-crt/src/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/signer/V4aProperties.java index 6a3010a4459d..d47f16b8f323 100644 --- a/core/http-auth-aws-crt/src/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/signer/V4aProperties.java +++ b/core/http-auth-aws-crt/src/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/signer/V4aProperties.java @@ -43,8 +43,8 @@ private V4aProperties(BuilderImpl builder) { this.credentials = Validate.paramNotNull(builder.credentials, "Credentials"); this.credentialScope = Validate.paramNotNull(builder.credentialScope, "CredentialScope"); this.signingClock = Validate.paramNotNull(builder.signingClock, "SigningClock"); - this.doubleUrlEncode = builder.doubleUrlEncode; - this.normalizePath = builder.normalizePath; + this.doubleUrlEncode = Validate.getOrDefault(builder.doubleUrlEncode, () -> true); + this.normalizePath = Validate.getOrDefault(builder.normalizePath, () -> true); } public AwsCredentialsIdentity getCredentials() { @@ -78,9 +78,9 @@ public interface Builder { Builder signingClock(Clock signingClock); - Builder doubleUrlEncode(boolean doubleUrlEncode); + Builder doubleUrlEncode(Boolean doubleUrlEncode); - Builder normalizePath(boolean normalizePath); + Builder normalizePath(Boolean normalizePath); V4aProperties build(); } @@ -89,8 +89,8 @@ private static class BuilderImpl implements Builder { private AwsCredentialsIdentity credentials; private CredentialScope credentialScope; private Clock signingClock; - private boolean doubleUrlEncode; - private boolean normalizePath; + private Boolean doubleUrlEncode; + private Boolean normalizePath; @Override public Builder credentials(AwsCredentialsIdentity credentials) { @@ -111,13 +111,13 @@ public Builder signingClock(Clock signingClock) { } @Override - public Builder doubleUrlEncode(boolean doubleUrlEncode) { + public Builder doubleUrlEncode(Boolean doubleUrlEncode) { this.doubleUrlEncode = doubleUrlEncode; return this; } @Override - public Builder normalizePath(boolean normalizePath) { + public Builder normalizePath(Boolean normalizePath) { this.normalizePath = normalizePath; return this; }