public static void validateSecurityGroupsFormat(List<String> securityGroups) throws InvalidSecurityGroupFormatException {
  if (securityGroups != null) {
    for (    String sg : securityGroups) {
      if (StringUtils.isBlank(sg) || sg.split("\\\\").length != 2) {
        throw new InvalidSecurityGroupFormatException("The security group format should match domain\\group");
      }
    }
  }
}

public static void validateSecurityGroupsFormat ( List < String > securityGroups ) throws InvalidSecurityGroupFormatException { if ( securityGroups != null ) { for ( String sg : securityGroups ) { if ( StringUtils . isBlank ( sg ) || sg . split ( "\\\\" ) . length != 2 ) { throw new InvalidSecurityGroupFormatException ( "The security group format should match domain\\group" ) ; } } } }
validate the security groups ' format .
