Browse Source

Remove useless code

The target attribute is effectively checked for null beforehand so this
additional defensive check can be removed.

Closes gh-3725
pull/3728/merge
Stephane Nicoll 11 years ago
parent
commit
398d06e326
  1. 5
      spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java

5
spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java

@ -298,10 +298,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
factory.bindPropertiesToTarget(); factory.bindPropertiesToTarget();
} }
catch (Exception ex) { catch (Exception ex) {
String targetClass = "[unknown]"; String targetClass = ClassUtils.getShortName(target.getClass());
if (target != null) {
ClassUtils.getShortName(target.getClass());
}
throw new BeanCreationException(beanName, "Could not bind properties to " throw new BeanCreationException(beanName, "Could not bind properties to "
+ targetClass + " (" + getAnnotationDetails(annotation) + ")", ex); + targetClass + " (" + getAnnotationDetails(annotation) + ")", ex);
} }

Loading…
Cancel
Save