]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java
The exception's message now contains the thrown exception's message, too.
[addressbook-lib.git] / src / org / mxchange / addressbook / validator / addressbook / AddressbookIdValidator.java
index a3edc657a153fdb134c33898ba8dee24923bca37..d97d8ac62d74c91f26a97ef0fa52db95379794ba 100644 (file)
@@ -72,7 +72,7 @@ public class AddressbookIdValidator extends BaseLongValidator {
                        this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N
                } catch (final NamingException ex) {
                        // Continue to throw it
-                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
                }
        }
 
@@ -82,10 +82,10 @@ public class AddressbookIdValidator extends BaseLongValidator {
                this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
 
                // All accepted, required fields
-               String[] requiredFileds = {"addressbookId"}; //NOI18N
+               String[] requiredFields = {"addressbookId"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFileds, false);
+               super.preValidate(context, component, value, requiredFields, false);
 
                // Cast to long
                Long addressbookId = (Long) value;
@@ -105,7 +105,7 @@ public class AddressbookIdValidator extends BaseLongValidator {
                        addressbook = this.addressbookBean.getAddressbookById(addressbookId);
 
                        // Is it set?
-                       if (addressbook == null) {
+                       if (null == addressbook) {
                                // Is null?!
                                throw new NullPointerException(MessageFormat.format("addressbook for id={0} is null", addressbookId)); //NOI18N
                        }