From 3ffbb2421143b5192065e03e370b76ab2202c584 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 30 Jan 2014 12:26:22 +0100 Subject: [PATCH] Fixed isMatchingFieldError to properly handle empty field name Issue: SPR-11374 --- .../java/org/springframework/validation/AbstractErrors.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java b/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java index b85e176c7a..2ee871d91f 100644 --- a/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java +++ b/spring-context/src/main/java/org/springframework/validation/AbstractErrors.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -209,6 +209,9 @@ public abstract class AbstractErrors implements Errors, Serializable { if (field.equals(fieldError.getField())) { return true; } + if (field.equals("")) { + return false; + } // Optimization: use charAt instead of endsWith (SPR-11304) int endIndex = field.length() - 1; return (field.charAt(endIndex) == '*' && fieldError.getField().startsWith(field.substring(0, endIndex)));