Example usage for org.springframework.beans TypeMismatchException getMessage

List of usage examples for org.springframework.beans TypeMismatchException getMessage

Introduction

In this page you can find the example usage for org.springframework.beans TypeMismatchException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:org.uimafit.factory.ConfigurationParameterFactory.java

/**
 * Convert a value so it can be injected into a UIMA component. UIMA only supports several
 * parameter types. If the value is not of these types, this method can be used to coerce the
 * value into a supported type (typically String). It is also used to convert primitive
 * arrays to object arrays when necessary.
 * //from  www  .  ja va  2  s .com
 * @param param the configuration parameter.
 * @param aValue the parameter value.
 * @return the converted value.
 */
protected static Object convertParameterValue(ConfigurationParameter param, Object aValue) {
    Object value = aValue;
    if (value.getClass().isArray() && value.getClass().getComponentType().getName().equals("boolean")) {
        value = ArrayUtils.toObject((boolean[]) value);
    } else if (value.getClass().isArray() && value.getClass().getComponentType().getName().equals("int")) {
        value = ArrayUtils.toObject((int[]) value);
    } else if (value.getClass().isArray() && value.getClass().getComponentType().getName().equals("float")) {
        value = ArrayUtils.toObject((float[]) value);
    } else {
        try {
            if (param.getType().equals(ConfigurationParameter.TYPE_STRING)) {
                SimpleTypeConverter converter = new SimpleTypeConverter();
                PropertyEditorUtil.registerUimaFITEditors(converter);
                if (value.getClass().isArray() || value instanceof Collection) {
                    value = converter.convertIfNecessary(value, String[].class);
                } else {
                    value = converter.convertIfNecessary(value, String.class);
                }
            }
        } catch (TypeMismatchException e) {
            throw new IllegalArgumentException(e.getMessage(), e);
        }
    }

    return value;
}

From source file:com.zhucode.web.quick.argresolver.ParaHandlerMethodArgumentResolver.java

@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
        NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
    Para p = parameter.getParameterAnnotation(Para.class);
    Object val = webRequest.getParameter(p.name());
    if (!p.required()) {
        if (val == null) {
            val = p.defaultValue();
        }/*www .  ja v  a 2  s .c  o  m*/
    }
    if (ValueConstants.DEFAULT_NONE.equals(val)) {
        return null;
    }
    try {
        return converter.convertIfNecessary(val, parameter.getParameterType());
    } catch (TypeMismatchException e) {
        throw new ParamErrorexception(p.name(), e.getMessage());
    }
}

From source file:org.openmrs.module.radiology.web.controller.PortletsController.java

/**
 * Handle all exceptions of type TypeMismatchException which occur in this class
 * //from  w  ww.j a  va2 s.c  o  m
 * @param TypeMismatchException the thrown TypeMismatchException
 * @return model and view with exception information
 * @should populate model with exception text from message properties and invalid value if date
 *         is expected but nut passed
 * @should should populate model with exception text
 */
@ExceptionHandler(TypeMismatchException.class)
public ModelAndView handleTypeMismatchException(TypeMismatchException ex) {

    log.error(ex.getMessage());
    ModelAndView mav = new ModelAndView();

    if (ex.getRequiredType().equals(Date.class)) {
        mav.addObject("invalidValue", ex.getValue());
        mav.addObject("exceptionText", "typeMismatch.java.util.Date");
    } else {
        mav.addObject("exceptionText", ex.getMessage());
    }

    return mav;
}

From source file:net.sf.juffrou.reflect.spring.BeanWrapperGenericsTests.java

@Test
public void testGenericSetWithConversionFailure() {
    GenericBean<?> gb = new GenericBean<Object>();
    BeanWrapper bw = new JuffrouSpringBeanWrapper(gb);
    Set<TestBean> input = new HashSet<TestBean>();
    input.add(new TestBean());
    try {/*from  ww w . j a  va 2  s  .  c  o m*/
        bw.setPropertyValue("integerSet", input);
        fail("Should have thrown TypeMismatchException");
    } catch (TypeMismatchException ex) {
        assertTrue(ex.getMessage().indexOf("java.lang.Integer") != -1);
    }
}

