Examples of InvalidParameterValueException


Examples of org.opengis.parameter.InvalidParameterValueException

            key=   VERSION_KEY; this.version   = (String)              (value = version);
            key= CODESPACE_KEY; this.codeSpace = (String)              (value = codeSpace);
            key= AUTHORITY_KEY; this.authority = (Citation)            (value = authority);
            key=   REMARKS_KEY; this.remarks   = (InternationalString) (value = remarks);
        } catch (ClassCastException exception) {
            final InvalidParameterValueException e = new InvalidParameterValueException(
                    Errors.format(Errors.Keys.IllegalArgumentValue_2, key, value), key, value);
            e.initCause(exception);
            throw e;
        }
        if (code == null) {
            throw new IllegalArgumentException(Errors.format(Errors.Keys.MissingValueForProperty_1, CODE_KEY));
        }
View Full Code Here

Examples of org.rhq.enterprise.communications.command.param.InvalidParameterValueException

        // make sure the current set of parameters have all required parameters defined with the proper types
        for (Iterator iter = new RequiredParameterDefinitionIterator(m_parameterDefinitions.values()); iter.hasNext();) {
            ParameterDefinition paramDef = (ParameterDefinition) iter.next();
            if (!existingParamNames.contains(paramDef.getName())) {
                throw new InvalidParameterValueException(LOG.getMsgString(CommI18NResourceKeys.MISSING_REQUIRED_FIELD,
                    paramDef.getName(), this));
            }

            paramValue = getParameterValue(paramDef.getName());
            if (!paramDef.isValidValue(paramValue)) {
                boolean valid = false;

                if (convertIfNecessary) {
                    paramValue = paramDef.convertObject(paramValue);

                    // if we got this far, our invalid value was converted to a valid value
                    valid = true;

                    // overwrite the invalid value with the new valid one
                    m_commandParameters.put(paramDef.getName(), paramValue);
                }

                if (!valid) {
                    throw new InvalidParameterValueException(LOG.getMsgString(
                        CommI18NResourceKeys.BAD_REQUIRED_PARAM_TYPE, paramDef.getName(), paramDef.getType(), paramDef
                            .isNullable(), ((paramValue == null) ? "<null>" : paramValue.getClass().toString()), this));
                }
            }
        }

        // if the current set of parameters has optional parameters defined,
        // make sure their values are of the proper type
        for (Iterator iter = new OptionalParameterDefinitionIterator(m_parameterDefinitions.values()); iter.hasNext();) {
            ParameterDefinition paramDef = (ParameterDefinition) iter.next();
            if (existingParamNames.contains(paramDef.getName())) {
                paramValue = getParameterValue(paramDef.getName());
                if (!paramDef.isValidValue(paramValue)) {
                    boolean valid = false;
                    if (convertIfNecessary) {
                        paramValue = paramDef.convertObject(paramValue);

                        // if we got this far, our invalid value was converted to a valid value
                        valid = true;

                        // overwrite the invalid value with the new valid one
                        m_commandParameters.put(paramDef.getName(), paramValue);
                    }

                    if (!valid) {
                        throw new InvalidParameterValueException(LOG.getMsgString(
                            CommI18NResourceKeys.BAD_OPTIONAL_PARAM_TYPE, paramDef.getName(), paramDef.getType(),
                            paramDef.isNullable(),
                            ((paramValue == null) ? "<null>" : paramValue.getClass().toString()), this));
                    }
                }
            }
        }

        // now make sure the current set of parameters do not contain unused, extra parameters
        for (Iterator iter = existingParamNames.iterator(); iter.hasNext();) {
            String paramName = (String) iter.next();

            if (!m_parameterDefinitions.containsKey(paramName)) {
                throw new InvalidParameterValueException(LOG.getMsgString(CommI18NResourceKeys.UNEXPECTED_PARAM,
                    paramName, this));
            }
        }

        // everything checks out OK
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.