code: public void parseName(String name) throws IOException {
          if (name == null || name.length() == 0) {
              throw new IOException("RFC822Name may not be null or empty");
          }
          // See if domain is a valid domain name
          String domain = name.substring(name.indexOf('@')+1);
          if (domain.length() == 0) {
              throw new IOException("RFC822Name may not end with @");
          } else {
              //An RFC822 NameConstraint could start with a ., although
              //a DNSName may not
              if (domain.startsWith(".")) {
                  if (domain.length() == 1)
                      throw new IOException("RFC822Name domain may not be just .");
              }
          }
      }
docs: Parse an RFC822Name string to see if it is a valid
  addr-spec according to IETF RFC822 and RFC2459:
  [local-part@]domain
  <p>
  local-part@ could be empty for an RFC822Name NameConstraint,
  but the domain at least must be non-empty.  Case is not
  significant.
  
  @param name the RFC822Name string
  @throws IOException if name is not valid