]> git.mxchange.org Git - addressbook-war.git/blobdiff - src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java
Continued with fixes/rewrites:
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / contact / AddressbookContactWebSessionBean.java
index ed9c740f2d8644751f58f155129291b6b2f32089..6dcff57207fa1feb016b8c36839955df802f6989 100644 (file)
@@ -213,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);
@@ -760,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())));
        }