Skip to content

Commit 6151be4

Browse files
committed
Ensure getField(String) wildcard support with SF 6.1+
Closes gh-1814
1 parent 6b5200f commit 6151be4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-webflow/src/main/java/org/springframework/webflow/mvc/view/BindingModel.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2004-2012 the original author or authors.
2+
* Copyright 2004-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737
import org.springframework.binding.message.MessageCriteria;
3838
import org.springframework.binding.message.Severity;
3939
import org.springframework.core.convert.TypeDescriptor;
40+
import org.springframework.lang.Nullable;
4041
import org.springframework.util.Assert;
4142
import org.springframework.validation.AbstractErrors;
4243
import org.springframework.validation.BindingResult;
@@ -127,6 +128,12 @@ public List<FieldError> getFieldErrors(String field) {
127128
return toErrors(messageContext.getMessagesByCriteria(messageCriteria), FIELD_ERRORS);
128129
}
129130

131+
// Override to ensure use of overridden getFieldErrors(String)
132+
public FieldError getFieldError(String field) {
133+
List<FieldError> fieldErrors = getFieldErrors(field);
134+
return (!fieldErrors.isEmpty() ? fieldErrors.get(0) : null);
135+
}
136+
130137
public Class<?> getFieldType(String field) {
131138
return parseFieldExpression(fixedField(field), false).getValueType(boundObject);
132139
}

0 commit comments

Comments
 (0)