From: Roland Häder Date: Mon, 15 Aug 2016 14:27:47 +0000 (+0200) Subject: Fixed: (please cherry-pick) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=05e0eb665b16d03bb18590c11068ccee21025106;p=pizzaservice-ejb.git Fixed: (please cherry-pick) - wrong checks, the id number is not null and 1 or larger --- diff --git a/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java index dbbe9f1..1137f0e 100644 --- a/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/contact/LandingAdminContactSessionBean.java @@ -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 } }