Fixed isMatchingFieldError to properly handle empty field name
Issue: SPR-11374
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user