From: Roland Häder Date: Sat, 25 Jun 2022 12:57:38 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=639e0355cd3d26528f8e3d6e6525cb6dc68cde55;p=addressbook-ejb.git Please cherry-pick: - country.countryCode and countryI18nKey could be NULL here (independently from each other) and needs checking BEFORE any method on them is being executed Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcountry/model/data/AddressbookAdminCountrySingletonBean.java b/src/java/org/mxchange/jcountry/model/data/AddressbookAdminCountrySingletonBean.java index 87e193d..0cfce0f 100644 --- a/src/java/org/mxchange/jcountry/model/data/AddressbookAdminCountrySingletonBean.java +++ b/src/java/org/mxchange/jcountry/model/data/AddressbookAdminCountrySingletonBean.java @@ -60,9 +60,15 @@ public class AddressbookAdminCountrySingletonBean extends BaseAddressbookEnterpr if (null == country) { // Throw NPE throw new NullPointerException("country is null"); //NOI18N + } else if (country.getCountryCode() == null) { + // Required field not set + throw new NullPointerException("country.countryCode is null"); //NOI18N } else if (country.getCountryCode().isEmpty()) { // Code is not set throw new IllegalArgumentException("country.countryCode is empty"); //NOI18N + } else if (country.getCountryI18nKey() == null) { + // Required field not set + throw new NullPointerException("country.countryI18nKey is null"); //NOI18N } else if (country.getCountryI18nKey().isEmpty()) { // I18n key is not set throw new IllegalArgumentException("country.countryI18nKey is empty"); //NOI18N