From: Roland Häder Date: Thu, 27 Jul 2017 20:39:58 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2907ceb1ebd59fa0b9a4980fee55efc394bc5158;p=jjobs-war.git Please cherry-pick: - improved exception message when the expected interface is not implemented (meaning wrong call) - now the value's simple class name is being included Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/converter/businesscontact/JobsBusinessContactConverter.java b/src/java/org/mxchange/jjobs/converter/businesscontact/JobsBusinessContactConverter.java index 4596ac64..df6c6a55 100644 --- a/src/java/org/mxchange/jjobs/converter/businesscontact/JobsBusinessContactConverter.java +++ b/src/java/org/mxchange/jjobs/converter/businesscontact/JobsBusinessContactConverter.java @@ -44,7 +44,7 @@ public class JobsBusinessContactConverter implements Converter { private static BusinessDataSessionBeanRemote BUSINESS_CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsBusinessContactConverter () { } @@ -100,15 +100,15 @@ public class JobsBusinessContactConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof Contact)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((BusinessBasicData) value).getBusinessDataId()); } diff --git a/src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java b/src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java index 5d772373..8cae4a2c 100644 --- a/src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java +++ b/src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java @@ -43,7 +43,7 @@ public class JobsContactConverter implements Converter { private static ContactSessionBeanRemote CONTACT_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsContactConverter () { } @@ -99,15 +99,15 @@ public class JobsContactConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof Contact)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Contact.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((Contact) value).getContactId()); } diff --git a/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java b/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java index 5876f0cd..5e9e2be6 100644 --- a/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java +++ b/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java @@ -44,7 +44,7 @@ public class JobsCountryConverter implements Converter { private static CountrySingletonBeanRemote COUNTRY_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsCountryConverter () { } @@ -111,15 +111,15 @@ public class JobsCountryConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof Country)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Country.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((Country) value).getCountryId()); } diff --git a/src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java b/src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java index 9294a04b..ffbf35eb 100644 --- a/src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java +++ b/src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java @@ -44,7 +44,7 @@ public class JobsFaxNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsFaxNumberConverter () { } @@ -107,15 +107,15 @@ public class JobsFaxNumberConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof DialableNumber)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((DialableNumber) value).getPhoneId()); } diff --git a/src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java b/src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java index 18414be5..df0517cb 100644 --- a/src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java +++ b/src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java @@ -44,7 +44,7 @@ public class JobsLandLineNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsLandLineNumberConverter () { } @@ -100,15 +100,15 @@ public class JobsLandLineNumberConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof DialableNumber)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((DialableNumber) value).getPhoneId()); } diff --git a/src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java b/src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java index 9e9ae7b5..768ab198 100644 --- a/src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java +++ b/src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java @@ -44,7 +44,7 @@ public class JobsMobileNumberConverter implements Converter { private static PhoneSessionBeanRemote PHONE_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsMobileNumberConverter () { } @@ -100,15 +100,15 @@ public class JobsMobileNumberConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof DialableNumber)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement DialableNumber.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((DialableNumber) value).getPhoneId()); } diff --git a/src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java b/src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java index 062cf02a..416be221 100644 --- a/src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java +++ b/src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java @@ -44,7 +44,7 @@ public class JobsMobileProviderConverter implements Converter { private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN; /** - * Initialization of this converter + * Default constructor */ public JobsMobileProviderConverter () { } @@ -111,15 +111,15 @@ public class JobsMobileProviderConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof MobileProvider)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement MobileProvider.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement MobileProvider.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((MobileProvider) value).getProviderId()); } diff --git a/src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java b/src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java index 77b6d32f..ed2f2489 100644 --- a/src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java +++ b/src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java @@ -43,7 +43,7 @@ public class JobsUserConverter implements Converter { private static UserSessionBeanRemote USER_BEAN; /** - * Constructor of this converter + * Default constructor */ public JobsUserConverter () { } @@ -99,15 +99,15 @@ public class JobsUserConverter implements Converter { @Override public String getAsString (final FacesContext context, final UIComponent component, final Object value) { // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { + if ((null == value) || (String.valueOf(value).isEmpty())) { // Is null return ""; //NOI18N } else if (!(value instanceof User)) { // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement User.", value)); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement User.", value.getClass().getSimpleName())); //NOI18N } - // Return category id + // Return id number return String.valueOf(((User) value).getUserId()); } diff --git a/src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java b/src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java index 79d219f5..1f8efaa6 100644 --- a/src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java +++ b/src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java @@ -49,7 +49,7 @@ public class JobsUserIdValidator extends BaseLongValidator implements Validator private static final long serialVersionUID = 12_869_569_314_764_690L; /** - * Initialization of this converter + * Default constructor */ public JobsUserIdValidator () { }