Aligned class name quoting with ConversionFailedException

master
Juergen Hoeller 9 years ago
parent 44651fdf7c
commit 7589c1f164
  1. 14
      spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,10 +57,10 @@ public class TypeMismatchException extends PropertyAccessException {
*/ */
public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType, Throwable cause) { public TypeMismatchException(PropertyChangeEvent propertyChangeEvent, Class<?> requiredType, Throwable cause) {
super(propertyChangeEvent, super(propertyChangeEvent,
"Failed to convert property value of type '" + "Failed to convert property value of type [" +
ClassUtils.getDescriptiveType(propertyChangeEvent.getNewValue()) + "'" + ClassUtils.getDescriptiveType(propertyChangeEvent.getNewValue()) + "]" +
(requiredType != null ? (requiredType != null ?
" to required type '" + ClassUtils.getQualifiedName(requiredType) + "'" : "") + " to required type [" + ClassUtils.getQualifiedName(requiredType) + "]" : "") +
(propertyChangeEvent.getPropertyName() != null ? (propertyChangeEvent.getPropertyName() != null ?
" for property '" + propertyChangeEvent.getPropertyName() + "'" : ""), " for property '" + propertyChangeEvent.getPropertyName() + "'" : ""),
cause); cause);
@ -84,8 +84,8 @@ public class TypeMismatchException extends PropertyAccessException {
* @param cause the root cause (may be {@code null}) * @param cause the root cause (may be {@code null})
*/ */
public TypeMismatchException(Object value, Class<?> requiredType, Throwable cause) { public TypeMismatchException(Object value, Class<?> requiredType, Throwable cause) {
super("Failed to convert value of type '" + ClassUtils.getDescriptiveType(value) + "'" + super("Failed to convert value of type [" + ClassUtils.getDescriptiveType(value) + "]" +
(requiredType != null ? " to required type '" + ClassUtils.getQualifiedName(requiredType) + "'" : ""), (requiredType != null ? " to required type [" + ClassUtils.getQualifiedName(requiredType) + "]" : ""),
cause); cause);
this.value = value; this.value = value;
this.requiredType = requiredType; this.requiredType = requiredType;
@ -93,7 +93,7 @@ public class TypeMismatchException extends PropertyAccessException {
/** /**
* Return the offending value (may be {@code null}) * Return the offending value (may be {@code null}).
*/ */
@Override @Override
public Object getValue() { public Object getValue() {

Loading…
Cancel
Save