Parses a comma-separated list of IP addresses and CIDR ranges into a NetMaskSet. @param input The comma-separated string of IP addresses and CIDR ranges @return A new NetMaskSet containing the parsed entries @throws IllegalArgumentException If the input contains invalid entries
(String input)
| 179 | * @throws IllegalArgumentException If the input contains invalid entries |
| 180 | */ |
| 181 | public static NetMaskSet parse(String input) { |
| 182 | NetMaskSet result = new NetMaskSet(); |
| 183 | |
| 184 | List<String> errors = result.addAll(input); |
| 185 | if (!errors.isEmpty()) { |
| 186 | StringBuilder sb = new StringBuilder(); |
| 187 | for (String error : errors) { |
| 188 | sb.append(error).append("; "); |
| 189 | } |
| 190 | throw new IllegalArgumentException(sm.getString("netmaskSet.invalidNetMask", sb.toString())); |
| 191 | } |
| 192 | |
| 193 | return result; |
| 194 | } |
| 195 | } |