From: Roland Häder Date: Tue, 31 May 2016 13:12:18 +0000 (+0200) Subject: avoid NPEs, if cellphone, fax or land-line instances are not set X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9242fb05264b26a738971433339e4e46e8ec07c7;p=jjobs-war.git avoid NPEs, if cellphone, fax or land-line instances are not set --- diff --git a/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java index 683b06dc..3aa0ea26 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java @@ -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