From source file:com.fengduo.bee.commons.component.FormModelMethodArgumentResolver.java

/**
 * {@inheritDoc}/*from w w  w.j  av a2  s . c o  m*/
 * <p>
 * Downcast {@link org.springframework.web.bind.WebDataBinder} to
 * {@link org.springframework.web.bind.ServletRequestDataBinder} before binding.
 * 
 * @throws Exception
 * @see org.springframework.web.servlet.mvc.method.annotation.ServletRequestDataBinderFactory
 */
protected void bindRequestParameters(ModelAndViewContainer mavContainer, WebDataBinderFactory binderFactory,
        WebDataBinder binder, NativeWebRequest request, MethodParameter parameter) throws Exception {

    // Map<String, Boolean> hasProcessedPrefixMap = new HashMap<String, Boolean>();
    //
    // Class<?> targetType = binder.getTarget().getClass();
    // WebDataBinder simpleBinder = binderFactory.createBinder(request, null, null);
    Collection target = (Collection) binder.getTarget();

    Class<?>[] paramTypes = parameter.getMethod().getParameterTypes();
    Method method = parameter.getMethod();
    Object[] args = new Object[paramTypes.length];
    Map<String, Object> argMap = new HashMap<String, Object>(args.length);
    MapBindingResult errors = new MapBindingResult(argMap, "");
    ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();

    for (int i = 0; i < paramTypes.length; i++) {
        Class<?> paramType = paramTypes[i];

        MethodParameter methodParam = new MethodParameter(method, i);
        methodParam.initParameterNameDiscovery(parameterNameDiscoverer);
        String paramName = methodParam.getParameterName();
        // ??
        if (BeanUtils.isSimpleProperty(paramType)) {
            SimpleTypeConverter converter = new SimpleTypeConverter();
            Object value;
            // ?
            if (paramType.isArray()) {
                value = request.getParameterValues(paramName);
            } else {
                value = request.getParameter(paramName);
            }
            try {
                args[i] = converter.convertIfNecessary(value, paramType, methodParam);
            } catch (TypeMismatchException e) {
                errors.addError(new FieldError(paramName, paramName, e.getMessage()));
            }
        } else {
            // ???POJO
            if (paramType.isArray()) {
                ObjectArrayDataBinder binders = new ObjectArrayDataBinder(paramType.getComponentType(),
                        paramName);
                target.addAll(ArrayUtils.arrayConvert(binders.bind(request)));
            }
        }
    }

    // if (Collection.class.isAssignableFrom(targetType)) {// bind collection or array
    //
    // Type type = parameter.getGenericParameterType();
    // Class<?> componentType = Object.class;
    //
    // Collection target = (Collection) binder.getTarget();
    //
    // List targetList = new ArrayList(target);
    //
    // if (type instanceof ParameterizedType) {
    // componentType = (Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0];
    // }
    //
    // if (parameter.getParameterType().isArray()) {
    // componentType = parameter.getParameterType().getComponentType();
    // }
    //
    // for (Object key : servletRequest.getParameterMap().keySet()) {
    // String prefixName = getPrefixName((String) key);
    //
    // // ?prefix ??
    // if (hasProcessedPrefixMap.containsKey(prefixName)) {
    // continue;
    // } else {
    // hasProcessedPrefixMap.put(prefixName, Boolean.TRUE);
    // }
    //
    // if (isSimpleComponent(prefixName)) { // bind simple type
    // Map<String, Object> paramValues = WebUtils.getParametersStartingWith(servletRequest, prefixName);
    // Matcher matcher = INDEX_PATTERN.matcher(prefixName);
    // if (!matcher.matches()) { // ? array=1&array=2
    // for (Object value : paramValues.values()) {
    // targetList.add(simpleBinder.convertIfNecessary(value, componentType));
    // }
    // } else { // ? array[0]=1&array[1]=2
    // int index = Integer.valueOf(matcher.group(1));
    //
    // if (targetList.size() <= index) {
    // growCollectionIfNecessary(targetList, index);
    // }
    // targetList.set(index, simpleBinder.convertIfNecessary(paramValues.values(), componentType));
    // }
    // } else { // ? votes[1].title=votes[1].title&votes[0].title=votes[0].title&votes[0].id=0&votes[1].id=1
    // Object component = null;
    // // ? ?????
    // Matcher matcher = INDEX_PATTERN.matcher(prefixName);
    // if (!matcher.matches()) {
    // throw new IllegalArgumentException("bind collection error, need integer index, key:" + key);
    // }
    // int index = Integer.valueOf(matcher.group(1));
    // if (targetList.size() <= index) {
    // growCollectionIfNecessary(targetList, index);
    // }
    // Iterator iterator = targetList.iterator();
    // for (int i = 0; i < index; i++) {
    // iterator.next();
    // }
    // component = iterator.next();
    //
    // if (component == null) {
    // component = BeanUtils.instantiate(componentType);
    // }
    //
    // WebDataBinder componentBinder = binderFactory.createBinder(request, component, null);
    // component = componentBinder.getTarget();
    //
    // if (component != null) {
    // ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(
    // servletRequest,
    // prefixName,
    // "");
    // componentBinder.bind(pvs);
    // validateIfApplicable(componentBinder, parameter);
    // if (componentBinder.getBindingResult().hasErrors()) {
    // if (isBindExceptionRequired(componentBinder, parameter)) {
    // throw new BindException(componentBinder.getBindingResult());
    // }
    // }
    // targetList.set(index, component);
    // }
    // }
    // target.clear();
    // target.addAll(targetList);
    // }
    // } else if (MapWapper.class.isAssignableFrom(targetType)) {
    //
    // Type type = parameter.getGenericParameterType();
    // Class<?> keyType = Object.class;
    // Class<?> valueType = Object.class;
    //
    // if (type instanceof ParameterizedType) {
    // keyType = (Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0];
    // valueType = (Class<?>) ((ParameterizedType) type).getActualTypeArguments()[1];
    // }
    //
    // MapWapper mapWapper = ((MapWapper) binder.getTarget());
    // Map target = mapWapper.getInnerMap();
    // if (target == null) {
    // target = new HashMap();
    // mapWapper.setInnerMap(target);
    // }
    //
    // for (Object key : servletRequest.getParameterMap().keySet()) {
    // String prefixName = getPrefixName((String) key);
    //
    // // ?prefix ??
    // if (hasProcessedPrefixMap.containsKey(prefixName)) {
    // continue;
    // } else {
    // hasProcessedPrefixMap.put(prefixName, Boolean.TRUE);
    // }
    //
    // Object keyValue = simpleBinder.convertIfNecessary(getMapKey(prefixName), keyType);
    //
    // if (isSimpleComponent(prefixName)) { // bind simple type
    // Map<String, Object> paramValues = WebUtils.getParametersStartingWith(servletRequest, prefixName);
    //
    // for (Object value : paramValues.values()) {
    // target.put(keyValue, simpleBinder.convertIfNecessary(value, valueType));
    // }
    // } else {
    //
    // Object component = target.get(keyValue);
    // if (component == null) {
    // component = BeanUtils.instantiate(valueType);
    // }
    //
    // WebDataBinder componentBinder = binderFactory.createBinder(request, component, null);
    // component = componentBinder.getTarget();
    //
    // if (component != null) {
    // ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(
    // servletRequest,
    // prefixName,
    // "");
    // componentBinder.bind(pvs);
    //
    // validateComponent(componentBinder, parameter);
    //
    // target.put(keyValue, component);
    // }
    // }
    // }
    // } else {// bind model
    // ServletRequestDataBinder servletBinder = (ServletRequestDataBinder) binder;
    // servletBinder.bind(servletRequest);
    // }
}

