Skip to content

Commit b0b59d0

Browse files
Fix test post spring-projectsgh-34801 cherry-pick
1 parent 1fd11b6 commit b0b59d0

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

spring-context/src/main/java/org/springframework/validation/DataBinder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ protected AbstractPropertyBindingResult createBeanPropertyBindingResult() {
293293
public void initDirectFieldAccess() {
294294
Assert.state(this.bindingResult == null,
295295
"DataBinder is already initialized - call initDirectFieldAccess before other configuration methods");
296-
this.directFieldAccess = true;
296+
this.bindingResult = createDirectFieldBindingResult();
297297
}
298298

299299
/**
@@ -585,7 +585,7 @@ public void setValidator(Validator validator) {
585585
this.validators.clear();
586586
this.validators.add(validator);
587587
}
588-
}
588+
589589

590590
private void assertValidators(Validator... validators) {
591591
Assert.notNull(validators, "Validators required");

spring-core/src/main/java/org/springframework/util/PatternMatchUtils.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.util;
1818

19-
import org.springframework.lang.Nullable;
2019

2120
/**
2221
* Utility methods for simple pattern matching, in particular for
@@ -35,18 +34,18 @@ public abstract class PatternMatchUtils {
3534
* @param str the String to match
3635
* @return whether the String matches the given pattern
3736
*/
38-
public static boolean simpleMatch(@Nullable String pattern, @Nullable String str) {
37+
public static boolean simpleMatch(String pattern, String str) {
3938
return simpleMatch(pattern, str, false);
4039
}
4140

4241
/**
4342
* Variant of {@link #simpleMatch(String, String)} that ignores upper/lower case.
4443
*/
45-
public static boolean simpleMatchIgnoreCase(@Nullable String pattern, @Nullable String str) {
44+
public static boolean simpleMatchIgnoreCase(String pattern, String str) {
4645
return simpleMatch(pattern, str, true);
4746
}
4847

49-
private static boolean simpleMatch(@Nullable String pattern, @Nullable String str, boolean ignoreCase) {
48+
private static boolean simpleMatch( String pattern, String str, boolean ignoreCase) {
5049
if (pattern == null || str == null) {
5150
return false;
5251
}
@@ -109,7 +108,7 @@ private static int indexOf(String str, String otherStr, int startIndex, boolean
109108
* @param str the String to match
110109
* @return whether the String matches any of the given patterns
111110
*/
112-
public static boolean simpleMatch(@Nullable String[] patterns, String str) {
111+
public static boolean simpleMatch(String[] patterns, String str) {
113112
if (patterns != null) {
114113
for (String pattern : patterns) {
115114
if (simpleMatch(pattern, str)) {
@@ -123,7 +122,7 @@ public static boolean simpleMatch(@Nullable String[] patterns, String str) {
123122
/**
124123
* Variant of {@link #simpleMatch(String[], String)} that ignores upper/lower case.
125124
*/
126-
public static boolean simpleMatchIgnoreCase(@Nullable String[] patterns, @Nullable String str) {
125+
public static boolean simpleMatchIgnoreCase(String[] patterns, String str) {
127126
if (patterns != null) {
128127
for (String pattern : patterns) {
129128
if (simpleMatch(pattern, str, true)) {

spring-core/src/test/java/org/springframework/util/PatternMatchUtilsTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class PatternMatchUtilsTests {
2828

2929

3030
@Test
31-
void nullAndEmptyValues() {
31+
public void nullAndEmptyValues() {
3232
assertDoesNotMatch((String) null, null);
3333
assertDoesNotMatch((String) null, "");
3434
assertDoesNotMatch("123", null);
@@ -125,18 +125,18 @@ private void doTest(String pattern, String str, boolean shouldMatch) {
125125
}
126126

127127
private void testMixedCaseMatch(String pattern, String str) {
128-
assertThat(PatternMatchUtils.simpleMatch(pattern, str)).isFalse();
129-
assertThat(PatternMatchUtils.simpleMatchIgnoreCase(pattern, str)).isTrue();
128+
assertFalse(PatternMatchUtils.simpleMatch(pattern, str));
129+
assertTrue(PatternMatchUtils.simpleMatchIgnoreCase(pattern, str));
130130
}
131131

132132
private void assertDoesNotMatch(String pattern, String str) {
133-
assertThat(PatternMatchUtils.simpleMatch(pattern, str)).isFalse();
134-
assertThat(PatternMatchUtils.simpleMatchIgnoreCase(pattern, str)).isFalse();
133+
assertFalse(PatternMatchUtils.simpleMatch(pattern, str));
134+
assertFalse(PatternMatchUtils.simpleMatchIgnoreCase(pattern, str));
135135
}
136136

137137
private void assertDoesNotMatch(String[] patterns, String str) {
138-
assertThat(PatternMatchUtils.simpleMatch(patterns, str)).isFalse();
139-
assertThat(PatternMatchUtils.simpleMatchIgnoreCase(patterns, str)).isFalse();
138+
assertFalse(PatternMatchUtils.simpleMatch(patterns, str));
139+
assertFalse(PatternMatchUtils.simpleMatchIgnoreCase(patterns, str));
140140
}
141141

142142
}

0 commit comments

Comments
 (0)