From e80a18d14f4af628a1dfab3414ffaccbd4c3cd94 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Sat, 14 Oct 2023 22:55:34 +0530 Subject: [PATCH 01/15] bmc-addons | Use correct assertion in tests --- .../java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java | 4 +--- .../java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bmc-addons/bmc-graalvm-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java b/bmc-addons/bmc-graalvm-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java index a6c73418da4..a7b5ce50cd6 100644 --- a/bmc-addons/bmc-graalvm-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java +++ b/bmc-addons/bmc-graalvm-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java @@ -220,9 +220,7 @@ protected CreateBucketResponse createBucketAndVerifyResponse( assertTrue( StringUtils.isNotBlank(bucketFromResponse.getEtag()), "Etag should not be blank"); assertTrue(bucketFromResponse.getFreeformTags().isEmpty(), "FreeformTags should be empty"); - assertTrue( - initialMetadata.equals(bucketFromResponse.getMetadata()), - "Metadata should be equal"); + assertEquals(initialMetadata, bucketFromResponse.getMetadata(), "Metadata should be equal"); assertEquals(namespace, bucketFromResponse.getNamespace(), "Namespace should be equal"); assertEquals( Bucket.PublicAccessType.valueOf(pat.name()), diff --git a/bmc-addons/bmc-graalvm-jersey3-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java b/bmc-addons/bmc-graalvm-jersey3-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java index a6c73418da4..a7b5ce50cd6 100644 --- a/bmc-addons/bmc-graalvm-jersey3-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java +++ b/bmc-addons/bmc-graalvm-jersey3-addon/src/test/java/com/oracle/bmc/graalvm/BaseObjectStorageTest.java @@ -220,9 +220,7 @@ protected CreateBucketResponse createBucketAndVerifyResponse( assertTrue( StringUtils.isNotBlank(bucketFromResponse.getEtag()), "Etag should not be blank"); assertTrue(bucketFromResponse.getFreeformTags().isEmpty(), "FreeformTags should be empty"); - assertTrue( - initialMetadata.equals(bucketFromResponse.getMetadata()), - "Metadata should be equal"); + assertEquals(initialMetadata, bucketFromResponse.getMetadata(), "Metadata should be equal"); assertEquals(namespace, bucketFromResponse.getNamespace(), "Namespace should be equal"); assertEquals( Bucket.PublicAccessType.valueOf(pat.name()), From c361e3bbf1aa1cfa744f17cc70f08fb2e587df7f Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Sat, 14 Oct 2023 23:01:35 +0530 Subject: [PATCH 02/15] bmc-addons | Remove unused imports --- .../internal/OkeResourcePrincipalSessionToken.java | 4 ---- .../com/oracle/bmc/auth/sasl/OciAuthProviderCallback.java | 4 ---- 2 files changed, 8 deletions(-) diff --git a/bmc-addons/bmc-oke-workload-identity/src/main/java/com/oracle/bmc/auth/okeworkloadidentity/internal/OkeResourcePrincipalSessionToken.java b/bmc-addons/bmc-oke-workload-identity/src/main/java/com/oracle/bmc/auth/okeworkloadidentity/internal/OkeResourcePrincipalSessionToken.java index c8c1465816e..69e7a9e6ebc 100644 --- a/bmc-addons/bmc-oke-workload-identity/src/main/java/com/oracle/bmc/auth/okeworkloadidentity/internal/OkeResourcePrincipalSessionToken.java +++ b/bmc-addons/bmc-oke-workload-identity/src/main/java/com/oracle/bmc/auth/okeworkloadidentity/internal/OkeResourcePrincipalSessionToken.java @@ -5,10 +5,6 @@ package com.oracle.bmc.auth.okeworkloadidentity.internal; import com.fasterxml.jackson.annotation.JsonProperty; -import com.oracle.bmc.responses.BmcResponse; - -import java.util.List; -import java.util.Map; public class OkeResourcePrincipalSessionToken { @JsonProperty("token") diff --git a/bmc-addons/bmc-sasl/src/main/java/com/oracle/bmc/auth/sasl/OciAuthProviderCallback.java b/bmc-addons/bmc-sasl/src/main/java/com/oracle/bmc/auth/sasl/OciAuthProviderCallback.java index 26c26f38d37..6edffcd7dea 100644 --- a/bmc-addons/bmc-sasl/src/main/java/com/oracle/bmc/auth/sasl/OciAuthProviderCallback.java +++ b/bmc-addons/bmc-sasl/src/main/java/com/oracle/bmc/auth/sasl/OciAuthProviderCallback.java @@ -5,12 +5,8 @@ package com.oracle.bmc.auth.sasl; import com.oracle.bmc.auth.BasicAuthenticationDetailsProvider; -import java.io.IOException; -import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.UnsupportedCallbackException; /** * Callback to handle in the SASL callback handler used when creating a {@link From 40c6ac52b256effa6677243d902d4af89ef3a753 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:26:30 +0530 Subject: [PATCH 03/15] bmc-common | Remove unused imports --- .../auth/AbstractRequestingAuthenticationDetailsProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractRequestingAuthenticationDetailsProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractRequestingAuthenticationDetailsProvider.java index a66c7588a52..b298f8725f6 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractRequestingAuthenticationDetailsProvider.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractRequestingAuthenticationDetailsProvider.java @@ -13,7 +13,6 @@ import java.io.InputStream; import java.security.KeyPair; import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; import java.util.ArrayList; import java.util.List; import java.util.Set; From 2794d3e8e8caf08afad13de0fec09cfcbd6d75d2 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:26:45 +0530 Subject: [PATCH 04/15] bmc-common | Remove unused imports --- .../src/main/java/com/oracle/bmc/http/internal/BaseClient.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/internal/BaseClient.java b/bmc-common/src/main/java/com/oracle/bmc/http/internal/BaseClient.java index b0860522924..94dc06c8be0 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/http/internal/BaseClient.java +++ b/bmc-common/src/main/java/com/oracle/bmc/http/internal/BaseClient.java @@ -30,11 +30,10 @@ import com.oracle.bmc.internal.EndpointBuilder; import com.oracle.bmc.requests.BmcRequest; import com.oracle.bmc.responses.BmcResponse; -import com.oracle.bmc.util.internal.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.URI; + import java.time.Duration; import java.util.ArrayList; import java.util.EnumMap; From 35292e5687d8d6c56367fe5aa382e8ca8118854b Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:27:00 +0530 Subject: [PATCH 05/15] bmc-common | Remove unused imports --- .../bmc/auth/DefaultServiceAccountTokenProvider.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/DefaultServiceAccountTokenProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/DefaultServiceAccountTokenProvider.java index 9112b181173..4ea0952050e 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/DefaultServiceAccountTokenProvider.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/DefaultServiceAccountTokenProvider.java @@ -4,16 +4,9 @@ */ package com.oracle.bmc.auth; -import com.oracle.bmc.auth.internal.JwtClaimsSet; -import org.slf4j.Logger; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.text.ParseException; -import java.time.Duration; -import java.time.Instant; -import java.util.Date; /** * Implementation of {@link ServiceAccountTokenSupplier} that allows to pass in a token path to read From 438abdf9510d397559bdbaee3b625c18a93391a3 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:27:08 +0530 Subject: [PATCH 06/15] bmc-common | Remove unused imports --- .../internal/FileBasedResourcePrincipalFederationClient.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/FileBasedResourcePrincipalFederationClient.java b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/FileBasedResourcePrincipalFederationClient.java index 5a60a463de0..5510dd1eee3 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/FileBasedResourcePrincipalFederationClient.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/FileBasedResourcePrincipalFederationClient.java @@ -12,9 +12,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.security.KeyPair; import java.time.Duration; import java.util.Optional; From 4db7c73775fdb25eba4a20733ed6246d58df4441 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:27:24 +0530 Subject: [PATCH 07/15] bmc-common | Remove unused imports --- .../auth/internal/GetResourcePrincipalSessionTokenRequest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/GetResourcePrincipalSessionTokenRequest.java b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/GetResourcePrincipalSessionTokenRequest.java index 746a827aacd..b1d2535690e 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/GetResourcePrincipalSessionTokenRequest.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/GetResourcePrincipalSessionTokenRequest.java @@ -5,7 +5,6 @@ package com.oracle.bmc.auth.internal; import com.fasterxml.jackson.annotation.JsonInclude; -import com.oracle.bmc.requests.BmcRequest; /** Class is immutable. @Immutable */ @JsonInclude(JsonInclude.Include.NON_NULL) From d61523ca0e877478fe80d7a089e2991718be371b Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:27:48 +0530 Subject: [PATCH 08/15] bmc-common | Remove unused imports --- .../src/main/java/com/oracle/bmc/model/RegionAlloySchema.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/model/RegionAlloySchema.java b/bmc-common/src/main/java/com/oracle/bmc/model/RegionAlloySchema.java index bed7b46aba6..8985c2c266e 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/model/RegionAlloySchema.java +++ b/bmc-common/src/main/java/com/oracle/bmc/model/RegionAlloySchema.java @@ -6,7 +6,6 @@ import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.Set; public class RegionAlloySchema { From fa5dcb996158105ab1f8abd5f393522f26f56f03 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:27:56 +0530 Subject: [PATCH 09/15] bmc-common | Remove unused imports --- .../bmc/auth/SuppliedServiceAccountTokenProvider.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/SuppliedServiceAccountTokenProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/SuppliedServiceAccountTokenProvider.java index 838fb498cd9..0c6f8b4651b 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/SuppliedServiceAccountTokenProvider.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/SuppliedServiceAccountTokenProvider.java @@ -4,12 +4,6 @@ */ package com.oracle.bmc.auth; -import com.oracle.bmc.auth.internal.JwtClaimsSet; - -import java.text.ParseException; -import java.time.Instant; -import java.util.Date; - /** * Implementation of {@link ServiceAccountTokenSupplier} that allows to pass in a token to be used * as a kubernetes service account token. From 1bb35dc4c431fb074cab7869ed4635c7a378d4f3 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:28:07 +0530 Subject: [PATCH 10/15] bmc-common | Remove unused imports --- .../com/oracle/bmc/auth/URLBasedX509CertificateSupplier.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/URLBasedX509CertificateSupplier.java b/bmc-common/src/main/java/com/oracle/bmc/auth/URLBasedX509CertificateSupplier.java index c88b26fd45b..b83d589d4ad 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/URLBasedX509CertificateSupplier.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/URLBasedX509CertificateSupplier.java @@ -4,11 +4,10 @@ */ package com.oracle.bmc.auth; -import java.io.BufferedReader; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.nio.charset.StandardCharsets; @@ -20,7 +19,6 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; import jakarta.annotation.Nonnull; import javax.security.auth.Refreshable; From b0cf1a8a91445d531755b6d883e34270726b24ce Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:28:47 +0530 Subject: [PATCH 11/15] bmc-common | fix documentation link --- .../main/java/com/oracle/bmc/retrier/DefaultRetryCondition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/retrier/DefaultRetryCondition.java b/bmc-common/src/main/java/com/oracle/bmc/retrier/DefaultRetryCondition.java index 25660380096..28085127fd4 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/retrier/DefaultRetryCondition.java +++ b/bmc-common/src/main/java/com/oracle/bmc/retrier/DefaultRetryCondition.java @@ -17,7 +17,7 @@ /** * Class that represents the conditions documented in - * https://docs.cloud.oracle.com/iaas/Content/API/References/apierrors.htm for which the operation + * ... for which the operation * may be retried. */ public class DefaultRetryCondition implements RetryCondition { From a3cf764cb352f9217b318f86c07920d609f2ae72 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 10:30:06 +0530 Subject: [PATCH 12/15] bmc-common | Refactor to use lambda and method reference --- ...lientAuthenticationDetailsProviderBuilder.java | 2 +- .../internal/ConfigFileDelegationTokenUtils.java | 2 +- .../bmc/auth/internal/X509FederationClient.java | 15 +++++---------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractFederationClientAuthenticationDetailsProviderBuilder.java b/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractFederationClientAuthenticationDetailsProviderBuilder.java index b3979a7d799..62af3459102 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractFederationClientAuthenticationDetailsProviderBuilder.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/AbstractFederationClientAuthenticationDetailsProviderBuilder.java @@ -265,7 +265,7 @@ protected String autoDetectEndpointUsingMetadataUrl() { if (federationEndpoint == null) { executeInstanceFallback(); - String regionStr = fetchRegion(resp -> resp.textBody()); + String regionStr = fetchRegion(HttpResponse::textBody); LOG.info("Looking up region for {}", regionStr); try { diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/ConfigFileDelegationTokenUtils.java b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/ConfigFileDelegationTokenUtils.java index 223fbcd03e9..9c3a22e9c02 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/ConfigFileDelegationTokenUtils.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/ConfigFileDelegationTokenUtils.java @@ -49,7 +49,7 @@ public static String parseAndGetToken(ConfigFileReader.ConfigFile effectiveConfi Files.lines( Paths.get(FileUtils.expandUserHome(delegationTokenFilePath)), StandardCharsets.UTF_8)) { - stream.forEach(s -> tokenBuilder.append(s)); + stream.forEach(tokenBuilder::append); } catch (IOException e) { LOG.warn("Exception in reading or parsing delegation token file", e); } diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/X509FederationClient.java b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/X509FederationClient.java index 4fefa5d0395..1f2c694ffea 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/X509FederationClient.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/X509FederationClient.java @@ -172,16 +172,11 @@ public Optional supplyKey(@Nonnull String keyId) { }; Supplier keyIdSupplier = - new Supplier() { - @Override - public String get() { - return keyIdForX509Request( - tenancyId, - leafCertificateSupplier - .getCertificateAndKeyPair() - .getCertificate()); - } - }; + () -> keyIdForX509Request( + tenancyId, + leafCertificateSupplier + .getCertificateAndKeyPair() + .getCertificate()); this.httpClient = HttpProvider.getDefault() From 1e64797a4dce5ef434092e557175b2fcebbec0b7 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 12:16:54 +0530 Subject: [PATCH 13/15] bmc-common | Refactor to use lambda and method reference --- .../src/main/java/com/oracle/bmc/Region.java | 2 +- .../internal/DefaultRequestSignerFactory.java | 29 +++++-------------- .../oracle/bmc/waiter/WaiterScheduler.java | 9 ++---- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/Region.java b/bmc-common/src/main/java/com/oracle/bmc/Region.java index 41c5fff846e..abce1778856 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/Region.java +++ b/bmc-common/src/main/java/com/oracle/bmc/Region.java @@ -814,7 +814,7 @@ private static void readAlloyRegionConfigFile() { try { OCI_SDK_ENABLED_SERVICES_SET.addAll( regionAlloySchema.getServices().stream() - .map(str -> str.toLowerCase()) + .map(String::toLowerCase) .map(str -> str.replaceAll("[^a-z]", "")) .collect(Collectors.toSet())); } finally { diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/DefaultRequestSignerFactory.java b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/DefaultRequestSignerFactory.java index 04675e925b6..5a09eb1909a 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/DefaultRequestSignerFactory.java +++ b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/DefaultRequestSignerFactory.java @@ -22,7 +22,7 @@ /** * Factory class to create RequestSigner instances. Takes care of setting up the appropriate - * suppliers based on the cacheability of the credentials (indicated by {@link AuthCachingPolicy}. + * suppliers based on the cacheability of the credentials (indicated by {@link AuthCachingPolicy}). * By default, all credentials are cacheable. * *

This factory supports authentication providers that inherit from {@link @@ -65,22 +65,12 @@ protected Supplier createKeyIdSupplier( // if keyId caching is disabled, fetch the ID on every request if (!cacheKeyId) { - return new Supplier() { - @Override - public String get() { - return authenticationDetailsProvider.getKeyId(); - } - }; + return authenticationDetailsProvider::getKeyId; } // else fetch it now and return a fixed supplier final String keyId = authenticationDetailsProvider.getKeyId(); - return new Supplier() { - @Override - public String get() { - return keyId; - } - }; + return () -> keyId; } public static KeySupplier createKeySupplier( @@ -93,15 +83,10 @@ public static KeySupplier createKeySupplier( // if private key caching is disabled, parse the stream on every request if (!cachePrivateKey) { - return new KeySupplier() { - @Override - public Optional supplyKey(String keyId) { - return new PEMFileRSAPrivateKeySupplier( - authenticationDetailsProvider.getPrivateKey(), - authenticationDetailsProvider.getPassphraseCharacters()) - .supplyKey(keyId); - } - }; + return keyId -> new PEMFileRSAPrivateKeySupplier( + authenticationDetailsProvider.getPrivateKey(), + authenticationDetailsProvider.getPassphraseCharacters()) + .supplyKey(keyId); } // else parse once now and return a fixed supplier diff --git a/bmc-common/src/main/java/com/oracle/bmc/waiter/WaiterScheduler.java b/bmc-common/src/main/java/com/oracle/bmc/waiter/WaiterScheduler.java index 5af91219bae..c04619f4dd1 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/waiter/WaiterScheduler.java +++ b/bmc-common/src/main/java/com/oracle/bmc/waiter/WaiterScheduler.java @@ -21,12 +21,9 @@ public interface WaiterScheduler { * positive. */ WaiterScheduler UNSUPPORTED = - new WaiterScheduler() { - @Override - public Future schedule(Runnable command, long time, TimeUnit unit) { - throw new UnsupportedOperationException( - "Delays not supported for async waiter (no scheduler given)"); - } + (command, time, unit) -> { + throw new UnsupportedOperationException( + "Delays not supported for async waiter (no scheduler given)"); }; /** * Scheduler implementation that blocks in the {@link #schedule} method for the given time to From c3fbb2fe029e8c7a3e7e21c81849490aafc9a6a8 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 12:17:32 +0530 Subject: [PATCH 14/15] bmc-common | Remove unused and duplicate imports --- bmc-common/src/main/java/com/oracle/bmc/ConfigFileReader.java | 2 -- bmc-common/src/main/java/com/oracle/bmc/util/StreamUtils.java | 1 - .../com/oracle/bmc/util/internal/RefreshAuthTokenWrapper.java | 4 ---- 3 files changed, 7 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/ConfigFileReader.java b/bmc-common/src/main/java/com/oracle/bmc/ConfigFileReader.java index cd8db388309..703b14c05d0 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/ConfigFileReader.java +++ b/bmc-common/src/main/java/com/oracle/bmc/ConfigFileReader.java @@ -19,8 +19,6 @@ import java.util.HashMap; import java.util.Map; -import jakarta.annotation.Nonnull; -import jakarta.annotation.Nullable; import com.oracle.bmc.util.internal.StringUtils; import static com.oracle.bmc.util.internal.FileUtils.expandUserHome; diff --git a/bmc-common/src/main/java/com/oracle/bmc/util/StreamUtils.java b/bmc-common/src/main/java/com/oracle/bmc/util/StreamUtils.java index d4494d8ee51..8a4c91d296e 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/util/StreamUtils.java +++ b/bmc-common/src/main/java/com/oracle/bmc/util/StreamUtils.java @@ -5,7 +5,6 @@ package com.oracle.bmc.util; import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; import java.io.BufferedReader; import com.oracle.bmc.io.internal.WrappedByteArrayInputStream; import com.oracle.bmc.io.internal.WrappedFileInputStream; diff --git a/bmc-common/src/main/java/com/oracle/bmc/util/internal/RefreshAuthTokenWrapper.java b/bmc-common/src/main/java/com/oracle/bmc/util/internal/RefreshAuthTokenWrapper.java index 1ffee8b494d..5fabda0d082 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/util/internal/RefreshAuthTokenWrapper.java +++ b/bmc-common/src/main/java/com/oracle/bmc/util/internal/RefreshAuthTokenWrapper.java @@ -17,10 +17,6 @@ import java.util.concurrent.TimeoutException; import java.util.function.Function; -import com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider; -import com.oracle.bmc.model.BmcException; -import com.oracle.bmc.requests.BmcRequest; -import com.oracle.bmc.responses.AsyncHandler; /** * Combined future and callbacks for asynchronous requests intended to work with some authenticated From e033e77d8b5b5ddf04ccf0e3f9105e385c958b98 Mon Sep 17 00:00:00 2001 From: Prasanth Omanakuttan Date: Thu, 19 Oct 2023 12:18:18 +0530 Subject: [PATCH 15/15] bmc-common | Logging parameters instead of string append --- .../bmc/auth/ConfigFileAuthenticationDetailsProvider.java | 6 +++--- .../com/oracle/bmc/http/DefaultConnectorConfigurator.java | 1 - .../bmc/http/signing/internal/BouncyCastleHelper.java | 2 +- bmc-common/src/main/java/com/oracle/bmc/model/Range.java | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/ConfigFileAuthenticationDetailsProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/ConfigFileAuthenticationDetailsProvider.java index 72911085b8e..3cc623e2a45 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/ConfigFileAuthenticationDetailsProvider.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/ConfigFileAuthenticationDetailsProvider.java @@ -76,8 +76,8 @@ public ConfigFileAuthenticationDetailsProvider(ConfigFile configFile) { new ConfigFileInstancePrincipalAuthenticationDetailsProvider(configFile); } else if (RESOURCE_PRINCIPAL_AUTHENTICATION_TYPE_VALUE.equals(authentication_type)) { LOG.debug( - "Authentication type in config file: " - + configFile.get(AUTHENTICATION_TYPE_KEY)); + "Authentication type in config file: {}" + ,configFile.get(AUTHENTICATION_TYPE_KEY)); this.delegate = new ConfigFileResourcePrincipalAuthenticationDetailsProvider(configFile); } else { @@ -99,7 +99,7 @@ public static Region getRegionFromConfigFile(ConfigFile configFile) { // if regionId is not defined in config file check env variable if (StringUtils.isBlank(regionId)) { regionId = System.getenv(OCI_REGION_ENV_VAR_NAME); - LOG.info("regionId from OCI_REGION env variable: " + regionId); + LOG.info("regionId from OCI_REGION env variable: {}", regionId); } if (regionId != null) { diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/DefaultConnectorConfigurator.java b/bmc-common/src/main/java/com/oracle/bmc/http/DefaultConnectorConfigurator.java index 89ffb67e1f3..c456e772fbc 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/http/DefaultConnectorConfigurator.java +++ b/bmc-common/src/main/java/com/oracle/bmc/http/DefaultConnectorConfigurator.java @@ -5,7 +5,6 @@ package com.oracle.bmc.http; import com.oracle.bmc.http.client.HttpClientBuilder; -import org.slf4j.Logger; /** * DefaultConnectorConfigurator represents the basic behavior of the transport layer. diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/BouncyCastleHelper.java b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/BouncyCastleHelper.java index 4590510fff0..7e03fd3224a 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/BouncyCastleHelper.java +++ b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/BouncyCastleHelper.java @@ -19,7 +19,7 @@ private BouncyCastleHelper() { try { final Class bouncyCastleProviderClass = getBouncyCastleProviderClass(); bouncyCastleProvider = (Provider) bouncyCastleProviderClass.newInstance(); - LOG.info("Instantiated provider: " + bouncyCastleProviderClass.getName()); + LOG.info("Instantiated provider: {}" ,bouncyCastleProviderClass.getName()); } catch (InstantiationException | IllegalAccessException ex) { LOG.error("Failed to instantiate any BouncyCastle provider", ex); throw new BouncyCastleHelperException( diff --git a/bmc-common/src/main/java/com/oracle/bmc/model/Range.java b/bmc-common/src/main/java/com/oracle/bmc/model/Range.java index 9ede4860268..424dc6e7700 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/model/Range.java +++ b/bmc-common/src/main/java/com/oracle/bmc/model/Range.java @@ -47,12 +47,12 @@ public String toString() { if (endByte != null) { return String.format(END_ONLY_HEADER_VALUE_FORMAT, endByte); } - LOG.error("Must provide start/end byte for range request: " + this); + LOG.error("Must provide start/end byte for range request: {}", this); return ""; } /** - * Parse the "content-range" header per https://tools.ietf.org/html/rfc7233#section-4.2. + * Parse the "content-range" header per .... * *

Note, this is only for successful responses (206). It does not handle 416 (range not * satisfiable).