From 398d06e326b8e00897a4cb0ccaf9c89a217f1260 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 12 Aug 2015 11:12:42 +0200 Subject: [PATCH] Remove useless code The target attribute is effectively checked for null beforehand so this additional defensive check can be removed. Closes gh-3725 --- .../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 f48c24fefb..2fc96302dd 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 @@ -298,10 +298,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); }