]> git.mxchange.org Git - jjobs-war.git/commitdiff
avoid NPEs, if cellphone, fax or land-line instances are not set
authorRoland Häder <roland@mxchange.org>
Tue, 31 May 2016 13:12:18 +0000 (15:12 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 1 Jun 2016 19:44:13 +0000 (21:44 +0200)
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java

index 683b06dcdc7bded354eafdb813538002bceb3039..3aa0ea262178ff56439cb6d6b85928bb448e3d3f 100644 (file)
@@ -323,21 +323,27 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
                this.setZipCode(contact.getContactZipCode());
 
                // ... cellphone data
-               this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
-               this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
-               this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
+               if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
+                       this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
+                       this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
+                       this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
+               }
 
                // ... fax data
-               this.setFaxId(contact.getContactFaxNumber().getPhoneId());
-               this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
-               this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
-               this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
+               if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
+                       this.setFaxId(contact.getContactFaxNumber().getPhoneId());
+                       this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
+                       this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
+                       this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
+               }
 
                // .. land-line data
-               this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
-               this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
-               this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
-               this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
+               if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                       this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
+                       this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
+                       this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
+                       this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
+               }
        }
 
        @Override