From cf2d84fd78467d38b61e585123ce9ccf809441e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 15 Aug 2016 16:27:47 +0200 Subject: [PATCH] Fixed: (please cherry-pick) - wrong checks, the id number is not null and 1 or larger --- .../contact/LandingAdminContactSessionBean.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 } } -- 2.39.2