Skip to content

Commit 3161ed5

Browse files
remove InvalidParameterException; (Azure#16281)
1 parent 0d8e8a5 commit 3161ed5

File tree

2 files changed

+6
-10
lines changed
  • sdk/resourcemanager
    • azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation
    • azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm

2 files changed

+6
-10
lines changed

sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/SnapshotImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
2424
import reactor.core.publisher.Mono;
2525

26-
import java.security.InvalidParameterException;
27-
2826
/** The implementation for Snapshot and its create and update interfaces. */
2927
class SnapshotImpl extends GroupableResourceImpl<Snapshot, SnapshotInner, SnapshotImpl, ComputeManager>
3028
implements Snapshot, Snapshot.Definition, Snapshot.Update {
@@ -331,7 +329,7 @@ private String constructStorageAccountId(String vhdUrl) {
331329
} catch (RuntimeException ex) {
332330
throw logger
333331
.logExceptionAsError(
334-
new InvalidParameterException(String.format("%s is not valid URI of a blob to import.", vhdUrl)));
332+
new IllegalArgumentException(String.format("%s is not valid URI of a blob to import.", vhdUrl)));
335333
}
336334
}
337335
}

sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/arm/ResourceId.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
package com.azure.resourcemanager.resources.fluentcore.arm;
55

6-
import java.security.InvalidParameterException;
7-
86
/**
97
* Instantiate itself from a resource id, and give easy access to resource information like subscription, resourceGroup,
108
* resource name.
@@ -38,7 +36,7 @@ private ResourceId(final String id) {
3836
// Skip the first '/' if any, and then split using '/'
3937
String[] splits = (id.startsWith("/")) ? id.substring(1).split("/") : id.split("/");
4038
if (splits.length % 2 == 1) {
41-
throw new InvalidParameterException(badIdErrorText(id));
39+
throw new IllegalArgumentException(badIdErrorText(id));
4240
}
4341

4442
// Save the ID itself
@@ -53,7 +51,7 @@ private ResourceId(final String id) {
5351

5452
// Extract resource type and name
5553
if (splits.length < 2) {
56-
throw new InvalidParameterException(badIdErrorText(id));
54+
throw new IllegalArgumentException(badIdErrorText(id));
5755
} else {
5856
this.name = splits[splits.length - 1];
5957
this.resourceType = splits[splits.length - 2];
@@ -70,19 +68,19 @@ private ResourceId(final String id) {
7068

7169
// Ensure "subscriptions"
7270
if (!splits[0].equalsIgnoreCase("subscriptions")) {
73-
throw new InvalidParameterException(badIdErrorText(id));
71+
throw new IllegalArgumentException(badIdErrorText(id));
7472
}
7573
// Extract subscription ID
7674
this.subscriptionId = splits[1];
7775
// Ensure "resourceGroups"
7876
if (splits.length > 2 && !splits[2].equalsIgnoreCase("resourceGroups")) {
79-
throw new InvalidParameterException(badIdErrorText(id));
77+
throw new IllegalArgumentException(badIdErrorText(id));
8078
}
8179
// Extract resource group name
8280
this.resourceGroupName = splits.length > 3 ? splits[3] : null;
8381
// Ensure "providers"
8482
if (splits.length > 4 && !splits[4].equalsIgnoreCase("providers")) {
85-
throw new InvalidParameterException(badIdErrorText(id));
83+
throw new IllegalArgumentException(badIdErrorText(id));
8684
}
8785
// Extract provider namespace
8886
this.providerNamespace = splits.length > 5 ? splits[5] : null;

0 commit comments

Comments
 (0)