Skip to content

Commit cc8bee7

Browse files
authored
Fix IndexOutOfBoundsException when creating basic network (#4464)
For Basic network isolation methods are not provided, and exception is thrown when trying to encode the Vlan id. That's why we have to check before encoding that the list with isolation methods is not empty
1 parent 8afb451 commit cc8bee7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2484,7 +2484,7 @@ protected URI encodeVlanIdIntoBroadcastUri(String vlanId, PhysicalNetwork pNtwk)
24842484
throw new InvalidParameterValueException(String.format("Failed to encode VLAN/VXLAN %s into a Broadcast URI. Physical Network cannot be null.", vlanId));
24852485
}
24862486

2487-
if(StringUtils.isNotBlank(pNtwk.getIsolationMethods().get(0))) {
2487+
if(!pNtwk.getIsolationMethods().isEmpty() && StringUtils.isNotBlank(pNtwk.getIsolationMethods().get(0))) {
24882488
String isolationMethod = pNtwk.getIsolationMethods().get(0).toLowerCase();
24892489
String vxlan = BroadcastDomainType.Vxlan.toString().toLowerCase();
24902490
if(isolationMethod.equals(vxlan)) {

0 commit comments

Comments
 (0)