X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Fjava%2Forg%2Fmxchange%2Faddressbook%2Fbeans%2Fcontact%2FAddressbookContactWebSessionBean.java;h=6dcff57207fa1feb016b8c36839955df802f6989;hb=0706d009f46e910e512d277aacdefd21da13c613;hp=725b928f256934253f9b79ee070131d176cd1a83;hpb=a45f6817705b1e4e5da42f39b3e5c0675c755180;p=addressbook-war.git diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java index 725b928f..6dcff572 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java @@ -37,6 +37,7 @@ import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontacts.contact.gender.Gender; import org.mxchange.jcontacts.contact.utils.ContactUtils; +import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent; import org.mxchange.jcontacts.exceptions.ContactNotFoundException; import org.mxchange.jcountry.data.Country; @@ -212,7 +213,7 @@ public class AddressbookContactWebSessionBean implements AddressbookContactWebSe Context context = new InitialContext(); // Try to lookup - this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jratecalc-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N + this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/addressbook-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N } catch (final NamingException e) { // Throw again throw new FaceletException(e); @@ -759,6 +760,19 @@ public class AddressbookContactWebSessionBean implements AddressbookContactWebSe @Override public boolean isEmailAddressRegistered (final Contact contact) { + // Cherck parameter + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactEmailAddress() == null) { + // Throw again + throw new NullPointerException("contact.contactEmailAddress is null"); //NOI18N + } else if (contact.getContactEmailAddress().isEmpty()) { + // Is empty + throw new IllegalArgumentException("contact.contactEmailAddress is empty."); //NOI18N + } + + // Determine it return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress()))); }