]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
Fixed: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Mon, 15 Aug 2016 14:27:47 +0000 (16:27 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 16 Aug 2016 19:25:04 +0000 (21:25 +0200)
- wrong checks, the id number is not null and 1 or larger

src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java

index dbbe9f15ddaf63c99acb50067ae55c354fb0a32b..1137f0e2850ff5af4832008eea265380f611c128 100644 (file)
@@ -83,9 +83,12 @@ public class LandingAdminContactSessionBean extends BaseLandingDatabaseBean impl
                if (null == contact) {
                        // Throw NPE
                        throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() != null) {
-                       // Should be null
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} - is not null", contact.getContactId())); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Should not be null
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
                }
 
                // Merge it to get a managed entity back
@@ -95,7 +98,7 @@ public class LandingAdminContactSessionBean extends BaseLandingDatabaseBean impl
                this.getEntityManager().remove(managedContact);
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: EXIT!", this.getClass().getSimpleName()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteContactData: EXIT!", this.getClass().getSimpleName())); //NOI18N
        }
 
 }