From source file:com.ms.commons.summer.web.handler.DataBinderUtil.java

/**
 * ?/*  w  w  w .  java  2s.co m*/
 * 
 * @param method
 * @param model
 * @param request
 * @param response
 * @param c
 * @return
 */
@SuppressWarnings("unchecked")
public static Object[] getArgs(Method method, Map<String, Object> model, HttpServletRequest request,
        HttpServletResponse response, Class<?> c) {
    Class<?>[] paramTypes = method.getParameterTypes();
    Object[] args = new Object[paramTypes.length];
    Map<String, Object> argMap = new HashMap<String, Object>(args.length);
    Map<String, String> pathValues = null;
    PathPattern pathPattern = method.getAnnotation(PathPattern.class);
    if (pathPattern != null) {
        String path = request.getRequestURI();
        int index = path.lastIndexOf('.');
        if (index != -1) {
            path = path.substring(0, index);
            String[] patterns = pathPattern.patterns();
            pathValues = getPathValues(patterns, path);
        }
    }
    MapBindingResult errors = new MapBindingResult(argMap, "");
    ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();
    for (int i = 0; i < paramTypes.length; i++) {
        Class<?> paramType = paramTypes[i];

        MethodParameter methodParam = new MethodParameter(method, i);
        methodParam.initParameterNameDiscovery(parameterNameDiscoverer);
        GenericTypeResolver.resolveParameterType(methodParam, c.getClass());

        String paramName = methodParam.getParameterName();
        // map
        if (Map.class.isAssignableFrom(paramType)) {
            args[i] = model;
        }
        // HttpServletRequest
        else if (HttpServletRequest.class.isAssignableFrom(paramType)) {
            args[i] = request;
        }
        // HttpServletResponse
        else if (HttpServletResponse.class.isAssignableFrom(paramType)) {
            args[i] = response;
        }
        // HttpSession
        else if (HttpSession.class.isAssignableFrom(paramType)) {
            args[i] = request.getSession();
        }
        // Errors
        else if (Errors.class.isAssignableFrom(paramType)) {
            args[i] = errors;
        }
        // MultipartFile
        else if (MultipartFile.class.isAssignableFrom(paramType)) {
            MultipartFile[] files = resolveMultipartFiles(request, errors, paramName);
            if (files != null && files.length > 0) {
                args[i] = files[0];
            }
        }
        // MultipartFile[]
        else if (MultipartFile[].class.isAssignableFrom(paramType)) {
            args[i] = resolveMultipartFiles(request, errors, paramName);
        } else {
            // ??
            if (BeanUtils.isSimpleProperty(paramType)) {
                SimpleTypeConverter converter = new SimpleTypeConverter();
                Object value;
                // ?
                if (paramType.isArray()) {
                    value = request.getParameterValues(paramName);
                } else {
                    Object[] parameterAnnotations = methodParam.getParameterAnnotations();
                    value = null;
                    if (parameterAnnotations != null && parameterAnnotations.length > 0) {
                        if (pathValues != null && pathValues.size() > 0) {
                            for (Object object : parameterAnnotations) {
                                if (PathVariable.class.isInstance(object)) {
                                    PathVariable pv = (PathVariable) object;
                                    if (StringUtils.isEmpty(pv.value())) {
                                        value = pathValues.get(paramName);
                                    } else {
                                        value = pathValues.get(pv.value());
                                    }
                                    break;
                                }
                            }
                        }
                    } else {
                        value = request.getParameter(paramName);
                    }
                }
                try {
                    args[i] = converter.convertIfNecessary(value, paramType, methodParam);
                    model.put(paramName, args[i]);
                } catch (TypeMismatchException e) {
                    errors.addError(new FieldError(paramName, paramName, e.getMessage()));
                }
            } else {
                // ???POJO
                if (paramType.isArray()) {
                    ObjectArrayDataBinder binder = new ObjectArrayDataBinder(paramType.getComponentType(),
                            paramName);
                    args[i] = binder.bind(request);
                    model.put(paramName, args[i]);
                } else {
                    Object bindObject = BeanUtils.instantiateClass(paramType);
                    SummerServletRequestDataBinder binder = new SummerServletRequestDataBinder(bindObject,
                            paramName);
                    binder.bind(request);
                    BindException be = new BindException(binder.getBindingResult());
                    List<FieldError> fieldErrors = be.getFieldErrors();
                    for (FieldError fieldError : fieldErrors) {
                        errors.addError(fieldError);
                    }
                    args[i] = binder.getTarget();
                    model.put(paramName, args[i]);
                }
            }
        }
    }
    return args;
}

