Example usage for javax.mail.internet AddressException AddressException

List of usage examples for javax.mail.internet AddressException AddressException

Introduction

In this page you can find the example usage for javax.mail.internet AddressException AddressException.

Prototype

public AddressException(String s) 

Source Link

Document

Constructs an AddressException with the specified detail message.

Usage

From source file:org.modelibra.type.Email.java

/**
 * Constructs an email address object.//from   ww w  . ja  va 2 s  . c  o  m
 * 
 * @param emailAddress
 *            email address
 * @throws email
 *             address exception if there is a problem
 */
public Email(String emailAddress) throws AddressException {
    if (validate(emailAddress)) {
        this.emailAddress = emailAddress;
    } else {
        throw new AddressException(emailAddress + " is not a valid email address.");
    }
}

From source file:org.olat.core.util.mail.manager.MailManagerImpl.java

private InternetAddress getRawEmailFromAddress(Address address) throws AddressException {
    if (address == null) {
        throw new AddressException("Address cannot be null");
    }/*from w  w  w.  j  a  v a  2 s.  c  om*/
    InternetAddress fromAddress = new InternetAddress(address.toString());
    String fromPlainAddress = fromAddress.getAddress();
    return new InternetAddress(fromPlainAddress);
}