Skip to content

Commit 819a4f1

Browse files
committed
routed: throw InvalidParameterValueException instead of CloudRuntimeException which gives vague message to regular users
1 parent 28dd22d commit 819a4f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ protected Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetworkOrVpcInt
617617
}
618618
Boolean isAutoAllocationEnabled = RoutedIPv4NetworkCidrAutoAllocationEnabled.valueIn(ownerAccountId);
619619
if (!Boolean.TRUE.equals(isAutoAllocationEnabled)) {
620-
throw new CloudRuntimeException("CIDR auto-allocation is disabled for this account");
620+
throw new InvalidParameterValueException("CIDR auto-allocation is disabled for this account");
621621
}
622622
for (DataCenterIpv4GuestSubnetVO subnet : subnets) {
623623
Ipv4GuestSubnetNetworkMap result = createIpv4SubnetForGuestNetworkOrVpcInternal(cidrSize, subnet);
@@ -713,7 +713,7 @@ private void checkConflicts(List<Ipv4GuestSubnetNetworkMapVO> subnetsForNetwork,
713713

714714
private void validateNetworkCidrSize(Integer networkCidrSize) {
715715
if (networkCidrSize == null) {
716-
throw new CloudRuntimeException("network/vpc CidrSize is null");
716+
throw new InvalidParameterValueException("network/vpc CidrSize is null");
717717
}
718718
}
719719

@@ -769,7 +769,7 @@ protected String createIpv4SubnetStringFromParentSubnet(DataCenterIpv4GuestSubne
769769
// Allocate a subnet automatically
770770
String networkCidr = getFreeNetworkCidr(subnetsInFreeIpRanges, networkCidrSize);
771771
if (networkCidr == null) {
772-
throw new CloudRuntimeException("Failed to automatically allocate a subnet with specified cidrsize");
772+
throw new InvalidParameterValueException("Failed to automatically allocate a subnet with specified cidrsize");
773773
}
774774
return networkCidr;
775775
}

0 commit comments

Comments
 (0)