From source file:org.jtalks.jcommune.web.exception.PrettyLogExceptionResolverTest.java

@Test
public void testLogExceptionWithIncomingTypeMismatchException() throws Exception {
    Log mockLog = replaceLoggerWithMock(prettyLogExceptionResolver);
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
    TypeMismatchException typeMismatchException = new TypeMismatchException("Not a number", Number.class);
    String logMessage = String.format("[%s][%s][%s][%s]", request.getMethod(),
            request.getRequestURL().toString(), request.getHeader("Cookie"),
            typeMismatchException.getMessage());
    request.setContent("".getBytes());
    prettyLogExceptionResolver.logException(typeMismatchException, request);

    verify(mockLog).info(logMessage);//w w  w . j  a v a 2 s . c  o  m
}

From source file:org.openmrs.module.radiology.order.web.PortletsController.java

/**
 * Handle all exceptions of type TypeMismatchException which occur in this class
 * //from  w w w.  ja va 2  s.c o  m
 * @param typeMismatchException TypeMismatchException the thrown TypeMismatchException
 * @return model and view with exception information
 * @should populate model with exception text from message properties and invalid value if date
 *         is expected but nut passed
 * @should should populate model with exception text
 */
@ExceptionHandler(TypeMismatchException.class)
public ModelAndView handleTypeMismatchException(TypeMismatchException typeMismatchException) {

    log.error(typeMismatchException.getMessage());
    final ModelAndView mav = new ModelAndView();

    if (typeMismatchException.getRequiredType().equals(Date.class)) {
        mav.addObject("invalidValue", typeMismatchException.getValue());
        mav.addObject("exceptionText", "typeMismatch.java.util.Date");
    } else {
        mav.addObject("exceptionText", typeMismatchException.getMessage());
    }

    return mav;
}

