Deprecate StringUtils::trimWhitespace and variants

This commits deprecates
- StringUtils::trimWhitespace in favor of String::strip
- StringUtils::trimLeadingWhitespace in favor of String::stripLeading
- StringUtils::trimTrailingWhitespace in favor of String::stripTrailing

Closes gh-27769
This commit is contained in:
Arjen Poutsma
2021-12-06 13:33:30 +01:00
parent 982ba0e86d
commit 81af7330f6
10 changed files with 28 additions and 21 deletions

View File

@@ -145,14 +145,14 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
private void addRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String rollbackForValue) {
String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(rollbackForValue);
for (String typeName : exceptionTypeNames) {
rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(typeName)));
rollbackRules.add(new RollbackRuleAttribute(typeName.strip()));
}
}
private void addNoRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String noRollbackForValue) {
String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(noRollbackForValue);
for (String typeName : exceptionTypeNames) {
rollbackRules.add(new NoRollbackRuleAttribute(StringUtils.trimWhitespace(typeName)));
rollbackRules.add(new NoRollbackRuleAttribute(typeName.strip()));
}
}

View File

@@ -54,7 +54,7 @@ public class TransactionAttributeEditor extends PropertyEditorSupport {
RuleBasedTransactionAttribute attr = new RuleBasedTransactionAttribute();
for (String token : tokens) {
// Trim leading and trailing whitespace.
String trimmedToken = StringUtils.trimWhitespace(token.trim());
String trimmedToken = token.strip();
// Check whether token contains illegal whitespace within text.
if (StringUtils.containsWhitespace(trimmedToken)) {
throw new IllegalArgumentException(