GH-9620: Use Locale.ROOT for neutral, case insensitive comparisons
Fixes: #9620
Issue link: https://github.com/spring-projects/spring-integration/issues/9620
(cherry picked from commit 0d2595ef7c)
This commit is contained in:
committed by
Spring Builds
parent
4ffc6641b7
commit
5c76a47e55
@@ -18,6 +18,7 @@ package org.springframework.integration.mail;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -79,7 +80,7 @@ public class ImapMailReceiver extends AbstractMailReceiver {
|
||||
public ImapMailReceiver(String url) {
|
||||
super(url);
|
||||
if (url != null) {
|
||||
Assert.isTrue(url.toLowerCase().startsWith(PROTOCOL),
|
||||
Assert.isTrue(url.toLowerCase(Locale.ROOT).startsWith(PROTOCOL),
|
||||
"URL must start with 'imap' for the IMAP Mail receiver.");
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import jakarta.mail.Authenticator;
|
||||
@@ -162,8 +163,8 @@ public class MailReceiverFactoryBean extends AbstractFactoryBean<MailReceiver> {
|
||||
|
||||
private MailReceiver createReceiver() { // NOSONAR
|
||||
verifyProtocol();
|
||||
boolean isPop3 = this.protocol.toLowerCase().startsWith("pop3");
|
||||
boolean isImap = this.protocol.toLowerCase().startsWith("imap");
|
||||
boolean isPop3 = this.protocol.toLowerCase(Locale.ROOT).startsWith("pop3");
|
||||
boolean isImap = this.protocol.toLowerCase(Locale.ROOT).startsWith("imap");
|
||||
Assert.isTrue(isPop3 || isImap, "the store URI must begin with 'pop3' or 'imap'");
|
||||
AbstractMailReceiver mailReceiver = isPop3
|
||||
? new Pop3MailReceiver(this.storeUri)
|
||||
|
||||
Reference in New Issue
Block a user