From source file:org.springframework.beans.factory.support.ConstructorResolver.java

/**
 * Create an array of arguments to invoke a constructor or factory method,
 * given the resolved constructor argument values.
 *///from   w ww .  j  a  va2s .  c  om
private ArgumentsHolder createArgumentArray(String beanName, RootBeanDefinition mbd,
        @Nullable ConstructorArgumentValues resolvedValues, BeanWrapper bw, Class<?>[] paramTypes,
        @Nullable String[] paramNames, Executable executable, boolean autowiring, boolean fallback)
        throws UnsatisfiedDependencyException {

    TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();
    TypeConverter converter = (customConverter != null ? customConverter : bw);

    ArgumentsHolder args = new ArgumentsHolder(paramTypes.length);
    Set<ConstructorArgumentValues.ValueHolder> usedValueHolders = new HashSet<>(paramTypes.length);
    Set<String> autowiredBeanNames = new LinkedHashSet<>(4);

    for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
        Class<?> paramType = paramTypes[paramIndex];
        String paramName = (paramNames != null ? paramNames[paramIndex] : "");
        // Try to find matching constructor argument value, either indexed or generic.
        ConstructorArgumentValues.ValueHolder valueHolder = null;
        if (resolvedValues != null) {
            valueHolder = resolvedValues.getArgumentValue(paramIndex, paramType, paramName, usedValueHolders);
            // If we couldn't find a direct match and are not supposed to autowire,
            // let's try the next generic, untyped argument value as fallback:
            // it could match after type conversion (for example, String -> int).
            if (valueHolder == null
                    && (!autowiring || paramTypes.length == resolvedValues.getArgumentCount())) {
                valueHolder = resolvedValues.getGenericArgumentValue(null, null, usedValueHolders);
            }
        }
        if (valueHolder != null) {
            // We found a potential match - let's give it a try.
            // Do not consider the same value definition multiple times!
            usedValueHolders.add(valueHolder);
            Object originalValue = valueHolder.getValue();
            Object convertedValue;
            if (valueHolder.isConverted()) {
                convertedValue = valueHolder.getConvertedValue();
                args.preparedArguments[paramIndex] = convertedValue;
            } else {
                MethodParameter methodParam = MethodParameter.forExecutable(executable, paramIndex);
                try {
                    convertedValue = converter.convertIfNecessary(originalValue, paramType, methodParam);
                } catch (TypeMismatchException ex) {
                    throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName,
                            new InjectionPoint(methodParam),
                            "Could not convert argument value of type ["
                                    + ObjectUtils.nullSafeClassName(valueHolder.getValue())
                                    + "] to required type [" + paramType.getName() + "]: " + ex.getMessage());
                }
                Object sourceHolder = valueHolder.getSource();
                if (sourceHolder instanceof ConstructorArgumentValues.ValueHolder) {
                    Object sourceValue = ((ConstructorArgumentValues.ValueHolder) sourceHolder).getValue();
                    args.resolveNecessary = true;
                    args.preparedArguments[paramIndex] = sourceValue;
                }
            }
            args.arguments[paramIndex] = convertedValue;
            args.rawArguments[paramIndex] = originalValue;
        } else {
            MethodParameter methodParam = MethodParameter.forExecutable(executable, paramIndex);
            // No explicit match found: we're either supposed to autowire or
            // have to fail creating an argument array for the given constructor.
            if (!autowiring) {
                throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName,
                        new InjectionPoint(methodParam),
                        "Ambiguous argument values for parameter of type [" + paramType.getName()
                                + "] - did you specify the correct bean references as arguments?");
            }
            try {
                Object autowiredArgument = resolveAutowiredArgument(methodParam, beanName, autowiredBeanNames,
                        converter, fallback);
                args.rawArguments[paramIndex] = autowiredArgument;
                args.arguments[paramIndex] = autowiredArgument;
                args.preparedArguments[paramIndex] = new AutowiredArgumentMarker();
                args.resolveNecessary = true;
            } catch (BeansException ex) {
                throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName,
                        new InjectionPoint(methodParam), ex);
            }
        }
    }

    for (String autowiredBeanName : autowiredBeanNames) {
        this.beanFactory.registerDependentBean(autowiredBeanName, beanName);
        if (logger.isDebugEnabled()) {
            logger.debug("Autowiring by type from bean name '" + beanName + "' via "
                    + (executable instanceof Constructor ? "constructor" : "factory method")
                    + " to bean named '" + autowiredBeanName + "'");
        }
    }

    return args;
}

