diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java index 11436e4ab4..5b5bfe951b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java @@ -331,7 +331,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp String scopeName = mbd.getScope(); final Scope scope = this.scopes.get(scopeName); if (scope == null) { - throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'"); + throw new IllegalStateException("No Scope registered for scope name '" + scopeName + "'"); } try { Object scopedInstance = scope.get(beanName, new ObjectFactory() { @@ -350,8 +350,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp } catch (IllegalStateException ex) { throw new BeanCreationException(beanName, - "Scope '" + scopeName + "' is not active for the current thread; " + - "consider defining a scoped proxy for this bean if you intend to refer to it from a singleton", + "Scope '" + scopeName + "' is not active for the current thread; consider " + + "defining a scoped proxy for this bean if you intend to refer to it from a singleton", ex); } } @@ -1334,6 +1334,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp private Class doResolveBeanClass(RootBeanDefinition mbd, Class... typesToMatch) throws ClassNotFoundException { if (!ObjectUtils.isEmpty(typesToMatch)) { + // When just doing type checks (i.e. not creating an actual instance yet), + // use the specified temporary class loader (e.g. in a weaving scenario). ClassLoader tempClassLoader = getTempClassLoader(); if (tempClassLoader != null) { if (tempClassLoader instanceof DecoratingClassLoader) { diff --git a/spring-core/src/main/java/org/springframework/core/convert/ConversionFailedException.java b/spring-core/src/main/java/org/springframework/core/convert/ConversionFailedException.java index 63f4678f58..2d2ddd2a4e 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/ConversionFailedException.java +++ b/spring-core/src/main/java/org/springframework/core/convert/ConversionFailedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,8 @@ public final class ConversionFailedException extends ConversionException { * @param cause the cause of the conversion failure */ public ConversionFailedException(TypeDescriptor sourceType, TypeDescriptor targetType, Object value, Throwable cause) { - super("Failed to convert from type " + sourceType + " to type " + targetType + " for value '" + ObjectUtils.nullSafeToString(value) + "'", cause); + super("Failed to convert from type [" + sourceType + "] to type [" + targetType + + "] for value '" + ObjectUtils.nullSafeToString(value) + "'", cause); this.sourceType = sourceType; this.targetType = targetType; this.value = value; diff --git a/spring-core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java b/spring-core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java index ec966b708b..4a918bccad 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java +++ b/spring-core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,11 @@ package org.springframework.core.convert; /** - * Thrown when a suitable converter could not be found in a conversion service. + * Exception to be thrown when a suitable converter could not be found + * in a given conversion service. * * @author Keith Donald + * @author Juergen Hoeller * @since 3.0 */ @SuppressWarnings("serial") @@ -36,21 +38,21 @@ public final class ConverterNotFoundException extends ConversionException { * @param targetType the target type requested to convert to */ public ConverterNotFoundException(TypeDescriptor sourceType, TypeDescriptor targetType) { - super("No converter found capable of converting from type " + sourceType + " to type " + targetType); + super("No converter found capable of converting from type [" + sourceType + "] to type [" + targetType + "]"); this.sourceType = sourceType; this.targetType = targetType; } /** - * Returns the source type that was requested to convert from. + * Return the source type that was requested to convert from. */ public TypeDescriptor getSourceType() { return this.sourceType; } /** - * Returns the target type that was requested to convert to. + * Return the target type that was requested to convert to. */ public TypeDescriptor getTargetType() { return this.targetType;