This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 060f361374e952b67763f1aac474268e19469e63 Author: Mark Thomas <[email protected]> AuthorDate: Fri Oct 23 11:36:50 2026 +0100 Fix more backports --- .../apache/catalina/tribes/transport/nio/ParallelNioSender.java | 3 ++- java/org/apache/catalina/tribes/transport/nio/TlsChannel.java | 7 ++----- java/org/apache/tomcat/jni/SSLContext.java | 4 ---- java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java | 3 ++- .../apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java | 9 +++++---- .../org/apache/catalina/tribes/transport/nio/TestTlsChannel.java | 5 +++-- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java b/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java index 42f77af011..719798bf2e 100644 --- a/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java +++ b/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java @@ -22,6 +22,7 @@ import java.net.UnknownHostException; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -191,7 +192,7 @@ public class ParallelNioSender extends AbstractSender implements MultiPointSende sendSecure(member, data, waitForAck, deadline); return null; }); - sends.add(Map.entry(member, send)); + sends.add(new AbstractMap.SimpleEntry<>(member, send)); } for (Map.Entry<Member,Future<Void>> entry : sends) { try { diff --git a/java/org/apache/catalina/tribes/transport/nio/TlsChannel.java b/java/org/apache/catalina/tribes/transport/nio/TlsChannel.java index 8fb323d565..b5fd79b9cb 100644 --- a/java/org/apache/catalina/tribes/transport/nio/TlsChannel.java +++ b/java/org/apache/catalina/tribes/transport/nio/TlsChannel.java @@ -81,8 +81,7 @@ final class TlsChannel implements ByteChannel { status = result.getHandshakeStatus(); continue; } - case NEED_UNWRAP: - case NEED_UNWRAP_AGAIN: { + case NEED_UNWRAP: { status = unwrapHandshake(); continue; } @@ -145,9 +144,7 @@ final class TlsChannel implements ByteChannel { private HandshakeStatus unwrapHandshake() throws IOException { while (true) { - HandshakeStatus handshakeStatus = engine.getHandshakeStatus(); - if (networkInput.position() == 0 && handshakeStatus != HandshakeStatus.NEED_UNWRAP_AGAIN && - readEncrypted() < 0) { + if (networkInput.position() == 0 && readEncrypted() < 0) { throw new EOFException(); } networkInput.flip(); diff --git a/java/org/apache/tomcat/jni/SSLContext.java b/java/org/apache/tomcat/jni/SSLContext.java index cfdde81949..9ef2461477 100644 --- a/java/org/apache/tomcat/jni/SSLContext.java +++ b/java/org/apache/tomcat/jni/SSLContext.java @@ -183,7 +183,6 @@ public final class SSLContext { public static native String[] getCiphers(long ctx); /** -<<<<<<< HEAD * Sets the "quiet shutdown" flag for <b>ctx</b> to be <b>mode</b>. SSL objects created from <b>ctx</b> inherit the * <b>mode</b> valid at the time and may be 0 or 1. <br> * Normally when an SSL connection is finished, the parties must send out "close notify" alert messages using @@ -206,9 +205,6 @@ public final class SSLContext { /** * Set the TLSv1.2 and below ciphers available for negotiation in the TLS handshake. -======= - * Set the TLSv1.2 and below ciphers available for negotiation the in TLS handshake. ->>>>>>> 5a9393394b (Align with Tomcat Native 1.2.x) * <p> * This complex directive uses a colon-separated cipher-spec string consisting of OpenSSL cipher specifications to * configure the ciphers the client is permitted to negotiate in the TLS handshake phase. diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java index 8feb965b19..d39f706489 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -31,8 +31,9 @@ import java.util.Arrays; import java.util.Base64; import java.util.Iterator; import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + import javax.net.ssl.KeyManager; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; diff --git a/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java b/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java index 6b4b84da75..dbe06b3db4 100644 --- a/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java +++ b/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java @@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Iterator; import java.util.Map.Entry; +import java.util.NoSuchElementException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -150,7 +151,7 @@ public class TestAbstractReplicatedMap { public void testPingDoesNotRemoveRefreshedMember() throws Exception { Member member = new MemberImpl("localhost", 4014, -1); - LazyReplicatedMap<String,String> map = new LazyReplicatedMap<>((key, value) -> { + LazyReplicatedMap<String,String> map = new LazyReplicatedMap<String,String>((key, value) -> { // Not made primary here }, new TestChannel(), 1000, "TestAbstractReplicatedMap", null) { @@ -210,7 +211,7 @@ public class TestAbstractReplicatedMap { AtomicInteger published = new AtomicInteger(); Member backup = new MemberImpl("localhost", 4015, -1); - LazyReplicatedMap<String,String> map = new LazyReplicatedMap<>((key, value) -> { + LazyReplicatedMap<String,String> map = new LazyReplicatedMap<String,String>((key, value) -> { // Not made primary here }, new TestChannel(), 1000, "TestAbstractReplicatedMap", null) { @@ -335,8 +336,8 @@ public class TestAbstractReplicatedMap { MapMessage replyMessage = (MapMessage) reply.get(); @SuppressWarnings("unchecked") ArrayList<MapMessage> state = (ArrayList<MapMessage>) replyMessage.getValue(); - MapMessage secondMessage = - state.stream().filter(message -> second.getKey().equals(message.getKey())).findFirst().orElseThrow(); + MapMessage secondMessage = state.stream().filter(message -> second.getKey().equals(message.getKey())) + .findFirst().orElseThrow(NoSuchElementException::new); Assert.assertEquals(originalSecondValue, secondMessage.getValue()); } diff --git a/test/org/apache/catalina/tribes/transport/nio/TestTlsChannel.java b/test/org/apache/catalina/tribes/transport/nio/TestTlsChannel.java index 50e0290f5f..dd1946e7d8 100644 --- a/test/org/apache/catalina/tribes/transport/nio/TestTlsChannel.java +++ b/test/org/apache/catalina/tribes/transport/nio/TestTlsChannel.java @@ -50,8 +50,7 @@ public class TestTlsChannel { } private static void doTestPskRoundTrip(TribesSslContext context, String protocol) throws Exception { - try (context; - ServerSocketChannel server = ServerSocketChannel.open()) { + try (ServerSocketChannel server = ServerSocketChannel.open()) { server.bind(new InetSocketAddress("localhost", 0)); FutureTask<Void> serverTask = new FutureTask<>(() -> { SSLEngine engine = context.createServerEngine(); @@ -81,6 +80,8 @@ public class TestTlsChannel { } throw e; } + } finally { + context.close(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