From source file:org.springframework.beans.factory.support.ConstructorResolver.java

/**
 * Resolve the prepared arguments stored in the given bean definition.
 *///from  ww  w .  ja v  a2  s. com
private Object[] resolvePreparedArguments(String beanName, RootBeanDefinition mbd, BeanWrapper bw,
        Executable executable, Object[] argsToResolve, boolean fallback) {

    TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();
    TypeConverter converter = (customConverter != null ? customConverter : bw);
    BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd,
            converter);
    Class<?>[] paramTypes = executable.getParameterTypes();

    Object[] resolvedArgs = new Object[argsToResolve.length];
    for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
        Object argValue = argsToResolve[argIndex];
        MethodParameter methodParam = MethodParameter.forExecutable(executable, argIndex);
        GenericTypeResolver.resolveParameterType(methodParam, executable.getDeclaringClass());
        if (argValue instanceof AutowiredArgumentMarker) {
            argValue = resolveAutowiredArgument(methodParam, beanName, null, converter, fallback);
        } else if (argValue instanceof BeanMetadataElement) {
            argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
        } else if (argValue instanceof String) {
            argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
        }
        Class<?> paramType = paramTypes[argIndex];
        try {
            resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
        } catch (TypeMismatchException ex) {
            throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName,
                    new InjectionPoint(methodParam),
                    "Could not convert argument value of type [" + ObjectUtils.nullSafeClassName(argValue)
                            + "] to required type [" + paramType.getName() + "]: " + ex.getMessage());
        }
    }
    return resolvedArgs;
}