From 114d21bdab0bf882d5215f96d9f3ef560e9ee98d Mon Sep 17 00:00:00 2001 From: Mohammad Derakhshani Date: Wed, 30 Jun 2021 14:27:27 -0700 Subject: [PATCH 1/2] loading correct class --- .../implementation/ImplementationBridgeHelpers.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java index e5264a34ae02..91289b4be79c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java @@ -6,6 +6,7 @@ import com.azure.cosmos.BulkProcessingOptions; import com.azure.cosmos.BulkProcessingThresholds; import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosBulkOperationResponse; import com.azure.cosmos.CosmosClient; import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.batch.PartitionScopeThresholds; @@ -88,7 +89,7 @@ public static final class CosmosQueryRequestOptionsHelper { private CosmosQueryRequestOptionsHelper() {} static { - ensureClassLoaded(CosmosQueryRequestOptionsHelper.class); + ensureClassLoaded(CosmosQueryRequestOptions.class); } public static void setCosmosQueryRequestOptionsAccessor(final CosmosQueryRequestOptionsAccessor newAccessor) { @@ -118,7 +119,7 @@ public static final class CosmosItemRequestOptionsHelper { private CosmosItemRequestOptionsHelper() {} static { - ensureClassLoaded(CosmosQueryRequestOptionsHelper.class); + ensureClassLoaded(CosmosItemRequestOptions.class); } public static void setCosmosItemRequestOptionsAccessor(final CosmosItemRequestOptionsAccessor newAccessor) { @@ -149,7 +150,7 @@ public static final class CosmosBulkProcessingOptionsHelper { private CosmosBulkProcessingOptionsHelper() {} static { - ensureClassLoaded(CosmosQueryRequestOptionsHelper.class); + ensureClassLoaded(BulkProcessingOptions.class); } public static void setCosmosBulkProcessingOptionAccessor(final CosmosBulkProcessingOptionAccessor newAccessor) { @@ -249,7 +250,7 @@ public static final class BulkProcessingThresholdsHelper { private BulkProcessingThresholdsHelper() {} static { - ensureClassLoaded(BulkProcessingThresholdsHelper.class); + ensureClassLoaded(BulkProcessingThresholds.class); } public static void setBulkProcessingThresholdsAccessor(final BulkProcessingThresholdsAccessor newAccessor) { From 3897e4a304dfe401c2cc4c0e4adf1b05fb6fff57 Mon Sep 17 00:00:00 2001 From: Mohammad Derakhshani Date: Thu, 1 Jul 2021 13:06:47 -0700 Subject: [PATCH 2/2] responded to comments --- .../ImplementationBridgeHelpers.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java index 91289b4be79c..705501426e77 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java @@ -6,7 +6,6 @@ import com.azure.cosmos.BulkProcessingOptions; import com.azure.cosmos.BulkProcessingThresholds; import com.azure.cosmos.CosmosAsyncClient; -import com.azure.cosmos.CosmosBulkOperationResponse; import com.azure.cosmos.CosmosClient; import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.batch.PartitionScopeThresholds; @@ -33,7 +32,7 @@ private CosmosClientBuilderHelper() {} public static void setCosmosClientBuilderAccessor(final CosmosClientBuilderAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosClientBuilderHelper accessor already initialized!"); + throw new IllegalStateException("CosmosClientBuilder accessor already initialized!"); } accessor = newAccessor; @@ -41,7 +40,7 @@ public static void setCosmosClientBuilderAccessor(final CosmosClientBuilderAcces static CosmosClientBuilderAccessor getCosmosClientBuilderAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosClientBuilderHelper accessor is not initialized yet!"); + throw new IllegalStateException("CosmosClientBuilder accessor is not initialized yet!"); } return accessor; @@ -65,7 +64,7 @@ private PartitionKeyHelper() {} public static void setPartitionKeyAccessor(final PartitionKeyAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("PartitionKeyHelper accessor already initialized!"); + throw new IllegalStateException("PartitionKey accessor already initialized!"); } accessor = newAccessor; @@ -73,7 +72,7 @@ public static void setPartitionKeyAccessor(final PartitionKeyAccessor newAccesso public static PartitionKeyAccessor getPartitionKeyAccessor() { if (accessor == null) { - throw new IllegalStateException("PartitionKeyHelper accessor is not initialized!"); + throw new IllegalStateException("PartitionKey accessor is not initialized!"); } return accessor; @@ -94,7 +93,7 @@ private CosmosQueryRequestOptionsHelper() {} public static void setCosmosQueryRequestOptionsAccessor(final CosmosQueryRequestOptionsAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor already initialized!"); + throw new IllegalStateException("CosmosQueryRequestOptions accessor already initialized!"); } accessor = newAccessor; @@ -102,7 +101,7 @@ public static void setCosmosQueryRequestOptionsAccessor(final CosmosQueryRequest public static CosmosQueryRequestOptionsAccessor getCosmosQueryRequestOptionsAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor is not initialized yet!"); + throw new IllegalStateException("CosmosQueryRequestOptions accessor is not initialized yet!"); } return accessor; @@ -124,7 +123,7 @@ private CosmosItemRequestOptionsHelper() {} public static void setCosmosItemRequestOptionsAccessor(final CosmosItemRequestOptionsAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor already initialized!"); + throw new IllegalStateException("CosmosItemRequestOptions accessor already initialized!"); } accessor = newAccessor; @@ -132,7 +131,7 @@ public static void setCosmosItemRequestOptionsAccessor(final CosmosItemRequestOp public static CosmosItemRequestOptionsAccessor getCosmosItemRequestOptionsAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor is not initialized yet!"); + throw new IllegalStateException("CosmosItemRequestOptions accessor is not initialized yet!"); } return accessor; @@ -155,7 +154,7 @@ private CosmosBulkProcessingOptionsHelper() {} public static void setCosmosBulkProcessingOptionAccessor(final CosmosBulkProcessingOptionAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor already initialized!"); + throw new IllegalStateException("BulkProcessingOptions accessor already initialized!"); } accessor = newAccessor; @@ -163,7 +162,7 @@ public static void setCosmosBulkProcessingOptionAccessor(final CosmosBulkProcess public static CosmosBulkProcessingOptionAccessor getCosmosBulkProcessingOptionAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosQueryRequestOptionsHelper accessor is not initialized yet!"); + throw new IllegalStateException("BulkProcessingOptions accessor is not initialized yet!"); } return accessor; @@ -187,7 +186,7 @@ private CosmosItemResponseHelper() { public static void setCosmosItemResponseBuilderAccessor(final CosmosItemResponseBuilderAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosItemResponseBuilder accessor already initialized!"); + throw new IllegalStateException("CosmosItemResponse accessor already initialized!"); } accessor = newAccessor; @@ -195,7 +194,7 @@ public static void setCosmosItemResponseBuilderAccessor(final CosmosItemResponse public static CosmosItemResponseBuilderAccessor getCosmosItemResponseBuilderAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosItemResponseBuilder accessor is not initialized yet!"); + throw new IllegalStateException("CosmosItemResponse accessor is not initialized yet!"); } return accessor; @@ -226,7 +225,7 @@ private CosmosClientHelper() { public static void setCosmosClientAccessor(final CosmosClientAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("CosmosClientAccessor accessor already initialized!"); + throw new IllegalStateException("CosmosClient accessor already initialized!"); } accessor = newAccessor; @@ -234,7 +233,7 @@ public static void setCosmosClientAccessor(final CosmosClientAccessor newAccesso public static CosmosClientAccessor geCosmosClientAccessor() { if (accessor == null) { - throw new IllegalStateException("CosmosClientAccessor accessor is not initialized yet!"); + throw new IllegalStateException("CosmosClient accessor is not initialized yet!"); } return accessor; @@ -255,7 +254,7 @@ private BulkProcessingThresholdsHelper() {} public static void setBulkProcessingThresholdsAccessor(final BulkProcessingThresholdsAccessor newAccessor) { if (accessor != null) { - throw new IllegalStateException("BulkProcessingThresholdsHelper accessor already initialized!"); + throw new IllegalStateException("BulkProcessingThresholds accessor already initialized!"); } accessor = newAccessor; @@ -263,7 +262,7 @@ public static void setBulkProcessingThresholdsAccessor(final BulkProcessingThres public static BulkProcessingThresholdsAccessor getBulkProcessingThresholdsAccessor() { if (accessor == null) { - throw new IllegalStateException("BulkProcessingThresholdsHelper accessor is not initialized yet!"); + throw new IllegalStateException("BulkProcessingThresholds accessor is not initialized yet!"); } return accessor;