Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Illegal Address using InternetAddress in javax.mail.* with Oracle

807603Feb 12 2008 — edited Feb 12 2008
I'm pulling email addresses from an oracle DB. Every now and then I get the following error:

javax.mail.internet.AddressException: Illegal address in string ``''
at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:108)

The email addresses look normal. Usually something like xxxx@yahoo.com ... It's only occurring with some users that have provided more than one email address. When we pull multiple addresses for a certain user, we use the following code to process the data:
protected InternetAddress[] getEmailAddresses(String emails) throws Exception {
        String[] emailArray = emails.split(" ");
        ArrayList temp = new ArrayList();
        for (int i=0; i < emailArray.length; i++) {
            temp.add(new InternetAddress(emailArray));
}
return (InternetAddress[])temp.toArray(new InternetAddress[] {});
}


Pretty much, I just send it a string containing all of the email addresses for each user. Could there be an issue with emails.split(" ") ?

The email addresses are added to a string by doing the following:
        while (emailData.next()) {
            emailAddress = emailAddress + " " + emailData.getString(1);            
        }
emailData contains the database object, the oracle ResultSet.

Any ideas?

Edited by: jreyno24 on Feb 12, 2008 7:09 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2008
Added on Feb 12 2008
3 comments
1,727 views