diff --git a/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java b/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java index dff8bdce9a3..34be5dfa5f7 100644 --- a/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java +++ b/spring-context/src/main/java/org/springframework/validation/BeanPropertyBindingResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -21,7 +21,6 @@ import java.io.Serializable; import org.springframework.beans.BeanWrapper; import org.springframework.beans.ConfigurablePropertyAccessor; import org.springframework.beans.PropertyAccessorFactory; -import org.springframework.util.Assert; /** * Default implementation of the {@link Errors} and {@link BindingResult} @@ -102,7 +101,9 @@ public class BeanPropertyBindingResult extends AbstractPropertyBindingResult imp * @see #getTarget() */ protected BeanWrapper createBeanWrapper() { - Assert.state(this.target != null, "Cannot access properties on null bean instance '" + getObjectName() + "'!"); + if (this.target == null) { + throw new IllegalStateException("Cannot access properties on null bean instance '" + getObjectName() + "'"); + } return PropertyAccessorFactory.forBeanPropertyAccess(this.target); } diff --git a/spring-context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java b/spring-context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java index 8904240cec5..2294c6dad57 100644 --- a/spring-context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java +++ b/spring-context/src/main/java/org/springframework/validation/DirectFieldBindingResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -18,7 +18,6 @@ package org.springframework.validation; import org.springframework.beans.ConfigurablePropertyAccessor; import org.springframework.beans.PropertyAccessorFactory; -import org.springframework.util.Assert; /** * Special implementation of the Errors and BindingResult interfaces, @@ -90,7 +89,9 @@ public class DirectFieldBindingResult extends AbstractPropertyBindingResult { * @see #getTarget() */ protected ConfigurablePropertyAccessor createDirectFieldAccessor() { - Assert.state(this.target != null, "Cannot access fields on null target instance '" + getObjectName() + "'!"); + if (this.target == null) { + throw new IllegalStateException("Cannot access fields on null target instance '" + getObjectName() + "'"); + } return PropertyAccessorFactory.forDirectFieldAccess(this.target); }