diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotImpl.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotImpl.java index e7db47872ef1..dd22ebcd618a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotImpl.java @@ -23,8 +23,6 @@ import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; import reactor.core.publisher.Mono; -import java.security.InvalidParameterException; - /** The implementation for Snapshot and its create and update interfaces. */ class SnapshotImpl extends GroupableResourceImpl implements Snapshot, Snapshot.Definition, Snapshot.Update { @@ -331,7 +329,7 @@ private String constructStorageAccountId(String vhdUrl) { } catch (RuntimeException ex) { throw logger .logExceptionAsError( - new InvalidParameterException(String.format("%s is not valid URI of a blob to import.", vhdUrl))); + new IllegalArgumentException(String.format("%s is not valid URI of a blob to import.", vhdUrl))); } } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/ResourceId.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/ResourceId.java index 12c840f9c4d3..f9a013112457 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/ResourceId.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/ResourceId.java @@ -3,8 +3,6 @@ package com.azure.resourcemanager.resources.fluentcore.arm; -import java.security.InvalidParameterException; - /** * Instantiate itself from a resource id, and give easy access to resource information like subscription, resourceGroup, * resource name. @@ -38,7 +36,7 @@ private ResourceId(final String id) { // Skip the first '/' if any, and then split using '/' String[] splits = (id.startsWith("/")) ? id.substring(1).split("/") : id.split("/"); if (splits.length % 2 == 1) { - throw new InvalidParameterException(badIdErrorText(id)); + throw new IllegalArgumentException(badIdErrorText(id)); } // Save the ID itself @@ -53,7 +51,7 @@ private ResourceId(final String id) { // Extract resource type and name if (splits.length < 2) { - throw new InvalidParameterException(badIdErrorText(id)); + throw new IllegalArgumentException(badIdErrorText(id)); } else { this.name = splits[splits.length - 1]; this.resourceType = splits[splits.length - 2]; @@ -70,19 +68,19 @@ private ResourceId(final String id) { // Ensure "subscriptions" if (!splits[0].equalsIgnoreCase("subscriptions")) { - throw new InvalidParameterException(badIdErrorText(id)); + throw new IllegalArgumentException(badIdErrorText(id)); } // Extract subscription ID this.subscriptionId = splits[1]; // Ensure "resourceGroups" if (splits.length > 2 && !splits[2].equalsIgnoreCase("resourceGroups")) { - throw new InvalidParameterException(badIdErrorText(id)); + throw new IllegalArgumentException(badIdErrorText(id)); } // Extract resource group name this.resourceGroupName = splits.length > 3 ? splits[3] : null; // Ensure "providers" if (splits.length > 4 && !splits[4].equalsIgnoreCase("providers")) { - throw new InvalidParameterException(badIdErrorText(id)); + throw new IllegalArgumentException(badIdErrorText(id)); } // Extract provider namespace this.providerNamespace = splits.length > 5 ? splits[5] : null;