1818
1919import org .springframework .beans .BeansException ;
2020import org .springframework .util .ClassUtils ;
21+ import org .springframework .util .StringUtils ;
2122
2223/**
2324 * Exception thrown when a bean depends on other beans or simple properties
@@ -46,7 +47,7 @@ public UnsatisfiedDependencyException(
4647
4748 super (resourceDescription , beanName ,
4849 "Unsatisfied dependency expressed through bean property '" + propertyName + "'" +
49- (msg != null ? ": " + msg : "" ));
50+ (StringUtils . hasLength ( msg ) ? ": " + msg : "" ));
5051 }
5152
5253 /**
@@ -59,7 +60,7 @@ public UnsatisfiedDependencyException(
5960 public UnsatisfiedDependencyException (
6061 String resourceDescription , String beanName , String propertyName , BeansException ex ) {
6162
62- this (resourceDescription , beanName , propertyName , ( ex != null ? ex . getMessage () : "" ) );
63+ this (resourceDescription , beanName , propertyName , "" );
6364 initCause (ex );
6465 }
6566
@@ -74,7 +75,9 @@ public UnsatisfiedDependencyException(
7475 public UnsatisfiedDependencyException (
7576 String resourceDescription , String beanName , InjectionPoint injectionPoint , String msg ) {
7677
77- super (resourceDescription , beanName , "Unsatisfied dependency expressed through " + injectionPoint + ": " + msg );
78+ super (resourceDescription , beanName ,
79+ "Unsatisfied dependency expressed through " + injectionPoint +
80+ (StringUtils .hasLength (msg ) ? ": " + msg : "" ));
7881 this .injectionPoint = injectionPoint ;
7982 }
8083
@@ -89,7 +92,7 @@ public UnsatisfiedDependencyException(
8992 public UnsatisfiedDependencyException (
9093 String resourceDescription , String beanName , InjectionPoint injectionPoint , BeansException ex ) {
9194
92- this (resourceDescription , beanName , injectionPoint , ( ex != null ? ex . getMessage () : "" ) );
95+ this (resourceDescription , beanName , injectionPoint , "" );
9396 initCause (ex );
9497 }
9598
0 commit comments