Skip to content

Commit

Permalink
remove InvalidParameterException; (Azure#16281)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Oct 14, 2020
1 parent 0d8e8a5 commit 3161ed5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Snapshot, SnapshotInner, SnapshotImpl, ComputeManager>
implements Snapshot, Snapshot.Definition, Snapshot.Update {
Expand Down Expand Up @@ -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)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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];
Expand All @@ -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;
Expand Down

0 comments on commit 3161ed5

Please sign in to comment.