Skip to content

Commit b7aafda

Browse files
committed
Polishing
1 parent a89a88d commit b7aafda

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AspectJExpressionPointcutTests {
6060

6161

6262
@BeforeEach
63-
public void setup() throws NoSuchMethodException {
63+
void setup() throws NoSuchMethodException {
6464
getAge = TestBean.class.getMethod("getAge");
6565
setAge = TestBean.class.getMethod("setAge", int.class);
6666
setSomeNumber = TestBean.class.getMethod("setSomeNumber", Number.class);
@@ -193,7 +193,7 @@ void testFriendlyErrorOnNoLocation3ArgMatching() {
193193

194194

195195
@Test
196-
void testMatchWithArgs() throws Exception {
196+
void testMatchWithArgs() {
197197
String expression = "execution(void org.springframework.beans.testfixture.beans.TestBean.setSomeNumber(Number)) && args(Double)";
198198

199199
Pointcut pointcut = getPointcut(expression);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static boolean isEmpty(@Nullable Object str) {
123123
* @see #hasText(CharSequence)
124124
*/
125125
public static boolean hasLength(@Nullable CharSequence str) {
126-
return (str != null && str.length() > 0);
126+
return (str != null && !str.isEmpty()); // as of JDK 15
127127
}
128128

129129
/**
@@ -853,7 +853,7 @@ public static Locale parseLocale(String localeValue) {
853853
if (!localeValue.contains("_") && !localeValue.contains(" ")) {
854854
validateLocalePart(localeValue);
855855
Locale resolved = Locale.forLanguageTag(localeValue);
856-
if (resolved.getLanguage().length() > 0) {
856+
if (!resolved.getLanguage().isEmpty()) {
857857
return resolved;
858858
}
859859
}
@@ -1182,7 +1182,7 @@ public static String[] tokenizeToStringArray(
11821182
if (trimTokens) {
11831183
token = token.trim();
11841184
}
1185-
if (!ignoreEmptyTokens || token.length() > 0) {
1185+
if (!ignoreEmptyTokens || !token.isEmpty()) {
11861186
tokens.add(token);
11871187
}
11881188
}
@@ -1244,7 +1244,7 @@ public static String[] delimitedListToStringArray(
12441244
result.add(deleteAny(str.substring(pos, delPos), charsToDelete));
12451245
pos = delPos + delimiter.length();
12461246
}
1247-
if (str.length() > 0 && pos <= str.length()) {
1247+
if (!str.isEmpty() && pos <= str.length()) {
12481248
// Add rest of String, but not in case of empty input.
12491249
result.add(deleteAny(str.substring(pos), charsToDelete));
12501250
}

0 commit comments

Comments
 (0)