Efficient checks for empty strings and single character matches
Closes gh-25552 Closes gh-25553
This commit is contained in:
parent
0d4040aa63
commit
04df9b8f49
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -164,10 +164,10 @@ public class ConstructorArgumentValues {
|
||||||
Assert.isTrue(index >= 0, "Index must not be negative");
|
Assert.isTrue(index >= 0, "Index must not be negative");
|
||||||
ValueHolder valueHolder = this.indexedArgumentValues.get(index);
|
ValueHolder valueHolder = this.indexedArgumentValues.get(index);
|
||||||
if (valueHolder != null &&
|
if (valueHolder != null &&
|
||||||
(valueHolder.getType() == null ||
|
(valueHolder.getType() == null || (requiredType != null &&
|
||||||
(requiredType != null && ClassUtils.matchesTypeName(requiredType, valueHolder.getType()))) &&
|
ClassUtils.matchesTypeName(requiredType, valueHolder.getType()))) &&
|
||||||
(valueHolder.getName() == null || "".equals(requiredName) ||
|
(valueHolder.getName() == null || (requiredName != null &&
|
||||||
(requiredName != null && requiredName.equals(valueHolder.getName())))) {
|
(requiredName.isEmpty() || requiredName.equals(valueHolder.getName()))))) {
|
||||||
return valueHolder;
|
return valueHolder;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -277,17 +277,19 @@ public class ConstructorArgumentValues {
|
||||||
* @return the ValueHolder for the argument, or {@code null} if none found
|
* @return the ValueHolder for the argument, or {@code null} if none found
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public ValueHolder getGenericArgumentValue(@Nullable Class<?> requiredType, @Nullable String requiredName, @Nullable Set<ValueHolder> usedValueHolders) {
|
public ValueHolder getGenericArgumentValue(@Nullable Class<?> requiredType, @Nullable String requiredName,
|
||||||
|
@Nullable Set<ValueHolder> usedValueHolders) {
|
||||||
|
|
||||||
for (ValueHolder valueHolder : this.genericArgumentValues) {
|
for (ValueHolder valueHolder : this.genericArgumentValues) {
|
||||||
if (usedValueHolders != null && usedValueHolders.contains(valueHolder)) {
|
if (usedValueHolders != null && usedValueHolders.contains(valueHolder)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (valueHolder.getName() != null && !"".equals(requiredName) &&
|
if (valueHolder.getName() != null && (requiredName == null ||
|
||||||
(requiredName == null || !valueHolder.getName().equals(requiredName))) {
|
(!requiredName.isEmpty() && !requiredName.equals(valueHolder.getName())))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (valueHolder.getType() != null &&
|
if (valueHolder.getType() != null && (requiredType == null ||
|
||||||
(requiredType == null || !ClassUtils.matchesTypeName(requiredType, valueHolder.getType()))) {
|
!ClassUtils.matchesTypeName(requiredType, valueHolder.getType()))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (requiredType != null && valueHolder.getType() == null && valueHolder.getName() == null &&
|
if (requiredType != null && valueHolder.getType() == null && valueHolder.getName() == null &&
|
||||||
|
|
|
@ -446,8 +446,8 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||||
else if (SINGLETON_KEY.equals(property)) {
|
else if (SINGLETON_KEY.equals(property)) {
|
||||||
// Spring 1.2 style
|
// Spring 1.2 style
|
||||||
String val = StringUtils.trimWhitespace((String) entry.getValue());
|
String val = StringUtils.trimWhitespace((String) entry.getValue());
|
||||||
scope = ("".equals(val) || TRUE_VALUE.equals(val) ? BeanDefinition.SCOPE_SINGLETON :
|
scope = (!StringUtils.hasLength(val) || TRUE_VALUE.equals(val) ?
|
||||||
BeanDefinition.SCOPE_PROTOTYPE);
|
BeanDefinition.SCOPE_SINGLETON : BeanDefinition.SCOPE_PROTOTYPE);
|
||||||
}
|
}
|
||||||
else if (LAZY_INIT_KEY.equals(property)) {
|
else if (LAZY_INIT_KEY.equals(property)) {
|
||||||
String val = StringUtils.trimWhitespace((String) entry.getValue());
|
String val = StringUtils.trimWhitespace((String) entry.getValue());
|
||||||
|
|
|
@ -1523,7 +1523,7 @@ public class BeanDefinitionParserDelegate {
|
||||||
* Determine whether the given URI indicates the default namespace.
|
* Determine whether the given URI indicates the default namespace.
|
||||||
*/
|
*/
|
||||||
public boolean isDefaultNamespace(@Nullable String namespaceUri) {
|
public boolean isDefaultNamespace(@Nullable String namespaceUri) {
|
||||||
return (!StringUtils.hasLength(namespaceUri) || BEANS_NAMESPACE_URI.equals(namespaceUri));
|
return !StringUtils.hasLength(namespaceUri) || BEANS_NAMESPACE_URI.equals(namespaceUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1534,7 +1534,7 @@ public class BeanDefinitionParserDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDefaultValue(String value) {
|
private boolean isDefaultValue(String value) {
|
||||||
return (DEFAULT_VALUE.equals(value) || "".equals(value));
|
return !StringUtils.hasLength(value) || DEFAULT_VALUE.equals(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCandidateElement(Node node) {
|
private boolean isCandidateElement(Node node) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -105,7 +105,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||||
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs,
|
public void rejectValue(@Nullable String field, String errorCode, @Nullable Object[] errorArgs,
|
||||||
@Nullable String defaultMessage) {
|
@Nullable String defaultMessage) {
|
||||||
|
|
||||||
if ("".equals(getNestedPath()) && !StringUtils.hasLength(field)) {
|
if (!StringUtils.hasLength(getNestedPath()) && !StringUtils.hasLength(field)) {
|
||||||
// We're at the top of the nested object hierarchy,
|
// We're at the top of the nested object hierarchy,
|
||||||
// so the present level is not a field but rather the top object.
|
// so the present level is not a field but rather the top object.
|
||||||
// The best we can do is register a global error here...
|
// The best we can do is register a global error here...
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -311,7 +311,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Object getRejectedValue(String field, ConstraintViolation<Object> violation, BindingResult bindingResult) {
|
protected Object getRejectedValue(String field, ConstraintViolation<Object> violation, BindingResult bindingResult) {
|
||||||
Object invalidValue = violation.getInvalidValue();
|
Object invalidValue = violation.getInvalidValue();
|
||||||
if (!"".equals(field) && !field.contains("[]") &&
|
if (!field.isEmpty() && !field.contains("[]") &&
|
||||||
(invalidValue == violation.getLeafBean() || field.contains("[") || field.contains("."))) {
|
(invalidValue == violation.getLeafBean() || field.contains("[") || field.contains("."))) {
|
||||||
// Possibly a bean constraint with property path: retrieve the actual property value.
|
// Possibly a bean constraint with property path: retrieve the actual property value.
|
||||||
// However, explicitly avoid this for "address[]" style paths that we can't handle.
|
// However, explicitly avoid this for "address[]" style paths that we can't handle.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -340,7 +340,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
URL url = resourceUrls.nextElement();
|
URL url = resourceUrls.nextElement();
|
||||||
result.add(convertClassLoaderURL(url));
|
result.add(convertClassLoaderURL(url));
|
||||||
}
|
}
|
||||||
if ("".equals(path)) {
|
if (!StringUtils.hasLength(path)) {
|
||||||
// The above result is likely to be incomplete, i.e. only containing file system references.
|
// The above result is likely to be incomplete, i.e. only containing file system references.
|
||||||
// We need to have pointers to each of the jar files on the classpath as well...
|
// We need to have pointers to each of the jar files on the classpath as well...
|
||||||
addAllClassLoaderJarRoots(cl, result);
|
addAllClassLoaderJarRoots(cl, result);
|
||||||
|
@ -639,7 +639,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Looking for matching resources in jar file [" + jarFileUrl + "]");
|
logger.trace("Looking for matching resources in jar file [" + jarFileUrl + "]");
|
||||||
}
|
}
|
||||||
if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
|
if (StringUtils.hasLength(rootEntryPath) && !rootEntryPath.endsWith("/")) {
|
||||||
// Root entry path must end with slash to allow for proper matching.
|
// Root entry path must end with slash to allow for proper matching.
|
||||||
// The Sun JRE does not return a slash here, but BEA JRockit does.
|
// The Sun JRE does not return a slash here, but BEA JRockit does.
|
||||||
rootEntryPath = rootEntryPath + "/";
|
rootEntryPath = rootEntryPath + "/";
|
||||||
|
|
|
@ -331,6 +331,16 @@ public abstract class StringUtils {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if the given {@code String} matches the given single character.
|
||||||
|
* @param str the {@code String} to check
|
||||||
|
* @param singleCharacter the character to compare to
|
||||||
|
* @since 5.2.9
|
||||||
|
*/
|
||||||
|
public static boolean matchesCharacter(@Nullable String str, char singleCharacter) {
|
||||||
|
return (str != null && str.length() == 1 && str.charAt(0) == singleCharacter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given {@code String} starts with the specified prefix,
|
* Test if the given {@code String} starts with the specified prefix,
|
||||||
* ignoring upper/lower case.
|
* ignoring upper/lower case.
|
||||||
|
@ -713,7 +723,7 @@ public abstract class StringUtils {
|
||||||
pathElements.add(0, TOP_PATH);
|
pathElements.add(0, TOP_PATH);
|
||||||
}
|
}
|
||||||
// If nothing else left, at least explicitly point to current path.
|
// If nothing else left, at least explicitly point to current path.
|
||||||
if (pathElements.size() == 1 && "".equals(pathElements.getLast()) && !prefix.endsWith(FOLDER_SEPARATOR)) {
|
if (pathElements.size() == 1 && pathElements.getLast().isEmpty() && !prefix.endsWith(FOLDER_SEPARATOR)) {
|
||||||
pathElements.add(0, CURRENT_PATH);
|
pathElements.add(0, CURRENT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -255,7 +255,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
||||||
else if (DESTINATION_TYPE_TOPIC.equals(destinationType)) {
|
else if (DESTINATION_TYPE_TOPIC.equals(destinationType)) {
|
||||||
pubSubDomain = true;
|
pubSubDomain = true;
|
||||||
}
|
}
|
||||||
else if ("".equals(destinationType) || DESTINATION_TYPE_QUEUE.equals(destinationType)) {
|
else if (!StringUtils.hasLength(destinationType) || DESTINATION_TYPE_QUEUE.equals(destinationType)) {
|
||||||
// the default: queue
|
// the default: queue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -64,10 +64,10 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
||||||
|
|
||||||
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
||||||
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
||||||
if (!"".equals(containerClass)) {
|
if (StringUtils.hasLength(containerClass)) {
|
||||||
return null; // Not supported
|
return null; // not supported
|
||||||
}
|
}
|
||||||
else if ("".equals(containerType) || containerType.startsWith("default")) {
|
else if (!StringUtils.hasLength(containerType) || containerType.startsWith("default")) {
|
||||||
factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory");
|
factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory");
|
||||||
}
|
}
|
||||||
else if (containerType.startsWith("simple")) {
|
else if (containerType.startsWith("simple")) {
|
||||||
|
@ -91,10 +91,10 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
||||||
|
|
||||||
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE);
|
||||||
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE);
|
||||||
if (!"".equals(containerClass)) {
|
if (StringUtils.hasLength(containerClass)) {
|
||||||
containerDef.setBeanClassName(containerClass);
|
containerDef.setBeanClassName(containerClass);
|
||||||
}
|
}
|
||||||
else if ("".equals(containerType) || containerType.startsWith("default")) {
|
else if (!StringUtils.hasLength(containerType) || containerType.startsWith("default")) {
|
||||||
containerDef.setBeanClassName("org.springframework.jms.listener.DefaultMessageListenerContainer");
|
containerDef.setBeanClassName("org.springframework.jms.listener.DefaultMessageListenerContainer");
|
||||||
}
|
}
|
||||||
else if (containerType.startsWith("simple")) {
|
else if (containerType.startsWith("simple")) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -235,7 +235,7 @@ class MergedSqlConfig {
|
||||||
|
|
||||||
private static String getString(AnnotationAttributes attributes, String attributeName, String defaultValue) {
|
private static String getString(AnnotationAttributes attributes, String attributeName, String defaultValue) {
|
||||||
String value = attributes.getString(attributeName);
|
String value = attributes.getString(attributeName);
|
||||||
if ("".equals(value)) {
|
if (value.isEmpty()) {
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DefaultRequestPath implements RequestPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) {
|
private static PathContainer initContextPath(PathContainer path, @Nullable String contextPath) {
|
||||||
if (!StringUtils.hasText(contextPath) || "/".equals(contextPath)) {
|
if (!StringUtils.hasText(contextPath) || StringUtils.matchesCharacter(contextPath, '/')) {
|
||||||
return PathContainer.parsePath("");
|
return PathContainer.parsePath("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class DefaultRequestPath implements RequestPath {
|
||||||
int length = contextPath.length();
|
int length = contextPath.length();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
||||||
for (int i=0; i < path.elements().size(); i++) {
|
for (int i = 0; i < path.elements().size(); i++) {
|
||||||
PathContainer.Element element = path.elements().get(i);
|
PathContainer.Element element = path.elements().get(i);
|
||||||
counter += element.value().length();
|
counter += element.value().length();
|
||||||
if (length == counter) {
|
if (length == counter) {
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class UrlPathHelper {
|
||||||
}
|
}
|
||||||
// Else, use path within current servlet mapping if applicable
|
// Else, use path within current servlet mapping if applicable
|
||||||
String rest = getPathWithinServletMapping(request);
|
String rest = getPathWithinServletMapping(request);
|
||||||
if (!"".equals(rest)) {
|
if (StringUtils.hasLength(rest)) {
|
||||||
return rest;
|
return rest;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -362,7 +362,7 @@ public class UrlPathHelper {
|
||||||
if (contextPath == null) {
|
if (contextPath == null) {
|
||||||
contextPath = request.getContextPath();
|
contextPath = request.getContextPath();
|
||||||
}
|
}
|
||||||
if ("/".equals(contextPath)) {
|
if (StringUtils.matchesCharacter(contextPath, '/')) {
|
||||||
// Invalid case, but happens for includes on Jetty: silently adapt it.
|
// Invalid case, but happens for includes on Jetty: silently adapt it.
|
||||||
contextPath = "";
|
contextPath = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.servlet.HandlerExecutionChain;
|
import org.springframework.web.servlet.HandlerExecutionChain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +128,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
|
||||||
// We need to care for the default handler directly, since we need to
|
// We need to care for the default handler directly, since we need to
|
||||||
// expose the PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE for it as well.
|
// expose the PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE for it as well.
|
||||||
Object rawHandler = null;
|
Object rawHandler = null;
|
||||||
if ("/".equals(lookupPath)) {
|
if (StringUtils.matchesCharacter(lookupPath, '/')) {
|
||||||
rawHandler = getRootHandler();
|
rawHandler = getRootHandler();
|
||||||
}
|
}
|
||||||
if (rawHandler == null) {
|
if (rawHandler == null) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.filter.GenericFilterBean;
|
import org.springframework.web.filter.GenericFilterBean;
|
||||||
import org.springframework.web.util.UrlPathHelper;
|
import org.springframework.web.util.UrlPathHelper;
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
|
||||||
throw new LookupPathIndexException(lookupPath, requestUri);
|
throw new LookupPathIndexException(lookupPath, requestUri);
|
||||||
}
|
}
|
||||||
this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath);
|
this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath);
|
||||||
if ("/".equals(lookupPath) && !"/".equals(requestUri)) {
|
if (StringUtils.matchesCharacter(lookupPath, '/') && !StringUtils.matchesCharacter(requestUri, '/')) {
|
||||||
String contextPath = pathHelper.getContextPath(this);
|
String contextPath = pathHelper.getContextPath(this);
|
||||||
if (requestUri.equals(contextPath)) {
|
if (requestUri.equals(contextPath)) {
|
||||||
this.indexLookupPath = requestUri.length();
|
this.indexLookupPath = requestUri.length();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -260,7 +260,7 @@ public class ErrorsTag extends AbstractHtmlElementBodyTag implements BodyTag {
|
||||||
@Override
|
@Override
|
||||||
protected String autogenerateId() throws JspException {
|
protected String autogenerateId() throws JspException {
|
||||||
String path = getPropertyPath();
|
String path = getPropertyPath();
|
||||||
if ("".equals(path) || "*".equals(path)) {
|
if (!StringUtils.hasLength(path) || "*".equals(path)) {
|
||||||
path = (String) this.pageContext.getAttribute(
|
path = (String) this.pageContext.getAttribute(
|
||||||
FormTag.MODEL_ATTRIBUTE_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
FormTag.MODEL_ATTRIBUTE_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue