]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 9 Jun 2017 19:43:54 +0000 (21:43 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 9 Jun 2017 19:58:09 +0000 (21:58 +0200)
- added more checks on parameters (AKA sanity-check)

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java

index b44baec566131abcdd02599c2040051694c594ea..53710ccdf175d0d79cfa7a91dfb850f5c77246aa 100644 (file)
@@ -475,6 +475,36 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                } else if (null == emailAddress) {
                        // Throw NPE
                        throw new NullPointerException("emailAddress is null"); //NOI18N
+               }else if (null == user) {
+                       // Throw NPE
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Not valid number
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId())); //NOI18N
+               } else if (user.getUserName() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userName is null"); //NOI18N
+               } else if (user.getUserName().isEmpty()) {
+                       // Empty string
+                       throw new IllegalArgumentException("user.userName is empty"); //NOI18N
+               } else if (user.getUserAccountStatus() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
+               } else if (user.getUserContact() == null) {
+                       // Throw it again
+                       throw new NullPointerException("user.userContact is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() == null) {
+                       // .. and again
+                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is invalid", user.getUserContact().getContactId())); //NOI18N
+               } else if (user.getUserContact().getContactGender() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("user.userContact.contactGender is null"); //NOI18N
                }
 
                // Prepare mail wrapper