@@ -343,7 +343,7 @@ public Map<String, String> getVmDetailsForBackup(VirtualMachine vm) {
343343 if (!networkIds .isEmpty ()) {
344344 details .put (ApiConstants .NETWORK_IDS , String .join ("," , networkIds ));
345345 details .put (ApiConstants .IP_ADDRESSES , String .join ("," , ipAddresses ));
346- details .put (ApiConstants .IP6_ADDRESS , String .join ("," , ip6Addresses ));
346+ details .put (ApiConstants .IP6_ADDRESSES , String .join ("," , ip6Addresses ));
347347 details .put (ApiConstants .MAC_ADDRESSES , String .join ("," , macAddresses ));
348348 }
349349 }
@@ -1058,6 +1058,13 @@ public List<DiskOfferingInfo> getDataDiskOfferingListFromBackup(Backup backup) {
10581058 return diskOfferingInfoList ;
10591059 }
10601060
1061+ private List <String > parseAddressString (String input ) {
1062+ if (input == null ) return null ;
1063+ return Arrays .stream (input .split ("," ))
1064+ .map (s -> "null" .equalsIgnoreCase (s .trim ()) ? null : s .trim ())
1065+ .collect (Collectors .toList ());
1066+ }
1067+
10611068 @ Override
10621069 public Map <Long , Network .IpAddresses > getIpToNetworkMapFromBackup (Backup backup , boolean preserveIps , List <Long > networkIds )
10631070 {
@@ -1080,19 +1087,9 @@ public Map<Long, Network.IpAddresses> getIpToNetworkMapFromBackup(Backup backup,
10801087 }
10811088 }
10821089 if (preserveIpAddresses ) {
1083- String ipAddressString = backup .getDetail (ApiConstants .IP_ADDRESSES );
1084- String ip6AddressString = backup .getDetail (ApiConstants .IP6_ADDRESSES );
1085- String macAddressString = backup .getDetail (ApiConstants .MAC_ADDRESSES );
1086-
1087- if (ipAddressString != null ) {
1088- requestedIp = List .of (ipAddressString .split ("," ));
1089- }
1090- if (macAddressString != null ) {
1091- requestedMac = List .of (macAddressString .split ("," ));
1092- }
1093- if (ip6AddressString != null ) {
1094- requestedIpv6 = List .of (ip6AddressString .split ("," ));
1095- }
1090+ requestedIp = parseAddressString (backup .getDetail (ApiConstants .IP_ADDRESSES ));
1091+ requestedMac = parseAddressString (backup .getDetail (ApiConstants .MAC_ADDRESSES ));
1092+ requestedIpv6 = parseAddressString (backup .getDetail (ApiConstants .IP6_ADDRESSES ));
10961093 }
10971094
10981095 int index = 0 ;
0 commit comments