@@ -78,7 +78,7 @@ public <T> URI toUri(T value) {
7878 }
7979 @ Override
8080 public String getValueFrom (URI uri ) {
81- return uri .getAuthority ();
81+ return uri == null ? null : uri .getAuthority ();
8282 }
8383 },
8484 Vswitch ("vs" , String .class ), LinkLocal (null , null ), Vnet ("vnet" , Long .class ), Storage ("storage" , Integer .class ), Lswitch ("lswitch" , String .class ) {
@@ -96,7 +96,7 @@ public <T> URI toUri(T value) {
9696 */
9797 @ Override
9898 public String getValueFrom (URI uri ) {
99- return uri .getSchemeSpecificPart ();
99+ return uri == null ? null : uri .getSchemeSpecificPart ();
100100 }
101101 },
102102 Mido ("mido" , String .class ), Pvlan ("pvlan" , String .class ),
@@ -177,7 +177,7 @@ public <T> URI toUri(T value) {
177177 * @return the scheme as BroadcastDomainType
178178 */
179179 public static BroadcastDomainType getSchemeValue (URI uri ) {
180- return toEnumValue (uri .getScheme ());
180+ return toEnumValue (uri == null ? null : uri .getScheme ());
181181 }
182182
183183 /**
@@ -191,7 +191,7 @@ public static BroadcastDomainType getTypeOf(String str) throws URISyntaxExceptio
191191 if (com .cloud .dc .Vlan .UNTAGGED .equalsIgnoreCase (str )) {
192192 return Native ;
193193 }
194- return getSchemeValue (new URI (str ));
194+ return getSchemeValue (str == null ? null : new URI (str ));
195195 }
196196
197197 /**
@@ -220,7 +220,7 @@ public static BroadcastDomainType toEnumValue(String scheme) {
220220 * @return the host part as String
221221 */
222222 public String getValueFrom (URI uri ) {
223- return uri .getHost ();
223+ return uri == null ? null : uri .getHost ();
224224 }
225225
226226 /**
@@ -243,7 +243,7 @@ public static String getValue(URI uri) {
243243 * @throws URISyntaxException the string is not even an uri
244244 */
245245 public static String getValue (String uriString ) throws URISyntaxException {
246- return getValue (new URI (uriString ));
246+ return getValue (uriString == null ? null : new URI (uriString ));
247247 }
248248
249249 /**
0 commit comments