new InvalidParameterValueException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, key, value), key, value); e.initCause(exception); throw e;
new InvalidParameterValueException( Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, key, value), key, value); e.initCause(exception); throw e;
/** * Sets the parameter value as a floating point and its associated unit. * * <p>The default implementation wraps the given number in an object of the type specified by the * {@linkplain #getDescriptor() descriptor}, then delegates to {@link #setValue(Object, Unit)}.</p> * * @param newValue the parameter value. * @param unit the unit for the specified value. * @throws InvalidParameterValueException if the floating point type is inappropriate for this parameter, * or if the value is illegal for some other reason (for example a value out of range). * * @see #setValue(double) * @see #doubleValue(Unit) */ @Override public void setValue(final double newValue, final Unit<?> unit) throws InvalidParameterValueException { try { setValue(wrap(newValue, descriptor.getValueClass()), unit); } catch (InvalidParameterValueException e) { throw e; // Need to be thrown explicitely because it is a subclass of IllegalArgumentException. } catch (IllegalArgumentException e) { throw (InvalidParameterValueException) new InvalidParameterValueException( e.getLocalizedMessage(), Verifier.getDisplayName(descriptor), newValue).initCause(e); } }
/** * Sets the parameter value as a floating point and its associated unit. * * <p>The default implementation wraps the given number in an object of the type specified by the * {@linkplain #getDescriptor() descriptor}, then delegates to {@link #setValue(Object, Unit)}.</p> * * @param newValue the parameter value. * @param unit the unit for the specified value. * @throws InvalidParameterValueException if the floating point type is inappropriate for this parameter, * or if the value is illegal for some other reason (for example a value out of range). * * @see #setValue(double) * @see #doubleValue(Unit) */ @Override public void setValue(final double newValue, final Unit<?> unit) throws InvalidParameterValueException { try { setValue(wrap(newValue, descriptor.getValueClass()), unit); } catch (InvalidParameterValueException e) { throw e; // Need to be thrown explicitly because it is a subclass of IllegalArgumentException. } catch (IllegalArgumentException e) { throw (InvalidParameterValueException) new InvalidParameterValueException( e.getLocalizedMessage(), Verifier.getDisplayName(descriptor), newValue).initCause(e); } }
InvalidParameterValueException e = new InvalidParameterValueException( Errors.format(Errors.Keys.ILLEGAL_ARGUMENT_$2, key, value), key, value); e.initCause(exception); throw e;