From d9f09e46f87c4ec2a554a781a876544c6b911cc8 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 12 Aug 2015 11:12:42 +0200 Subject: [PATCH] Cherry-pick 398d06e Fixed initially in #3725 The target attribute is effectively checked for null beforehand so this additional defensive check can be removed. Closes gh-4567 --- .../ConfigurationPropertiesBindingPostProcessor.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 0d26c20cc76..f8cb636f4e2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -297,10 +297,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc factory.bindPropertiesToTarget(); } catch (Exception ex) { - String targetClass = "[unknown]"; - if (target != null) { - ClassUtils.getShortName(target.getClass()); - } + String targetClass = ClassUtils.getShortName(target.getClass()); throw new BeanCreationException(beanName, "Could not bind properties to " + targetClass + " (" + getAnnotationDetails(annotation) + ")", ex); }