Merge remote-tracking branch 'apache/4.20' into 4.22

This commit is contained in:
Abhishek Kumar 2025-12-01 13:05:08 +05:30
commit 2941b518ba
No known key found for this signature in database
GPG Key ID: 26DF259080DABDC4
3 changed files with 31 additions and 8 deletions

View File

@ -78,7 +78,7 @@ public class Networks {
}
@Override
public String getValueFrom(URI uri) {
return uri.getAuthority();
return uri == null ? null : uri.getAuthority();
}
},
Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) {
@ -96,7 +96,7 @@ public class Networks {
*/
@Override
public String getValueFrom(URI uri) {
return uri.getSchemeSpecificPart();
return uri == null ? null : uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class), Pvlan("pvlan", String.class),
@ -177,7 +177,7 @@ public class Networks {
* @return the scheme as BroadcastDomainType
*/
public static BroadcastDomainType getSchemeValue(URI uri) {
return toEnumValue(uri.getScheme());
return toEnumValue(uri == null ? null : uri.getScheme());
}
/**
@ -191,7 +191,7 @@ public class Networks {
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
return Native;
}
return getSchemeValue(new URI(str));
return getSchemeValue(str == null ? null : new URI(str));
}
/**
@ -220,7 +220,7 @@ public class Networks {
* @return the host part as String
*/
public String getValueFrom(URI uri) {
return uri.getHost();
return uri == null ? null : uri.getHost();
}
/**
@ -243,7 +243,7 @@ public class Networks {
* @throws URISyntaxException the string is not even an uri
*/
public static String getValue(String uriString) throws URISyntaxException {
return getValue(new URI(uriString));
return getValue(uriString == null ? null : new URI(uriString));
}
/**

View File

@ -37,6 +37,24 @@ public class NetworksTest {
public void setUp() {
}
@Test
public void nullBroadcastDomainTypeTest() throws URISyntaxException {
BroadcastDomainType type = BroadcastDomainType.getTypeOf(null);
Assert.assertEquals("a null uri should mean a broadcasttype of undecided", BroadcastDomainType.UnDecided, type);
}
@Test
public void nullBroadcastDomainTypeValueTest() {
URI uri = null;
Assert.assertNull(BroadcastDomainType.getValue(uri));
}
@Test
public void nullBroadcastDomainTypeStringValueTest() throws URISyntaxException {
String uriString = null;
Assert.assertNull(BroadcastDomainType.getValue(uriString));
}
@Test
public void emptyBroadcastDomainTypeTest() throws URISyntaxException {
BroadcastDomainType type = BroadcastDomainType.getTypeOf("");

View File

@ -1997,8 +1997,13 @@ export default {
},
onSearch (opts) {
const query = Object.assign({}, this.$route.query)
const searchFilters = this.$route?.meta?.searchFilters || []
searchFilters.forEach(key => delete query[key])
let searchFilters = this.$route?.meta?.searchFilters || []
if (typeof searchFilters === 'function') {
searchFilters = searchFilters()
}
if (Array.isArray(searchFilters)) {
searchFilters.forEach(key => delete query[key])
}
delete query.name
delete query.templatetype
delete query.keyword