Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgmt, remove InvalidParameterException #16281

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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