Merge branch '5.3.x'

This commit is contained in:
Sam Brannen 2022-03-15 17:13:10 +01:00
commit 1392b0f557
3 changed files with 12 additions and 10 deletions

View File

@ -508,7 +508,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
} }
if (this.externallyManagedInitMethods != null) { if (this.externallyManagedInitMethods != null) {
for (String candidate : this.externallyManagedInitMethods) { for (String candidate : this.externallyManagedInitMethods) {
int indexOfDot = candidate.lastIndexOf("."); int indexOfDot = candidate.lastIndexOf('.');
if (indexOfDot >= 0) { if (indexOfDot >= 0) {
String methodName = candidate.substring(indexOfDot + 1); String methodName = candidate.substring(indexOfDot + 1);
if (methodName.equals(initMethod)) { if (methodName.equals(initMethod)) {
@ -585,7 +585,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
} }
if (this.externallyManagedDestroyMethods != null) { if (this.externallyManagedDestroyMethods != null) {
for (String candidate : this.externallyManagedDestroyMethods) { for (String candidate : this.externallyManagedDestroyMethods) {
int indexOfDot = candidate.lastIndexOf("."); int indexOfDot = candidate.lastIndexOf('.');
if (indexOfDot >= 0) { if (indexOfDot >= 0) {
String methodName = candidate.substring(indexOfDot + 1); String methodName = candidate.substring(indexOfDot + 1);
if (methodName.equals(destroyMethod)) { if (methodName.equals(destroyMethod)) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2021 the original author or authors. * Copyright 2002-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -65,6 +65,8 @@ public abstract class StringUtils {
private static final String FOLDER_SEPARATOR = "/"; private static final String FOLDER_SEPARATOR = "/";
private static final char FOLDER_SEPARATOR_CHAR = '/';
private static final String WINDOWS_FOLDER_SEPARATOR = "\\"; private static final String WINDOWS_FOLDER_SEPARATOR = "\\";
private static final String TOP_PATH = ".."; private static final String TOP_PATH = "..";
@ -568,7 +570,7 @@ public abstract class StringUtils {
return null; return null;
} }
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR_CHAR);
return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path); return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path);
} }
@ -589,7 +591,7 @@ public abstract class StringUtils {
return null; return null;
} }
int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR); int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR_CHAR);
if (folderIndex > extIndex) { if (folderIndex > extIndex) {
return null; return null;
} }
@ -609,7 +611,7 @@ public abstract class StringUtils {
return path; return path;
} }
int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR); int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR_CHAR);
if (folderIndex > extIndex) { if (folderIndex > extIndex) {
return path; return path;
} }
@ -626,11 +628,11 @@ public abstract class StringUtils {
* @return the full file path that results from applying the relative path * @return the full file path that results from applying the relative path
*/ */
public static String applyRelativePath(String path, String relativePath) { public static String applyRelativePath(String path, String relativePath) {
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR_CHAR);
if (separatorIndex != -1) { if (separatorIndex != -1) {
String newPath = path.substring(0, separatorIndex); String newPath = path.substring(0, separatorIndex);
if (!relativePath.startsWith(FOLDER_SEPARATOR)) { if (!relativePath.startsWith(FOLDER_SEPARATOR)) {
newPath += FOLDER_SEPARATOR; newPath += FOLDER_SEPARATOR_CHAR;
} }
return newPath + relativePath; return newPath + relativePath;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -135,7 +135,7 @@ public abstract class AbstractHtmlElementTagTests extends AbstractTagTests {
} }
protected final void assertBlockTagContains(String output, String desiredContents) { protected final void assertBlockTagContains(String output, String desiredContents) {
String contents = output.substring(output.indexOf(">") + 1, output.lastIndexOf("<")); String contents = output.substring(output.indexOf(">") + 1, output.lastIndexOf('<'));
assertThat(contents.contains(desiredContents)).as("Expected to find '" + desiredContents + "' in the contents of block tag '" + output + "'").isTrue(); assertThat(contents.contains(desiredContents)).as("Expected to find '" + desiredContents + "' in the contents of block tag '" + output + "'").isTrue();
} }