RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/netty#342e6b392cd905be34a8918ca862d2dca9a3dcd8
This commit is contained in:
parent
ea83ac5aa7
commit
72746032b1
2
.gitignore
vendored
2
.gitignore
vendored
@ -0,0 +1,2 @@
|
||||
/netty-*.tar.gz
|
||||
/*.src.rpm
|
633
0001-Remove-optional-dep-Blockhound.patch
Normal file
633
0001-Remove-optional-dep-Blockhound.patch
Normal file
@ -0,0 +1,633 @@
|
||||
From 14fa8d4afda0fa1a31a2591298dc5c18e08dab1f Mon Sep 17 00:00:00 2001
|
||||
From: Mat Booth <mat.booth@redhat.com>
|
||||
Date: Mon, 7 Sep 2020 12:17:31 +0100
|
||||
Subject: [PATCH 1/5] Remove optional dep Blockhound
|
||||
|
||||
---
|
||||
common/pom.xml | 5 -
|
||||
.../java/io/netty/util/internal/Hidden.java | 113 ---------
|
||||
...ockhound.integration.BlockHoundIntegration | 14 -
|
||||
pom.xml | 7 -
|
||||
transport-blockhound-tests/pom.xml | 92 -------
|
||||
.../NettyBlockHoundIntegrationTest.java | 239 ------------------
|
||||
.../netty/util/internal/localhost_server.key | 28 --
|
||||
.../netty/util/internal/localhost_server.pem | 17 --
|
||||
.../io/netty/util/internal/mutual_auth_ca.pem | 19 --
|
||||
9 files changed, 534 deletions(-)
|
||||
delete mode 100644 common/src/main/java/io/netty/util/internal/Hidden.java
|
||||
delete mode 100644 common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
||||
delete mode 100644 transport-blockhound-tests/pom.xml
|
||||
delete mode 100644 transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
||||
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
||||
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
||||
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
||||
|
||||
diff --git a/common/pom.xml b/common/pom.xml
|
||||
index 706279177a..abc73161eb 100644
|
||||
--- a/common/pom.xml
|
||||
+++ b/common/pom.xml
|
||||
@@ -78,11 +78,6 @@
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.projectreactor.tools</groupId>
|
||||
- <artifactId>blockhound</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/Hidden.java b/common/src/main/java/io/netty/util/internal/Hidden.java
|
||||
deleted file mode 100644
|
||||
index 7fd6d08396..0000000000
|
||||
--- a/common/src/main/java/io/netty/util/internal/Hidden.java
|
||||
+++ /dev/null
|
||||
@@ -1,113 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2019 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-
|
||||
-package io.netty.util.internal;
|
||||
-
|
||||
-import io.netty.util.concurrent.FastThreadLocalThread;
|
||||
-import reactor.blockhound.BlockHound;
|
||||
-import reactor.blockhound.integration.BlockHoundIntegration;
|
||||
-
|
||||
-import java.util.function.Function;
|
||||
-import java.util.function.Predicate;
|
||||
-
|
||||
-/**
|
||||
- * Contains classes that must be have public visibility but are not public API.
|
||||
- */
|
||||
-class Hidden {
|
||||
-
|
||||
- /**
|
||||
- * This class integrates Netty with BlockHound.
|
||||
- * <p>
|
||||
- * It is public but only because of the ServiceLoader's limitations
|
||||
- * and SHOULD NOT be considered a public API.
|
||||
- */
|
||||
- @UnstableApi
|
||||
- @SuppressJava6Requirement(reason = "BlockHound is Java 8+, but this class is only loaded by it's SPI")
|
||||
- public static final class NettyBlockHoundIntegration implements BlockHoundIntegration {
|
||||
-
|
||||
- @Override
|
||||
- public void applyTo(BlockHound.Builder builder) {
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.channel.nio.NioEventLoop",
|
||||
- "handleLoopException"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.channel.kqueue.KQueueEventLoop",
|
||||
- "handleLoopException"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.channel.epoll.EpollEventLoop",
|
||||
- "handleLoopException"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.util.HashedWheelTimer$Worker",
|
||||
- "waitForNextTick"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.util.concurrent.SingleThreadEventExecutor",
|
||||
- "confirmShutdown"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.handler.ssl.SslHandler",
|
||||
- "handshake"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.handler.ssl.SslHandler",
|
||||
- "runAllDelegatedTasks"
|
||||
- );
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.util.concurrent.GlobalEventExecutor",
|
||||
- "takeTask");
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.util.concurrent.GlobalEventExecutor",
|
||||
- "addTask");
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.util.concurrent.SingleThreadEventExecutor",
|
||||
- "takeTask");
|
||||
-
|
||||
- builder.allowBlockingCallsInside(
|
||||
- "io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback",
|
||||
- "verify");
|
||||
-
|
||||
- builder.nonBlockingThreadPredicate(new Function<Predicate<Thread>, Predicate<Thread>>() {
|
||||
- @Override
|
||||
- public Predicate<Thread> apply(final Predicate<Thread> p) {
|
||||
- return new Predicate<Thread>() {
|
||||
- @Override
|
||||
- @SuppressJava6Requirement(reason = "Predicate#test")
|
||||
- public boolean test(Thread thread) {
|
||||
- return p.test(thread) || thread instanceof FastThreadLocalThread;
|
||||
- }
|
||||
- };
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public int compareTo(BlockHoundIntegration o) {
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
diff --git a/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration b/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
||||
deleted file mode 100644
|
||||
index 5cf376dd8c..0000000000
|
||||
--- a/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
||||
+++ /dev/null
|
||||
@@ -1,14 +0,0 @@
|
||||
-# Copyright 2019 The Netty Project
|
||||
-#
|
||||
-# The Netty Project licenses this file to you under the Apache License,
|
||||
-# version 2.0 (the "License"); you may not use this file except in compliance
|
||||
-# with the License. You may obtain a copy of the License at:
|
||||
-#
|
||||
-# http://www.apache.org/licenses/LICENSE-2.0
|
||||
-#
|
||||
-# Unless required by applicable law or agreed to in writing, software
|
||||
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
-# License for the specific language governing permissions and limitations
|
||||
-# under the License.
|
||||
-io.netty.util.internal.Hidden$NettyBlockHoundIntegration
|
||||
\ No newline at end of file
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d00e3e88e0..d548aa5513 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -416,7 +416,6 @@
|
||||
<module>testsuite-osgi</module>
|
||||
<module>testsuite-shading</module>
|
||||
<module>testsuite-native-image</module>
|
||||
- <module>transport-blockhound-tests</module>
|
||||
<module>microbench</module>
|
||||
<module>bom</module>
|
||||
</modules>
|
||||
@@ -717,12 +716,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
- <!-- BlockHound integration -->
|
||||
- <dependency>
|
||||
- <groupId>io.projectreactor.tools</groupId>
|
||||
- <artifactId>blockhound</artifactId>
|
||||
- <version>1.0.3.RELEASE</version>
|
||||
- </dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
diff --git a/transport-blockhound-tests/pom.xml b/transport-blockhound-tests/pom.xml
|
||||
deleted file mode 100644
|
||||
index 359accd3c4..0000000000
|
||||
--- a/transport-blockhound-tests/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,92 +0,0 @@
|
||||
-<?xml version="1.0" encoding="UTF-8"?>
|
||||
-<!--
|
||||
- ~ Copyright 2019 The Netty Project
|
||||
- ~
|
||||
- ~ The Netty Project licenses this file to you under the Apache License,
|
||||
- ~ version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- ~ with the License. You may obtain a copy of the License at:
|
||||
- ~
|
||||
- ~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
- ~
|
||||
- ~ Unless required by applicable law or agreed to in writing, software
|
||||
- ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- ~ License for the specific language governing permissions and limitations
|
||||
- ~ under the License.
|
||||
- -->
|
||||
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
-
|
||||
- <modelVersion>4.0.0</modelVersion>
|
||||
- <parent>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-parent</artifactId>
|
||||
- <version>4.1.51.Final</version>
|
||||
- </parent>
|
||||
-
|
||||
- <artifactId>netty-transport-blockhound-tests</artifactId>
|
||||
- <packaging>jar</packaging>
|
||||
- <description>
|
||||
- Tests for the BlockHound integration.
|
||||
- </description>
|
||||
-
|
||||
- <name>Netty/Transport/BlockHound/Tests</name>
|
||||
-
|
||||
- <profiles>
|
||||
- <profile>
|
||||
- <id>java13</id>
|
||||
- <activation>
|
||||
- <jdk>13</jdk>
|
||||
- </activation>
|
||||
- <properties>
|
||||
- <argLine.common>-XX:+AllowRedefinitionToAddDeleteMethods</argLine.common>
|
||||
- </properties>
|
||||
- </profile>
|
||||
- <profile>
|
||||
- <id>java14</id>
|
||||
- <activation>
|
||||
- <jdk>14</jdk>
|
||||
- </activation>
|
||||
- <properties>
|
||||
- <argLine.common>-XX:+AllowRedefinitionToAddDeleteMethods</argLine.common>
|
||||
- </properties>
|
||||
- </profile>
|
||||
- </profiles>
|
||||
-
|
||||
- <properties>
|
||||
- <maven.compiler.source>1.8</maven.compiler.source>
|
||||
- <maven.compiler.target>1.8</maven.compiler.target>
|
||||
- <!-- Needed for SelfSignedCertificate -->
|
||||
- <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
|
||||
- <skipJapicmp>true</skipJapicmp>
|
||||
- </properties>
|
||||
-
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>${project.groupId}</groupId>
|
||||
- <artifactId>netty-transport</artifactId>
|
||||
- <version>${project.version}</version>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>${project.groupId}</groupId>
|
||||
- <artifactId>netty-handler</artifactId>
|
||||
- <version>${project.version}</version>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>${project.groupId}</groupId>
|
||||
- <artifactId>${tcnative.artifactId}</artifactId>
|
||||
- <classifier>${tcnative.classifier}</classifier>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
-
|
||||
- <dependency>
|
||||
- <groupId>org.bouncycastle</groupId>
|
||||
- <artifactId>bcpkix-jdk15on</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.projectreactor.tools</groupId>
|
||||
- <artifactId>blockhound</artifactId>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
-</project>
|
||||
diff --git a/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java b/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
||||
deleted file mode 100644
|
||||
index 58e9284370..0000000000
|
||||
--- a/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
||||
+++ /dev/null
|
||||
@@ -1,239 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2019 The Netty Project
|
||||
-
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
-
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
-
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.util.internal;
|
||||
-
|
||||
-import io.netty.bootstrap.Bootstrap;
|
||||
-import io.netty.bootstrap.ServerBootstrap;
|
||||
-import io.netty.buffer.UnpooledByteBufAllocator;
|
||||
-import io.netty.channel.Channel;
|
||||
-import io.netty.channel.ChannelFuture;
|
||||
-import io.netty.channel.ChannelHandlerContext;
|
||||
-import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
-import io.netty.channel.ChannelInitializer;
|
||||
-import io.netty.channel.EventLoopGroup;
|
||||
-import io.netty.channel.nio.NioEventLoopGroup;
|
||||
-import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
-import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
-import io.netty.handler.ssl.SslContext;
|
||||
-import io.netty.handler.ssl.SslContextBuilder;
|
||||
-import io.netty.handler.ssl.SslHandler;
|
||||
-import io.netty.handler.ssl.SslHandshakeCompletionEvent;
|
||||
-import io.netty.handler.ssl.SslProvider;
|
||||
-import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
||||
-import io.netty.handler.ssl.util.SelfSignedCertificate;
|
||||
-import io.netty.util.ReferenceCountUtil;
|
||||
-import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
-import io.netty.util.concurrent.EventExecutor;
|
||||
-import io.netty.util.concurrent.GlobalEventExecutor;
|
||||
-import io.netty.util.concurrent.ImmediateEventExecutor;
|
||||
-import io.netty.util.concurrent.ImmediateExecutor;
|
||||
-import io.netty.util.concurrent.ScheduledFuture;
|
||||
-import io.netty.util.concurrent.SingleThreadEventExecutor;
|
||||
-import io.netty.util.internal.Hidden.NettyBlockHoundIntegration;
|
||||
-import org.hamcrest.Matchers;
|
||||
-import org.junit.BeforeClass;
|
||||
-import org.junit.Test;
|
||||
-import reactor.blockhound.BlockHound;
|
||||
-import reactor.blockhound.BlockingOperationError;
|
||||
-import reactor.blockhound.integration.BlockHoundIntegration;
|
||||
-
|
||||
-import java.net.InetSocketAddress;
|
||||
-import java.util.ServiceLoader;
|
||||
-import java.util.concurrent.CountDownLatch;
|
||||
-import java.util.concurrent.ExecutionException;
|
||||
-import java.util.concurrent.Executor;
|
||||
-import java.util.concurrent.ExecutorService;
|
||||
-import java.util.concurrent.Executors;
|
||||
-import java.util.concurrent.FutureTask;
|
||||
-import java.util.concurrent.TimeUnit;
|
||||
-
|
||||
-import static org.junit.Assert.assertThat;
|
||||
-import static org.junit.Assert.assertTrue;
|
||||
-import static org.junit.Assert.fail;
|
||||
-
|
||||
-public class NettyBlockHoundIntegrationTest {
|
||||
-
|
||||
- @BeforeClass
|
||||
- public static void setUpClass() {
|
||||
- BlockHound.install();
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testServiceLoader() {
|
||||
- for (BlockHoundIntegration integration : ServiceLoader.load(BlockHoundIntegration.class)) {
|
||||
- if (integration instanceof NettyBlockHoundIntegration) {
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- fail("NettyBlockHoundIntegration cannot be loaded with ServiceLoader");
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testBlockingCallsInNettyThreads() throws Exception {
|
||||
- final FutureTask<Void> future = new FutureTask<>(() -> {
|
||||
- Thread.sleep(0);
|
||||
- return null;
|
||||
- });
|
||||
- GlobalEventExecutor.INSTANCE.execute(future);
|
||||
-
|
||||
- try {
|
||||
- future.get(5, TimeUnit.SECONDS);
|
||||
- fail("Expected an exception due to a blocking call but none was thrown");
|
||||
- } catch (ExecutionException e) {
|
||||
- assertThat(e.getCause(), Matchers.instanceOf(BlockingOperationError.class));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Test(timeout = 5000L)
|
||||
- public void testGlobalEventExecutorTakeTask() throws InterruptedException {
|
||||
- testEventExecutorTakeTask(GlobalEventExecutor.INSTANCE);
|
||||
- }
|
||||
-
|
||||
- @Test(timeout = 5000L)
|
||||
- public void testSingleThreadEventExecutorTakeTask() throws InterruptedException {
|
||||
- SingleThreadEventExecutor executor =
|
||||
- new SingleThreadEventExecutor(null, new DefaultThreadFactory("test"), true) {
|
||||
- @Override
|
||||
- protected void run() {
|
||||
- while (!confirmShutdown()) {
|
||||
- Runnable task = takeTask();
|
||||
- if (task != null) {
|
||||
- task.run();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- };
|
||||
- testEventExecutorTakeTask(executor);
|
||||
- }
|
||||
-
|
||||
- private static void testEventExecutorTakeTask(EventExecutor eventExecutor) throws InterruptedException {
|
||||
- CountDownLatch latch = new CountDownLatch(1);
|
||||
- ScheduledFuture<?> f = eventExecutor.schedule(latch::countDown, 10, TimeUnit.MILLISECONDS);
|
||||
- f.sync();
|
||||
- latch.await();
|
||||
- }
|
||||
-
|
||||
- // Tests copied from io.netty.handler.ssl.SslHandlerTest
|
||||
- @Test
|
||||
- public void testHandshakeWithExecutorThatExecuteDirectory() throws Exception {
|
||||
- testHandshakeWithExecutor(Runnable::run);
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testHandshakeWithImmediateExecutor() throws Exception {
|
||||
- testHandshakeWithExecutor(ImmediateExecutor.INSTANCE);
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testHandshakeWithImmediateEventExecutor() throws Exception {
|
||||
- testHandshakeWithExecutor(ImmediateEventExecutor.INSTANCE);
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testHandshakeWithExecutor() throws Exception {
|
||||
- ExecutorService executorService = Executors.newCachedThreadPool();
|
||||
- try {
|
||||
- testHandshakeWithExecutor(executorService);
|
||||
- } finally {
|
||||
- executorService.shutdown();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Test
|
||||
- public void testTrustManagerVerify() throws Exception {
|
||||
- final SslContext sslClientCtx =
|
||||
- SslContextBuilder.forClient()
|
||||
- .trustManager(ResourcesUtil.getFile(getClass(), "mutual_auth_ca.pem"))
|
||||
- .build();
|
||||
-
|
||||
- final SslContext sslServerCtx =
|
||||
- SslContextBuilder.forServer(ResourcesUtil.getFile(getClass(), "localhost_server.pem"),
|
||||
- ResourcesUtil.getFile(getClass(), "localhost_server.key"),
|
||||
- null)
|
||||
- .build();
|
||||
-
|
||||
- final SslHandler clientSslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
|
||||
- final SslHandler serverSslHandler = sslServerCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
|
||||
-
|
||||
- testHandshake(sslClientCtx, clientSslHandler, serverSslHandler);
|
||||
- }
|
||||
-
|
||||
- private static void testHandshakeWithExecutor(Executor executor) throws Exception {
|
||||
- String tlsVersion = "TLSv1.2";
|
||||
- final SslContext sslClientCtx = SslContextBuilder.forClient()
|
||||
- .trustManager(InsecureTrustManagerFactory.INSTANCE)
|
||||
- .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
|
||||
-
|
||||
- final SelfSignedCertificate cert = new SelfSignedCertificate();
|
||||
- final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
|
||||
- .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
|
||||
-
|
||||
- final SslHandler clientSslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT, executor);
|
||||
- final SslHandler serverSslHandler = sslServerCtx.newHandler(UnpooledByteBufAllocator.DEFAULT, executor);
|
||||
-
|
||||
- testHandshake(sslClientCtx, clientSslHandler, serverSslHandler);
|
||||
- }
|
||||
-
|
||||
- private static void testHandshake(SslContext sslClientCtx, SslHandler clientSslHandler,
|
||||
- SslHandler serverSslHandler) throws Exception {
|
||||
- EventLoopGroup group = new NioEventLoopGroup();
|
||||
- Channel sc = null;
|
||||
- Channel cc = null;
|
||||
- try {
|
||||
- sc = new ServerBootstrap()
|
||||
- .group(group)
|
||||
- .channel(NioServerSocketChannel.class)
|
||||
- .childHandler(serverSslHandler)
|
||||
- .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
||||
-
|
||||
- ChannelFuture future = new Bootstrap()
|
||||
- .group(group)
|
||||
- .channel(NioSocketChannel.class)
|
||||
- .handler(new ChannelInitializer<Channel>() {
|
||||
- @Override
|
||||
- protected void initChannel(Channel ch) {
|
||||
- ch.pipeline()
|
||||
- .addLast(clientSslHandler)
|
||||
- .addLast(new ChannelInboundHandlerAdapter() {
|
||||
-
|
||||
- @Override
|
||||
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||
- if (evt instanceof SslHandshakeCompletionEvent &&
|
||||
- ((SslHandshakeCompletionEvent) evt).cause() != null) {
|
||||
- ((SslHandshakeCompletionEvent) evt).cause().printStackTrace();
|
||||
- }
|
||||
- ctx.fireUserEventTriggered(evt);
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
- }).connect(sc.localAddress());
|
||||
- cc = future.syncUninterruptibly().channel();
|
||||
-
|
||||
- assertTrue(clientSslHandler.handshakeFuture().await().isSuccess());
|
||||
- assertTrue(serverSslHandler.handshakeFuture().await().isSuccess());
|
||||
- } finally {
|
||||
- if (cc != null) {
|
||||
- cc.close().syncUninterruptibly();
|
||||
- }
|
||||
- if (sc != null) {
|
||||
- sc.close().syncUninterruptibly();
|
||||
- }
|
||||
- group.shutdownGracefully();
|
||||
- ReferenceCountUtil.release(sslClientCtx);
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
||||
deleted file mode 100644
|
||||
index 9aa6611400..0000000000
|
||||
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
||||
+++ /dev/null
|
||||
@@ -1,28 +0,0 @@
|
||||
------BEGIN PRIVATE KEY-----
|
||||
-MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDYrLtMlZzoe2BP
|
||||
-iCURF3So5XNLfsOLcAVERXXjnxqX6Mex55WdJiy6uWTFKbRHWJdbWELdZxVl5+GX
|
||||
-pMv3OdkKZt+19ZdSfByv6bB5RNdZOEGnKOHSY2XdnzYnF5JBaWEx0fvtvIPZOUlW
|
||||
-DWgsQzJk1UQhu+XnBc7P1hHYNvwsVNOR+HD9LGebDy+UcfiL34XwAyBdHUsbcIr8
|
||||
-hltABcj6vNbqOLndpU86DxU9z9b1PDmkFVfisElhpDEhpxmTCwI22Us1GC8D81LM
|
||||
-ZzMlbWSzTfNPEuqNzJYGiFt/XPwPkPPyVvti0XWPBQpwzJFFUX5xKsOGERolELRT
|
||||
-0yNQYznFAgMBAAECggEAOFR/xSNITbB1k3ejm1PrwlUUqlXkZIXU+LDOO0UL1t5v
|
||||
-vDKm1Not2sWECzYSZlID132UtJauG3YzUgdH95gUcv3XvyiAFLOriZhJht181vcn
|
||||
-KlwYiWfJ/dn8bCFWpqbM2/TpeB8AcCLSjAqkQI2ftlMziUmeNXdvEt1mej2hRay1
|
||||
-ULfoxlC0mftNRQptD5gBFzrc47O4mVpVEQt4yS3Qyzp2/9ds9UkhaCIFpXPVCalZ
|
||||
-ds7R+bDDP+wiYTkUcd8fvelaMkD3Wcy8DedGRShhILZvBYTDdWcpJ7+e5EkNlEq4
|
||||
-+Ys4Y/u6aFDJD53g3zCaJhatmdAZcct2MMmWH1vewQKBgQD3Y2S245cad1D9AqYD
|
||||
-ChZGp95EfRo3EzXk4VkE50bjZXjHq9fD8T0CWEZGWQZrXJCR+vBpEURy0mrPD8se
|
||||
-QQ0Q5+I27RadtfPnMd6ry9nDGMPxyd/10vzU6LazzLNE+uf9ljF1RHZu1iDAvInR
|
||||
-r1cQGbn/wKBF6BurPPIXABZEuQKBgQDgN6JHbIfDzHKhwEoUTvRrYJsTXqplD+h0
|
||||
-Whg+kSQyhtKdlpINFOoEj8FUNJvTjG8les1aoajyWIqikVdvHto/mrxrSIeRkEmt
|
||||
-X+KG+5ld2n466tzv1DmVcIGXSrBrH3lA0i6R8Ly26FLSqw0Z12fx5GUUa1qaVRqo
|
||||
-rwcrIZovbQKBgHa2mojs9AC+Sv3uvG1u9LuZKJ7jDaZqMI2R2d7xgOH0Op5Ohy6+
|
||||
-39D1PVvasqroc3Op4J36rEcRVDHi2Uy+WJ/JNpO2+AhcXRuPodP88ZWel8C6aB+V
|
||||
-zL/6oFntnAU5BgR5g2hLny2W0YbLsrMNmhDe15O0AvUo6cYla+K/pu/5AoGACr/g
|
||||
-EdiMMcDthf+4DX0zjqpVBPq25J18oYdoPierOpjoJBIB8oqcJZfWxvi2t8+1zHA0
|
||||
-xDGX7fZ8vwqEzJkIEaCTg/k4NqxaO+uq6pnJYoyFHMIB0aW1FQsNy3kTOC+MGqV5
|
||||
-Ahoukf5VajA1MpX3L8upZO84qsmFu6yYhWLZB4kCgYBlgSD5G4q6rX4ELa3XG61h
|
||||
-fDtu75IYEsjWm4vgJzHjeYT2xPIm9OFFYXjPghto0f1oH37ODD3DoXmsnmddgpmn
|
||||
-tH7aRWWHsSpB5zVgftV4urNCIsm87LWw8mvUGgCwYV1CtCX8warKokfeoA2ltz4u
|
||||
-oeuUzo98hN+aKRU5RO6Bmg==
|
||||
------END PRIVATE KEY-----
|
||||
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
||||
deleted file mode 100644
|
||||
index 70759b29e5..0000000000
|
||||
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
||||
+++ /dev/null
|
||||
@@ -1,17 +0,0 @@
|
||||
------BEGIN CERTIFICATE-----
|
||||
-MIICozCCAYsCAnS/MA0GCSqGSIb3DQEBDQUAMBgxFjAUBgNVBAMTDU5ldHR5VGVz
|
||||
-dFJvb3QwIBcNMTcwMjE3MDMzMzQ0WhgPMjExNzAxMjQwMzMzNDRaMBQxEjAQBgNV
|
||||
-BAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANis
|
||||
-u0yVnOh7YE+IJREXdKjlc0t+w4twBURFdeOfGpfox7HnlZ0mLLq5ZMUptEdYl1tY
|
||||
-Qt1nFWXn4Zeky/c52Qpm37X1l1J8HK/psHlE11k4Qaco4dJjZd2fNicXkkFpYTHR
|
||||
-++28g9k5SVYNaCxDMmTVRCG75ecFzs/WEdg2/CxU05H4cP0sZ5sPL5Rx+IvfhfAD
|
||||
-IF0dSxtwivyGW0AFyPq81uo4ud2lTzoPFT3P1vU8OaQVV+KwSWGkMSGnGZMLAjbZ
|
||||
-SzUYLwPzUsxnMyVtZLNN808S6o3MlgaIW39c/A+Q8/JW+2LRdY8FCnDMkUVRfnEq
|
||||
-w4YRGiUQtFPTI1BjOcUCAwEAATANBgkqhkiG9w0BAQ0FAAOCAQEAQNXnwE2MJFy5
|
||||
-ti07xyi8h/mY0Kl1dwZUqx4F9D9eoxLCq2/p3h/Z18AlOmjdW06pvC2sGtQtyEqL
|
||||
-YjuQFbMjXRo9c+6+d+xwdDKTu7+XOTHvznJ8xJpKnFOlohGq/n3efBIJSsaeasTU
|
||||
-slFzmdKYABDZzbsQ4X6YCIOF4XVdEQqmXpS+uEbn5C2sVtG+LXI8srmkVGpCcRew
|
||||
-SuTGanwxLparhBBeN1ARjKzNxXUWuK2UKZ9p8c7n7TXGhd12ZNTcLhk4rCnOFq1J
|
||||
-ySFvP5YL2q29fpEt+Tq0zm3V7An2qtaNDp26cEdevtKPjRyOLkCJx8OlZxc9DZvJ
|
||||
-HjalFDoRUw==
|
||||
------END CERTIFICATE-----
|
||||
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
||||
deleted file mode 100644
|
||||
index 9c9241bc65..0000000000
|
||||
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
||||
+++ /dev/null
|
||||
@@ -1,19 +0,0 @@
|
||||
------BEGIN CERTIFICATE-----
|
||||
-MIIDLDCCAhSgAwIBAgIJAO1m5pioZhLLMA0GCSqGSIb3DQEBDQUAMBgxFjAUBgNV
|
||||
-BAMTDU5ldHR5VGVzdFJvb3QwHhcNMTcwMjE3MDMzMzQ0WhcNMTcwMzE5MDMzMzQ0
|
||||
-WjAYMRYwFAYDVQQDEw1OZXR0eVRlc3RSb290MIIBIjANBgkqhkiG9w0BAQEFAAOC
|
||||
-AQ8AMIIBCgKCAQEAnC7Y/p/TSWI1KxBKETfFKaRWCPEkoYn5G973WbCF0VDT90PX
|
||||
-xK6yHvhqNdDQZPmddgfDAQfjekHeeIFkjCKlvQu0js0G4Bubz4NffNumd/Mgsix8
|
||||
-SWJ13lPk+Ly4PDv0bK1zB6BxP1qQm1qxVwsPy9zNP8ylJrM0Div4TXHmnWOfc0JD
|
||||
-4/XPpfeUHH1tt/GMtsS2Gx6EpTVPD2w7LDKUza1/rQ7d9sqmFpgsNcI9Db/sAtFP
|
||||
-lK2iJku5WIXQkmHimn4bqZ9wkiXJ85pm5ggGQqGMPSbe+2Lh24AvZMIBiwPbkjEU
|
||||
-EDFXEJfKOC3Dl71JgWOthtHZ9vcCRDQ3Sky6AQIDAQABo3kwdzAdBgNVHQ4EFgQU
|
||||
-qT+cH8qrebiVPpKCBQDB6At2iOAwSAYDVR0jBEEwP4AUqT+cH8qrebiVPpKCBQDB
|
||||
-6At2iOChHKQaMBgxFjAUBgNVBAMTDU5ldHR5VGVzdFJvb3SCCQDtZuaYqGYSyzAM
|
||||
-BgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBDQUAA4IBAQCEemXTIew4pR2cHEFpVsW2
|
||||
-bLHXLAnC23wBMT46D3tqyxscukMYjFuWosCdEsgRW8d50BXy9o4dHWeg94+aDo3A
|
||||
-DX4OTRN/veQGIG7dgM6poDzFuVJlSN0ubKKg6gpDD60IhopZpMviFAOsmzr7OXwS
|
||||
-9hjbTqUWujMIEHQ95sPlQFdSaavYSFfqhSltWmVCPSbArxrw0lZ2QcnUqGN47EFp
|
||||
-whc5wFB+rSw/ojU1jBLMvgvgzf/8V8zr1IBTDSiHNlknGqGpOOaookzUh95YRiAT
|
||||
-hH82y9bBeflqroOeztqMpONpWoZjlz0sWbJNvXztXINL7LaNmVYOcoUrCcxPS54T
|
||||
------END CERTIFICATE-----
|
||||
--
|
||||
2.26.2
|
||||
|
444
0002-Remove-optional-dep-conscrypt.patch
Normal file
444
0002-Remove-optional-dep-conscrypt.patch
Normal file
@ -0,0 +1,444 @@
|
||||
From 1a72454998ec91895648443c176ec41e542903e8 Mon Sep 17 00:00:00 2001
|
||||
From: Mat Booth <mat.booth@redhat.com>
|
||||
Date: Mon, 7 Sep 2020 13:24:30 +0100
|
||||
Subject: [PATCH 2/5] Remove optional dep conscrypt
|
||||
|
||||
---
|
||||
handler/pom.xml | 6 -
|
||||
.../java/io/netty/handler/ssl/Conscrypt.java | 81 --------
|
||||
.../handler/ssl/ConscryptAlpnSslEngine.java | 196 ------------------
|
||||
.../JdkAlpnApplicationProtocolNegotiator.java | 8 +-
|
||||
.../java/io/netty/handler/ssl/SslHandler.java | 47 +----
|
||||
pom.xml | 10 -
|
||||
6 files changed, 2 insertions(+), 346 deletions(-)
|
||||
delete mode 100644 handler/src/main/java/io/netty/handler/ssl/Conscrypt.java
|
||||
delete mode 100644 handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java
|
||||
|
||||
diff --git a/handler/pom.xml b/handler/pom.xml
|
||||
index c8e26119bd..378aeda2fe 100644
|
||||
--- a/handler/pom.xml
|
||||
+++ b/handler/pom.xml
|
||||
@@ -81,12 +81,6 @@
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
- <dependency>
|
||||
- <groupId>${conscrypt.groupId}</groupId>
|
||||
- <artifactId>${conscrypt.artifactId}</artifactId>
|
||||
- <classifier>${conscrypt.classifier}</classifier>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java b/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java
|
||||
deleted file mode 100644
|
||||
index d2f015f90f..0000000000
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java
|
||||
+++ /dev/null
|
||||
@@ -1,81 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2017 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.handler.ssl;
|
||||
-
|
||||
-import io.netty.util.internal.PlatformDependent;
|
||||
-
|
||||
-import javax.net.ssl.SSLEngine;
|
||||
-import java.lang.reflect.InvocationTargetException;
|
||||
-import java.lang.reflect.Method;
|
||||
-
|
||||
-/**
|
||||
- * Contains methods that can be used to detect if conscrypt is usable.
|
||||
- */
|
||||
-final class Conscrypt {
|
||||
- // This class exists to avoid loading other conscrypt related classes using features only available in JDK8+,
|
||||
- // because we need to maintain JDK6+ runtime compatibility.
|
||||
- private static final Method IS_CONSCRYPT_SSLENGINE = loadIsConscryptEngine();
|
||||
- private static final boolean CAN_INSTANCE_PROVIDER = canInstanceProvider();
|
||||
-
|
||||
- private static Method loadIsConscryptEngine() {
|
||||
- try {
|
||||
- Class<?> conscryptClass = Class.forName("org.conscrypt.Conscrypt", true,
|
||||
- ConscryptAlpnSslEngine.class.getClassLoader());
|
||||
- return conscryptClass.getMethod("isConscrypt", SSLEngine.class);
|
||||
- } catch (Throwable ignore) {
|
||||
- // Conscrypt was not loaded.
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static boolean canInstanceProvider() {
|
||||
- try {
|
||||
- Class<?> providerClass = Class.forName("org.conscrypt.OpenSSLProvider", true,
|
||||
- ConscryptAlpnSslEngine.class.getClassLoader());
|
||||
- providerClass.newInstance();
|
||||
- return true;
|
||||
- } catch (Throwable ignore) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Indicates whether or not conscrypt is available on the current system.
|
||||
- */
|
||||
- static boolean isAvailable() {
|
||||
- return CAN_INSTANCE_PROVIDER && IS_CONSCRYPT_SSLENGINE != null &&
|
||||
- ((PlatformDependent.javaVersion() >= 8 &&
|
||||
- // Only works on Java14 and earlier for now
|
||||
- // See https://github.com/google/conscrypt/issues/838
|
||||
- PlatformDependent.javaVersion() < 15) || PlatformDependent.isAndroid());
|
||||
- }
|
||||
-
|
||||
- static boolean isEngineSupported(SSLEngine engine) {
|
||||
- return isAvailable() && isConscryptEngine(engine);
|
||||
- }
|
||||
-
|
||||
- private static boolean isConscryptEngine(SSLEngine engine) {
|
||||
- try {
|
||||
- return (Boolean) IS_CONSCRYPT_SSLENGINE.invoke(null, engine);
|
||||
- } catch (IllegalAccessException ignore) {
|
||||
- return false;
|
||||
- } catch (InvocationTargetException ex) {
|
||||
- throw new RuntimeException(ex);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private Conscrypt() { }
|
||||
-}
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java
|
||||
deleted file mode 100644
|
||||
index d9767a7106..0000000000
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java
|
||||
+++ /dev/null
|
||||
@@ -1,196 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2017 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.handler.ssl;
|
||||
-
|
||||
-import static io.netty.handler.ssl.SslUtils.toSSLHandshakeException;
|
||||
-import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||
-import static java.lang.Math.min;
|
||||
-
|
||||
-import io.netty.buffer.ByteBuf;
|
||||
-import io.netty.buffer.ByteBufAllocator;
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
|
||||
-import java.nio.ByteBuffer;
|
||||
-import java.util.Collections;
|
||||
-import java.util.LinkedHashSet;
|
||||
-import java.util.List;
|
||||
-import javax.net.ssl.SSLEngine;
|
||||
-import javax.net.ssl.SSLEngineResult;
|
||||
-import javax.net.ssl.SSLException;
|
||||
-
|
||||
-import io.netty.util.internal.SystemPropertyUtil;
|
||||
-import org.conscrypt.AllocatedBuffer;
|
||||
-import org.conscrypt.BufferAllocator;
|
||||
-import org.conscrypt.Conscrypt;
|
||||
-import org.conscrypt.HandshakeListener;
|
||||
-
|
||||
-/**
|
||||
- * A {@link JdkSslEngine} that uses the Conscrypt provider or SSL with ALPN.
|
||||
- */
|
||||
-abstract class ConscryptAlpnSslEngine extends JdkSslEngine {
|
||||
- private static final boolean USE_BUFFER_ALLOCATOR = SystemPropertyUtil.getBoolean(
|
||||
- "io.netty.handler.ssl.conscrypt.useBufferAllocator", true);
|
||||
-
|
||||
- static ConscryptAlpnSslEngine newClientEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- return new ClientEngine(engine, alloc, applicationNegotiator);
|
||||
- }
|
||||
-
|
||||
- static ConscryptAlpnSslEngine newServerEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- return new ServerEngine(engine, alloc, applicationNegotiator);
|
||||
- }
|
||||
-
|
||||
- private ConscryptAlpnSslEngine(SSLEngine engine, ByteBufAllocator alloc, List<String> protocols) {
|
||||
- super(engine);
|
||||
-
|
||||
- // Configure the Conscrypt engine to use Netty's buffer allocator. This is a trade-off of memory vs
|
||||
- // performance.
|
||||
- //
|
||||
- // If no allocator is provided, the engine will internally allocate a direct buffer of max packet size in
|
||||
- // order to optimize JNI calls (this happens the first time it is provided a non-direct buffer from the
|
||||
- // application).
|
||||
- //
|
||||
- // Alternatively, if an allocator is provided, no internal buffer will be created and direct buffers will be
|
||||
- // retrieved from the allocator on-demand.
|
||||
- if (USE_BUFFER_ALLOCATOR) {
|
||||
- Conscrypt.setBufferAllocator(engine, new BufferAllocatorAdapter(alloc));
|
||||
- }
|
||||
-
|
||||
- // Set the list of supported ALPN protocols on the engine.
|
||||
- Conscrypt.setApplicationProtocols(engine, protocols.toArray(new String[0]));
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Calculates the maximum size of the encrypted output buffer required to wrap the given plaintext bytes. Assumes
|
||||
- * as a worst case that there is one TLS record per buffer.
|
||||
- *
|
||||
- * @param plaintextBytes the number of plaintext bytes to be wrapped.
|
||||
- * @param numBuffers the number of buffers that the plaintext bytes are spread across.
|
||||
- * @return the maximum size of the encrypted output buffer required for the wrap operation.
|
||||
- */
|
||||
- final int calculateOutNetBufSize(int plaintextBytes, int numBuffers) {
|
||||
- // Assuming a max of one frame per component in a composite buffer.
|
||||
- long maxOverhead = (long) Conscrypt.maxSealOverhead(getWrappedEngine()) * numBuffers;
|
||||
- // TODO(nmittler): update this to use MAX_ENCRYPTED_PACKET_LENGTH instead of Integer.MAX_VALUE
|
||||
- return (int) min(Integer.MAX_VALUE, plaintextBytes + maxOverhead);
|
||||
- }
|
||||
-
|
||||
- final SSLEngineResult unwrap(ByteBuffer[] srcs, ByteBuffer[] dests) throws SSLException {
|
||||
- return Conscrypt.unwrap(getWrappedEngine(), srcs, dests);
|
||||
- }
|
||||
-
|
||||
- private static final class ClientEngine extends ConscryptAlpnSslEngine {
|
||||
- private final ProtocolSelectionListener protocolListener;
|
||||
-
|
||||
- ClientEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- super(engine, alloc, applicationNegotiator.protocols());
|
||||
- // Register for completion of the handshake.
|
||||
- Conscrypt.setHandshakeListener(engine, new HandshakeListener() {
|
||||
- @Override
|
||||
- public void onHandshakeFinished() throws SSLException {
|
||||
- selectProtocol();
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- protocolListener = checkNotNull(applicationNegotiator
|
||||
- .protocolListenerFactory().newListener(this, applicationNegotiator.protocols()),
|
||||
- "protocolListener");
|
||||
- }
|
||||
-
|
||||
- private void selectProtocol() throws SSLException {
|
||||
- String protocol = Conscrypt.getApplicationProtocol(getWrappedEngine());
|
||||
- try {
|
||||
- protocolListener.selected(protocol);
|
||||
- } catch (Throwable e) {
|
||||
- throw toSSLHandshakeException(e);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static final class ServerEngine extends ConscryptAlpnSslEngine {
|
||||
- private final ProtocolSelector protocolSelector;
|
||||
-
|
||||
- ServerEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- super(engine, alloc, applicationNegotiator.protocols());
|
||||
-
|
||||
- // Register for completion of the handshake.
|
||||
- Conscrypt.setHandshakeListener(engine, new HandshakeListener() {
|
||||
- @Override
|
||||
- public void onHandshakeFinished() throws SSLException {
|
||||
- selectProtocol();
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- protocolSelector = checkNotNull(applicationNegotiator.protocolSelectorFactory()
|
||||
- .newSelector(this,
|
||||
- new LinkedHashSet<String>(applicationNegotiator.protocols())),
|
||||
- "protocolSelector");
|
||||
- }
|
||||
-
|
||||
- private void selectProtocol() throws SSLException {
|
||||
- try {
|
||||
- String protocol = Conscrypt.getApplicationProtocol(getWrappedEngine());
|
||||
- protocolSelector.select(protocol != null ? Collections.singletonList(protocol)
|
||||
- : Collections.<String>emptyList());
|
||||
- } catch (Throwable e) {
|
||||
- throw toSSLHandshakeException(e);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static final class BufferAllocatorAdapter extends BufferAllocator {
|
||||
- private final ByteBufAllocator alloc;
|
||||
-
|
||||
- BufferAllocatorAdapter(ByteBufAllocator alloc) {
|
||||
- this.alloc = alloc;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public AllocatedBuffer allocateDirectBuffer(int capacity) {
|
||||
- return new BufferAdapter(alloc.directBuffer(capacity));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static final class BufferAdapter extends AllocatedBuffer {
|
||||
- private final ByteBuf nettyBuffer;
|
||||
- private final ByteBuffer buffer;
|
||||
-
|
||||
- BufferAdapter(ByteBuf nettyBuffer) {
|
||||
- this.nettyBuffer = nettyBuffer;
|
||||
- buffer = nettyBuffer.nioBuffer(0, nettyBuffer.capacity());
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public ByteBuffer nioBuffer() {
|
||||
- return buffer;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public AllocatedBuffer retain() {
|
||||
- nettyBuffer.retain();
|
||||
- return this;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public AllocatedBuffer release() {
|
||||
- nettyBuffer.release();
|
||||
- return this;
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
index c4ca7b9b8c..2ed83a313b 100644
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
+++ b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
@@ -26,8 +26,7 @@ import javax.net.ssl.SSLEngine;
|
||||
*/
|
||||
@Deprecated
|
||||
public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicationProtocolNegotiator {
|
||||
- private static final boolean AVAILABLE = Conscrypt.isAvailable() ||
|
||||
- JdkAlpnSslUtils.supportsAlpn() ||
|
||||
+ private static final boolean AVAILABLE = JdkAlpnSslUtils.supportsAlpn() ||
|
||||
JettyAlpnSslEngine.isAvailable();
|
||||
|
||||
private static final SslEngineWrapperFactory ALPN_WRAPPER = AVAILABLE ? new AlpnWrapper() : new FailureWrapper();
|
||||
@@ -119,7 +118,6 @@ public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicati
|
||||
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) {
|
||||
throw new RuntimeException("ALPN unsupported. Is your classpath configured correctly?"
|
||||
- + " For Conscrypt, add the appropriate Conscrypt JAR to classpath and set the security provider."
|
||||
+ " For Jetty-ALPN, see "
|
||||
+ "http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-starting");
|
||||
}
|
||||
@@ -129,10 +127,6 @@ public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicati
|
||||
@Override
|
||||
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
|
||||
JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) {
|
||||
- if (Conscrypt.isEngineSupported(engine)) {
|
||||
- return isServer ? ConscryptAlpnSslEngine.newServerEngine(engine, alloc, applicationNegotiator)
|
||||
- : ConscryptAlpnSslEngine.newClientEngine(engine, alloc, applicationNegotiator);
|
||||
- }
|
||||
// ALPN support was recently backported to Java8 as
|
||||
// https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8230977.
|
||||
// Because of this lets not do a Java version runtime check but just depend on if the required methods are
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java
|
||||
index de101967ba..8e11bbf4cc 100644
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java
|
||||
+++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java
|
||||
@@ -228,50 +228,6 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
|
||||
return ((ReferenceCountedOpenSslEngine) engine).jdkCompatibilityMode;
|
||||
}
|
||||
},
|
||||
- CONSCRYPT(true, COMPOSITE_CUMULATOR) {
|
||||
- @Override
|
||||
- SSLEngineResult unwrap(SslHandler handler, ByteBuf in, int readerIndex, int len, ByteBuf out)
|
||||
- throws SSLException {
|
||||
- int nioBufferCount = in.nioBufferCount();
|
||||
- int writerIndex = out.writerIndex();
|
||||
- final SSLEngineResult result;
|
||||
- if (nioBufferCount > 1) {
|
||||
- /*
|
||||
- * Use a special unwrap method without additional memory copies.
|
||||
- */
|
||||
- try {
|
||||
- handler.singleBuffer[0] = toByteBuffer(out, writerIndex, out.writableBytes());
|
||||
- result = ((ConscryptAlpnSslEngine) handler.engine).unwrap(
|
||||
- in.nioBuffers(readerIndex, len),
|
||||
- handler.singleBuffer);
|
||||
- } finally {
|
||||
- handler.singleBuffer[0] = null;
|
||||
- }
|
||||
- } else {
|
||||
- result = handler.engine.unwrap(toByteBuffer(in, readerIndex, len),
|
||||
- toByteBuffer(out, writerIndex, out.writableBytes()));
|
||||
- }
|
||||
- out.writerIndex(writerIndex + result.bytesProduced());
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- ByteBuf allocateWrapBuffer(SslHandler handler, ByteBufAllocator allocator,
|
||||
- int pendingBytes, int numComponents) {
|
||||
- return allocator.directBuffer(
|
||||
- ((ConscryptAlpnSslEngine) handler.engine).calculateOutNetBufSize(pendingBytes, numComponents));
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- int calculatePendingData(SslHandler handler, int guess) {
|
||||
- return guess;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- boolean jdkCompatibilityMode(SSLEngine engine) {
|
||||
- return true;
|
||||
- }
|
||||
- },
|
||||
JDK(false, MERGE_CUMULATOR) {
|
||||
@Override
|
||||
SSLEngineResult unwrap(SslHandler handler, ByteBuf in, int readerIndex, int len, ByteBuf out)
|
||||
@@ -324,8 +280,7 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
|
||||
};
|
||||
|
||||
static SslEngineType forEngine(SSLEngine engine) {
|
||||
- return engine instanceof ReferenceCountedOpenSslEngine ? TCNATIVE :
|
||||
- engine instanceof ConscryptAlpnSslEngine ? CONSCRYPT : JDK;
|
||||
+ return engine instanceof ReferenceCountedOpenSslEngine ? TCNATIVE : JDK;
|
||||
}
|
||||
|
||||
SslEngineType(boolean wantsDirectBuffer, Cumulator cumulator) {
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d548aa5513..db3d7b0d38 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -489,16 +489,6 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
- <!-- Conscrypt - needed for running tests, used for acclerating SSL with OpenSSL. -->
|
||||
- <dependency>
|
||||
- <groupId>${conscrypt.groupId}</groupId>
|
||||
- <artifactId>${conscrypt.artifactId}</artifactId>
|
||||
- <classifier>${conscrypt.classifier}</classifier>
|
||||
- <version>${conscrypt.version}</version>
|
||||
- <scope>compile</scope>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
-
|
||||
<!--
|
||||
Bouncy Castle - completely optional, only needed when:
|
||||
- you generate a temporary self-signed certificate using SelfSignedCertificate, and
|
||||
--
|
||||
2.26.2
|
||||
|
405
0003-Remove-optional-deps-jetty-alpn-and-npn.patch
Normal file
405
0003-Remove-optional-deps-jetty-alpn-and-npn.patch
Normal file
@ -0,0 +1,405 @@
|
||||
From cb6b51eed1faef580120e19aa1b5404c19a9398b Mon Sep 17 00:00:00 2001
|
||||
From: Mat Booth <mat.booth@redhat.com>
|
||||
Date: Mon, 7 Sep 2020 13:26:20 +0100
|
||||
Subject: [PATCH 3/5] Remove optional deps jetty alpn and npn
|
||||
|
||||
---
|
||||
handler/pom.xml | 10 --
|
||||
.../JdkAlpnApplicationProtocolNegotiator.java | 7 +-
|
||||
.../JdkNpnApplicationProtocolNegotiator.java | 10 +-
|
||||
.../netty/handler/ssl/JettyAlpnSslEngine.java | 157 ------------------
|
||||
.../netty/handler/ssl/JettyNpnSslEngine.java | 122 --------------
|
||||
pom.xml | 14 --
|
||||
6 files changed, 3 insertions(+), 317 deletions(-)
|
||||
delete mode 100644 handler/src/main/java/io/netty/handler/ssl/JettyAlpnSslEngine.java
|
||||
delete mode 100644 handler/src/main/java/io/netty/handler/ssl/JettyNpnSslEngine.java
|
||||
|
||||
diff --git a/handler/pom.xml b/handler/pom.xml
|
||||
index 378aeda2fe..be8206dc89 100644
|
||||
--- a/handler/pom.xml
|
||||
+++ b/handler/pom.xml
|
||||
@@ -71,16 +71,6 @@
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.eclipse.jetty.npn</groupId>
|
||||
- <artifactId>npn-api</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.eclipse.jetty.alpn</groupId>
|
||||
- <artifactId>alpn-api</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
index 2ed83a313b..dbd5ed9f07 100644
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
+++ b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnApplicationProtocolNegotiator.java
|
||||
@@ -26,8 +26,7 @@ import javax.net.ssl.SSLEngine;
|
||||
*/
|
||||
@Deprecated
|
||||
public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicationProtocolNegotiator {
|
||||
- private static final boolean AVAILABLE = JdkAlpnSslUtils.supportsAlpn() ||
|
||||
- JettyAlpnSslEngine.isAvailable();
|
||||
+ private static final boolean AVAILABLE = JdkAlpnSslUtils.supportsAlpn();
|
||||
|
||||
private static final SslEngineWrapperFactory ALPN_WRAPPER = AVAILABLE ? new AlpnWrapper() : new FailureWrapper();
|
||||
|
||||
@@ -134,10 +133,6 @@ public final class JdkAlpnApplicationProtocolNegotiator extends JdkBaseApplicati
|
||||
if (JdkAlpnSslUtils.supportsAlpn()) {
|
||||
return new JdkAlpnSslEngine(engine, applicationNegotiator, isServer);
|
||||
}
|
||||
- if (JettyAlpnSslEngine.isAvailable()) {
|
||||
- return isServer ? JettyAlpnSslEngine.newServerEngine(engine, applicationNegotiator)
|
||||
- : JettyAlpnSslEngine.newClientEngine(engine, applicationNegotiator);
|
||||
- }
|
||||
throw new UnsupportedOperationException("ALPN not supported. Unable to wrap SSLEngine of type '"
|
||||
+ engine.getClass().getName() + "')");
|
||||
}
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkNpnApplicationProtocolNegotiator.java b/handler/src/main/java/io/netty/handler/ssl/JdkNpnApplicationProtocolNegotiator.java
|
||||
index 3c2863b66c..2703336e8b 100644
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/JdkNpnApplicationProtocolNegotiator.java
|
||||
+++ b/handler/src/main/java/io/netty/handler/ssl/JdkNpnApplicationProtocolNegotiator.java
|
||||
@@ -25,17 +25,11 @@ import javax.net.ssl.SSLEngine;
|
||||
@Deprecated
|
||||
public final class JdkNpnApplicationProtocolNegotiator extends JdkBaseApplicationProtocolNegotiator {
|
||||
private static final SslEngineWrapperFactory NPN_WRAPPER = new SslEngineWrapperFactory() {
|
||||
- {
|
||||
- if (!JettyNpnSslEngine.isAvailable()) {
|
||||
- throw new RuntimeException("NPN unsupported. Is your classpath configured correctly?"
|
||||
- + " See https://wiki.eclipse.org/Jetty/Feature/NPN");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
@Override
|
||||
public SSLEngine wrapSslEngine(SSLEngine engine,
|
||||
JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) {
|
||||
- return new JettyNpnSslEngine(engine, applicationNegotiator, isServer);
|
||||
+ throw new UnsupportedOperationException("NPN not supported. Unable to wrap SSLEngine of type '"
|
||||
+ + engine.getClass().getName() + "')");
|
||||
}
|
||||
};
|
||||
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/JettyAlpnSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/JettyAlpnSslEngine.java
|
||||
deleted file mode 100644
|
||||
index ce9f14a57e..0000000000
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/JettyAlpnSslEngine.java
|
||||
+++ /dev/null
|
||||
@@ -1,157 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2014 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.handler.ssl;
|
||||
-
|
||||
-import static io.netty.handler.ssl.SslUtils.toSSLHandshakeException;
|
||||
-import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||
-
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
|
||||
-
|
||||
-import java.util.LinkedHashSet;
|
||||
-import java.util.List;
|
||||
-
|
||||
-import javax.net.ssl.SSLEngine;
|
||||
-import javax.net.ssl.SSLException;
|
||||
-
|
||||
-import io.netty.util.internal.PlatformDependent;
|
||||
-import org.eclipse.jetty.alpn.ALPN;
|
||||
-
|
||||
-abstract class JettyAlpnSslEngine extends JdkSslEngine {
|
||||
- private static final boolean available = initAvailable();
|
||||
-
|
||||
- static boolean isAvailable() {
|
||||
- return available;
|
||||
- }
|
||||
-
|
||||
- private static boolean initAvailable() {
|
||||
- if (PlatformDependent.javaVersion() <= 8) {
|
||||
- try {
|
||||
- // Always use bootstrap class loader.
|
||||
- Class.forName("sun.security.ssl.ALPNExtension", true, null);
|
||||
- return true;
|
||||
- } catch (Throwable ignore) {
|
||||
- // alpn-boot was not loaded.
|
||||
- }
|
||||
- }
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- static JettyAlpnSslEngine newClientEngine(SSLEngine engine,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- return new ClientEngine(engine, applicationNegotiator);
|
||||
- }
|
||||
-
|
||||
- static JettyAlpnSslEngine newServerEngine(SSLEngine engine,
|
||||
- JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- return new ServerEngine(engine, applicationNegotiator);
|
||||
- }
|
||||
-
|
||||
- private JettyAlpnSslEngine(SSLEngine engine) {
|
||||
- super(engine);
|
||||
- }
|
||||
-
|
||||
- private static final class ClientEngine extends JettyAlpnSslEngine {
|
||||
- ClientEngine(SSLEngine engine, final JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- super(engine);
|
||||
- checkNotNull(applicationNegotiator, "applicationNegotiator");
|
||||
- final ProtocolSelectionListener protocolListener = checkNotNull(applicationNegotiator
|
||||
- .protocolListenerFactory().newListener(this, applicationNegotiator.protocols()),
|
||||
- "protocolListener");
|
||||
- ALPN.put(engine, new ALPN.ClientProvider() {
|
||||
- @Override
|
||||
- public List<String> protocols() {
|
||||
- return applicationNegotiator.protocols();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void selected(String protocol) throws SSLException {
|
||||
- try {
|
||||
- protocolListener.selected(protocol);
|
||||
- } catch (Throwable t) {
|
||||
- throw toSSLHandshakeException(t);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void unsupported() {
|
||||
- protocolListener.unsupported();
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeInbound() throws SSLException {
|
||||
- try {
|
||||
- ALPN.remove(getWrappedEngine());
|
||||
- } finally {
|
||||
- super.closeInbound();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeOutbound() {
|
||||
- try {
|
||||
- ALPN.remove(getWrappedEngine());
|
||||
- } finally {
|
||||
- super.closeOutbound();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static final class ServerEngine extends JettyAlpnSslEngine {
|
||||
- ServerEngine(SSLEngine engine, final JdkApplicationProtocolNegotiator applicationNegotiator) {
|
||||
- super(engine);
|
||||
- checkNotNull(applicationNegotiator, "applicationNegotiator");
|
||||
- final ProtocolSelector protocolSelector = checkNotNull(applicationNegotiator.protocolSelectorFactory()
|
||||
- .newSelector(this, new LinkedHashSet<String>(applicationNegotiator.protocols())),
|
||||
- "protocolSelector");
|
||||
- ALPN.put(engine, new ALPN.ServerProvider() {
|
||||
- @Override
|
||||
- public String select(List<String> protocols) throws SSLException {
|
||||
- try {
|
||||
- return protocolSelector.select(protocols);
|
||||
- } catch (Throwable t) {
|
||||
- throw toSSLHandshakeException(t);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void unsupported() {
|
||||
- protocolSelector.unsupported();
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeInbound() throws SSLException {
|
||||
- try {
|
||||
- ALPN.remove(getWrappedEngine());
|
||||
- } finally {
|
||||
- super.closeInbound();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeOutbound() {
|
||||
- try {
|
||||
- ALPN.remove(getWrappedEngine());
|
||||
- } finally {
|
||||
- super.closeOutbound();
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
diff --git a/handler/src/main/java/io/netty/handler/ssl/JettyNpnSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/JettyNpnSslEngine.java
|
||||
deleted file mode 100644
|
||||
index 77e7366e53..0000000000
|
||||
--- a/handler/src/main/java/io/netty/handler/ssl/JettyNpnSslEngine.java
|
||||
+++ /dev/null
|
||||
@@ -1,122 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2014 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-
|
||||
-package io.netty.handler.ssl;
|
||||
-
|
||||
-import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener;
|
||||
-import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector;
|
||||
-import io.netty.util.internal.PlatformDependent;
|
||||
-
|
||||
-import java.util.LinkedHashSet;
|
||||
-import java.util.List;
|
||||
-
|
||||
-import javax.net.ssl.SSLEngine;
|
||||
-import javax.net.ssl.SSLException;
|
||||
-
|
||||
-import org.eclipse.jetty.npn.NextProtoNego;
|
||||
-import org.eclipse.jetty.npn.NextProtoNego.ClientProvider;
|
||||
-import org.eclipse.jetty.npn.NextProtoNego.ServerProvider;
|
||||
-
|
||||
-final class JettyNpnSslEngine extends JdkSslEngine {
|
||||
- private static boolean available;
|
||||
-
|
||||
- static boolean isAvailable() {
|
||||
- updateAvailability();
|
||||
- return available;
|
||||
- }
|
||||
-
|
||||
- private static void updateAvailability() {
|
||||
- if (available) {
|
||||
- return;
|
||||
- }
|
||||
- try {
|
||||
- // Always use bootstrap class loader.
|
||||
- Class.forName("sun.security.ssl.NextProtoNegoExtension", true, null);
|
||||
- available = true;
|
||||
- } catch (Exception ignore) {
|
||||
- // npn-boot was not loaded.
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- JettyNpnSslEngine(SSLEngine engine, final JdkApplicationProtocolNegotiator applicationNegotiator, boolean server) {
|
||||
- super(engine);
|
||||
- checkNotNull(applicationNegotiator, "applicationNegotiator");
|
||||
-
|
||||
- if (server) {
|
||||
- final ProtocolSelectionListener protocolListener = checkNotNull(applicationNegotiator
|
||||
- .protocolListenerFactory().newListener(this, applicationNegotiator.protocols()),
|
||||
- "protocolListener");
|
||||
- NextProtoNego.put(engine, new ServerProvider() {
|
||||
- @Override
|
||||
- public void unsupported() {
|
||||
- protocolListener.unsupported();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public List<String> protocols() {
|
||||
- return applicationNegotiator.protocols();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void protocolSelected(String protocol) {
|
||||
- try {
|
||||
- protocolListener.selected(protocol);
|
||||
- } catch (Throwable t) {
|
||||
- PlatformDependent.throwException(t);
|
||||
- }
|
||||
- }
|
||||
- });
|
||||
- } else {
|
||||
- final ProtocolSelector protocolSelector = checkNotNull(applicationNegotiator.protocolSelectorFactory()
|
||||
- .newSelector(this, new LinkedHashSet<String>(applicationNegotiator.protocols())),
|
||||
- "protocolSelector");
|
||||
- NextProtoNego.put(engine, new ClientProvider() {
|
||||
- @Override
|
||||
- public boolean supports() {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void unsupported() {
|
||||
- protocolSelector.unsupported();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public String selectProtocol(List<String> protocols) {
|
||||
- try {
|
||||
- return protocolSelector.select(protocols);
|
||||
- } catch (Throwable t) {
|
||||
- PlatformDependent.throwException(t);
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeInbound() throws SSLException {
|
||||
- NextProtoNego.remove(getWrappedEngine());
|
||||
- super.closeInbound();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void closeOutbound() {
|
||||
- NextProtoNego.remove(getWrappedEngine());
|
||||
- super.closeOutbound();
|
||||
- }
|
||||
-}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index db3d7b0d38..bedd6d6903 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -453,20 +453,6 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
- <!-- SPDY and HTTP/2 - completely optional -->
|
||||
- <dependency>
|
||||
- <groupId>org.eclipse.jetty.npn</groupId>
|
||||
- <artifactId>npn-api</artifactId>
|
||||
- <version>1.1.1.v20141010</version>
|
||||
- <scope>provided</scope> <!-- Provided by npn-boot -->
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.eclipse.jetty.alpn</groupId>
|
||||
- <artifactId>alpn-api</artifactId>
|
||||
- <version>1.1.2.v20150522</version>
|
||||
- <scope>provided</scope> <!-- Provided by alpn-boot -->
|
||||
- </dependency>
|
||||
-
|
||||
<!-- Google Protocol Buffers - completely optional -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
--
|
||||
2.26.2
|
||||
|
8567
0004-Remove-optional-dep-tcnative.patch
Normal file
8567
0004-Remove-optional-dep-tcnative.patch
Normal file
File diff suppressed because it is too large
Load Diff
911
0005-Remove-optional-dep-log4j.patch
Normal file
911
0005-Remove-optional-dep-log4j.patch
Normal file
@ -0,0 +1,911 @@
|
||||
From 1762f36e7ed797747ae692ea2c78001d45b35449 Mon Sep 17 00:00:00 2001
|
||||
From: Mat Booth <mat.booth@redhat.com>
|
||||
Date: Mon, 7 Sep 2020 14:29:44 +0100
|
||||
Subject: [PATCH 5/5] Remove optional dep log4j
|
||||
|
||||
---
|
||||
common/pom.xml | 15 -
|
||||
.../logging/InternalLoggerFactory.java | 14 +-
|
||||
.../util/internal/logging/Log4J2Logger.java | 143 -----
|
||||
.../internal/logging/Log4J2LoggerFactory.java | 35 -
|
||||
.../util/internal/logging/Log4JLogger.java | 597 ------------------
|
||||
.../internal/logging/Log4JLoggerFactory.java | 40 --
|
||||
6 files changed, 2 insertions(+), 842 deletions(-)
|
||||
delete mode 100644 common/src/main/java/io/netty/util/internal/logging/Log4J2Logger.java
|
||||
delete mode 100644 common/src/main/java/io/netty/util/internal/logging/Log4J2LoggerFactory.java
|
||||
delete mode 100644 common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java
|
||||
delete mode 100644 common/src/main/java/io/netty/util/internal/logging/Log4JLoggerFactory.java
|
||||
|
||||
diff --git a/common/pom.xml b/common/pom.xml
|
||||
index abc73161eb..60693fb81a 100644
|
||||
--- a/common/pom.xml
|
||||
+++ b/common/pom.xml
|
||||
@@ -63,21 +63,6 @@
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
- <dependency>
|
||||
- <groupId>log4j</groupId>
|
||||
- <artifactId>log4j</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-api</artifactId>
|
||||
- <optional>true</optional>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-core</artifactId>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/logging/InternalLoggerFactory.java b/common/src/main/java/io/netty/util/internal/logging/InternalLoggerFactory.java
|
||||
index 508f571820..98eb4e4f4d 100644
|
||||
--- a/common/src/main/java/io/netty/util/internal/logging/InternalLoggerFactory.java
|
||||
+++ b/common/src/main/java/io/netty/util/internal/logging/InternalLoggerFactory.java
|
||||
@@ -44,18 +44,8 @@ public abstract class InternalLoggerFactory {
|
||||
f = new Slf4JLoggerFactory(true);
|
||||
f.newInstance(name).debug("Using SLF4J as the default logging framework");
|
||||
} catch (Throwable ignore1) {
|
||||
- try {
|
||||
- f = Log4J2LoggerFactory.INSTANCE;
|
||||
- f.newInstance(name).debug("Using Log4J2 as the default logging framework");
|
||||
- } catch (Throwable ignore2) {
|
||||
- try {
|
||||
- f = Log4JLoggerFactory.INSTANCE;
|
||||
- f.newInstance(name).debug("Using Log4J as the default logging framework");
|
||||
- } catch (Throwable ignore3) {
|
||||
- f = JdkLoggerFactory.INSTANCE;
|
||||
- f.newInstance(name).debug("Using java.util.logging as the default logging framework");
|
||||
- }
|
||||
- }
|
||||
+ f = JdkLoggerFactory.INSTANCE;
|
||||
+ f.newInstance(name).debug("Using java.util.logging as the default logging framework");
|
||||
}
|
||||
return f;
|
||||
}
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/logging/Log4J2Logger.java b/common/src/main/java/io/netty/util/internal/logging/Log4J2Logger.java
|
||||
deleted file mode 100644
|
||||
index 5c3593f203..0000000000
|
||||
--- a/common/src/main/java/io/netty/util/internal/logging/Log4J2Logger.java
|
||||
+++ /dev/null
|
||||
@@ -1,143 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2016 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.util.internal.logging;
|
||||
-
|
||||
-
|
||||
-import org.apache.logging.log4j.Level;
|
||||
-import org.apache.logging.log4j.Logger;
|
||||
-import org.apache.logging.log4j.spi.ExtendedLogger;
|
||||
-import org.apache.logging.log4j.spi.ExtendedLoggerWrapper;
|
||||
-
|
||||
-import java.security.AccessController;
|
||||
-import java.security.PrivilegedAction;
|
||||
-
|
||||
-import static io.netty.util.internal.logging.AbstractInternalLogger.EXCEPTION_MESSAGE;
|
||||
-
|
||||
-class Log4J2Logger extends ExtendedLoggerWrapper implements InternalLogger {
|
||||
-
|
||||
- private static final long serialVersionUID = 5485418394879791397L;
|
||||
- private static final boolean VARARGS_ONLY;
|
||||
-
|
||||
- static {
|
||||
- // Older Log4J2 versions have only log methods that takes the format + varargs. So we should not use
|
||||
- // Log4J2 if the version is too old.
|
||||
- // See https://github.com/netty/netty/issues/8217
|
||||
- VARARGS_ONLY = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
- @Override
|
||||
- public Boolean run() {
|
||||
- try {
|
||||
- Logger.class.getMethod("debug", String.class, Object.class);
|
||||
- return false;
|
||||
- } catch (NoSuchMethodException ignore) {
|
||||
- // Log4J2 version too old.
|
||||
- return true;
|
||||
- } catch (SecurityException ignore) {
|
||||
- // We could not detect the version so we will use Log4J2 if its on the classpath.
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- Log4J2Logger(Logger logger) {
|
||||
- super((ExtendedLogger) logger, logger.getName(), logger.getMessageFactory());
|
||||
- if (VARARGS_ONLY) {
|
||||
- throw new UnsupportedOperationException("Log4J2 version mismatch");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public String name() {
|
||||
- return getName();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void trace(Throwable t) {
|
||||
- log(Level.TRACE, EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void debug(Throwable t) {
|
||||
- log(Level.DEBUG, EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void info(Throwable t) {
|
||||
- log(Level.INFO, EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void warn(Throwable t) {
|
||||
- log(Level.WARN, EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void error(Throwable t) {
|
||||
- log(Level.ERROR, EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean isEnabled(InternalLogLevel level) {
|
||||
- return isEnabled(toLevel(level));
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, String msg) {
|
||||
- log(toLevel(level), msg);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, String format, Object arg) {
|
||||
- log(toLevel(level), format, arg);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, String format, Object argA, Object argB) {
|
||||
- log(toLevel(level), format, argA, argB);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, String format, Object... arguments) {
|
||||
- log(toLevel(level), format, arguments);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, String msg, Throwable t) {
|
||||
- log(toLevel(level), msg, t);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void log(InternalLogLevel level, Throwable t) {
|
||||
- log(toLevel(level), EXCEPTION_MESSAGE, t);
|
||||
- }
|
||||
-
|
||||
- private static Level toLevel(InternalLogLevel level) {
|
||||
- switch (level) {
|
||||
- case INFO:
|
||||
- return Level.INFO;
|
||||
- case DEBUG:
|
||||
- return Level.DEBUG;
|
||||
- case WARN:
|
||||
- return Level.WARN;
|
||||
- case ERROR:
|
||||
- return Level.ERROR;
|
||||
- case TRACE:
|
||||
- return Level.TRACE;
|
||||
- default:
|
||||
- throw new Error();
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/logging/Log4J2LoggerFactory.java b/common/src/main/java/io/netty/util/internal/logging/Log4J2LoggerFactory.java
|
||||
deleted file mode 100644
|
||||
index 8b895fbc07..0000000000
|
||||
--- a/common/src/main/java/io/netty/util/internal/logging/Log4J2LoggerFactory.java
|
||||
+++ /dev/null
|
||||
@@ -1,35 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2016 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.util.internal.logging;
|
||||
-
|
||||
-import org.apache.logging.log4j.LogManager;
|
||||
-
|
||||
-public final class Log4J2LoggerFactory extends InternalLoggerFactory {
|
||||
-
|
||||
- public static final InternalLoggerFactory INSTANCE = new Log4J2LoggerFactory();
|
||||
-
|
||||
- /**
|
||||
- * @deprecated Use {@link #INSTANCE} instead.
|
||||
- */
|
||||
- @Deprecated
|
||||
- public Log4J2LoggerFactory() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public InternalLogger newInstance(String name) {
|
||||
- return new Log4J2Logger(LogManager.getLogger(name));
|
||||
- }
|
||||
-}
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java b/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java
|
||||
deleted file mode 100644
|
||||
index 27b9130a08..0000000000
|
||||
--- a/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java
|
||||
+++ /dev/null
|
||||
@@ -1,597 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2012 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-/**
|
||||
- * Copyright (c) 2004-2011 QOS.ch
|
||||
- * All rights reserved.
|
||||
- *
|
||||
- * Permission is hereby granted, free of charge, to any person obtaining
|
||||
- * a copy of this software and associated documentation files (the
|
||||
- * "Software"), to deal in the Software without restriction, including
|
||||
- * without limitation the rights to use, copy, modify, merge, publish,
|
||||
- * distribute, sublicense, and/or sell copies of the Software, and to
|
||||
- * permit persons to whom the Software is furnished to do so, subject to
|
||||
- * the following conditions:
|
||||
- *
|
||||
- * The above copyright notice and this permission notice shall be
|
||||
- * included in all copies or substantial portions of the Software.
|
||||
- *
|
||||
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- *
|
||||
- */
|
||||
-package io.netty.util.internal.logging;
|
||||
-
|
||||
-import org.apache.log4j.Level;
|
||||
-import org.apache.log4j.Logger;
|
||||
-
|
||||
-/**
|
||||
- * <a href="http://logging.apache.org/log4j/1.2/index.html">Apache Log4J</a>
|
||||
- * logger.
|
||||
- */
|
||||
-class Log4JLogger extends AbstractInternalLogger {
|
||||
-
|
||||
- private static final long serialVersionUID = 2851357342488183058L;
|
||||
-
|
||||
- final transient Logger logger;
|
||||
-
|
||||
- /**
|
||||
- * Following the pattern discussed in pages 162 through 168 of "The complete
|
||||
- * log4j manual".
|
||||
- */
|
||||
- static final String FQCN = Log4JLogger.class.getName();
|
||||
-
|
||||
- // Does the log4j version in use recognize the TRACE level?
|
||||
- // The trace level was introduced in log4j 1.2.12.
|
||||
- final boolean traceCapable;
|
||||
-
|
||||
- Log4JLogger(Logger logger) {
|
||||
- super(logger.getName());
|
||||
- this.logger = logger;
|
||||
- traceCapable = isTraceCapable();
|
||||
- }
|
||||
-
|
||||
- private boolean isTraceCapable() {
|
||||
- try {
|
||||
- logger.isTraceEnabled();
|
||||
- return true;
|
||||
- } catch (NoSuchMethodError ignored) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Is this logger instance enabled for the TRACE level?
|
||||
- *
|
||||
- * @return True if this Logger is enabled for level TRACE, false otherwise.
|
||||
- */
|
||||
- @Override
|
||||
- public boolean isTraceEnabled() {
|
||||
- if (traceCapable) {
|
||||
- return logger.isTraceEnabled();
|
||||
- } else {
|
||||
- return logger.isDebugEnabled();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message object at level TRACE.
|
||||
- *
|
||||
- * @param msg
|
||||
- * - the message object to be logged
|
||||
- */
|
||||
- @Override
|
||||
- public void trace(String msg) {
|
||||
- logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, null);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level TRACE according to the specified format and
|
||||
- * argument.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for level TRACE.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arg
|
||||
- * the argument
|
||||
- */
|
||||
- @Override
|
||||
- public void trace(String format, Object arg) {
|
||||
- if (isTraceEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, arg);
|
||||
- logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft
|
||||
- .getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level TRACE according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the TRACE level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argA
|
||||
- * the first argument
|
||||
- * @param argB
|
||||
- * the second argument
|
||||
- */
|
||||
- @Override
|
||||
- public void trace(String format, Object argA, Object argB) {
|
||||
- if (isTraceEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, argA, argB);
|
||||
- logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft
|
||||
- .getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level TRACE according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the TRACE level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arguments
|
||||
- * an array of arguments
|
||||
- */
|
||||
- @Override
|
||||
- public void trace(String format, Object... arguments) {
|
||||
- if (isTraceEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
|
||||
- logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft
|
||||
- .getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log an exception (throwable) at level TRACE with an accompanying message.
|
||||
- *
|
||||
- * @param msg
|
||||
- * the message accompanying the exception
|
||||
- * @param t
|
||||
- * the exception (throwable) to log
|
||||
- */
|
||||
- @Override
|
||||
- public void trace(String msg, Throwable t) {
|
||||
- logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, t);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Is this logger instance enabled for the DEBUG level?
|
||||
- *
|
||||
- * @return True if this Logger is enabled for level DEBUG, false otherwise.
|
||||
- */
|
||||
- @Override
|
||||
- public boolean isDebugEnabled() {
|
||||
- return logger.isDebugEnabled();
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message object at level DEBUG.
|
||||
- *
|
||||
- * @param msg
|
||||
- * - the message object to be logged
|
||||
- */
|
||||
- @Override
|
||||
- public void debug(String msg) {
|
||||
- logger.log(FQCN, Level.DEBUG, msg, null);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level DEBUG according to the specified format and
|
||||
- * argument.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for level DEBUG.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arg
|
||||
- * the argument
|
||||
- */
|
||||
- @Override
|
||||
- public void debug(String format, Object arg) {
|
||||
- if (logger.isDebugEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, arg);
|
||||
- logger.log(FQCN, Level.DEBUG, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level DEBUG according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the DEBUG level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argA
|
||||
- * the first argument
|
||||
- * @param argB
|
||||
- * the second argument
|
||||
- */
|
||||
- @Override
|
||||
- public void debug(String format, Object argA, Object argB) {
|
||||
- if (logger.isDebugEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, argA, argB);
|
||||
- logger.log(FQCN, Level.DEBUG, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level DEBUG according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the DEBUG level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arguments an array of arguments
|
||||
- */
|
||||
- @Override
|
||||
- public void debug(String format, Object... arguments) {
|
||||
- if (logger.isDebugEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
|
||||
- logger.log(FQCN, Level.DEBUG, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log an exception (throwable) at level DEBUG with an accompanying message.
|
||||
- *
|
||||
- * @param msg
|
||||
- * the message accompanying the exception
|
||||
- * @param t
|
||||
- * the exception (throwable) to log
|
||||
- */
|
||||
- @Override
|
||||
- public void debug(String msg, Throwable t) {
|
||||
- logger.log(FQCN, Level.DEBUG, msg, t);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Is this logger instance enabled for the INFO level?
|
||||
- *
|
||||
- * @return True if this Logger is enabled for the INFO level, false otherwise.
|
||||
- */
|
||||
- @Override
|
||||
- public boolean isInfoEnabled() {
|
||||
- return logger.isInfoEnabled();
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message object at the INFO level.
|
||||
- *
|
||||
- * @param msg
|
||||
- * - the message object to be logged
|
||||
- */
|
||||
- @Override
|
||||
- public void info(String msg) {
|
||||
- logger.log(FQCN, Level.INFO, msg, null);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level INFO according to the specified format and argument.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the INFO level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arg
|
||||
- * the argument
|
||||
- */
|
||||
- @Override
|
||||
- public void info(String format, Object arg) {
|
||||
- if (logger.isInfoEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, arg);
|
||||
- logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at the INFO level according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the INFO level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argA
|
||||
- * the first argument
|
||||
- * @param argB
|
||||
- * the second argument
|
||||
- */
|
||||
- @Override
|
||||
- public void info(String format, Object argA, Object argB) {
|
||||
- if (logger.isInfoEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, argA, argB);
|
||||
- logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level INFO according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the INFO level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argArray
|
||||
- * an array of arguments
|
||||
- */
|
||||
- @Override
|
||||
- public void info(String format, Object... argArray) {
|
||||
- if (logger.isInfoEnabled()) {
|
||||
- FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
|
||||
- logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log an exception (throwable) at the INFO level with an accompanying
|
||||
- * message.
|
||||
- *
|
||||
- * @param msg
|
||||
- * the message accompanying the exception
|
||||
- * @param t
|
||||
- * the exception (throwable) to log
|
||||
- */
|
||||
- @Override
|
||||
- public void info(String msg, Throwable t) {
|
||||
- logger.log(FQCN, Level.INFO, msg, t);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Is this logger instance enabled for the WARN level?
|
||||
- *
|
||||
- * @return True if this Logger is enabled for the WARN level, false otherwise.
|
||||
- */
|
||||
- @Override
|
||||
- public boolean isWarnEnabled() {
|
||||
- return logger.isEnabledFor(Level.WARN);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message object at the WARN level.
|
||||
- *
|
||||
- * @param msg
|
||||
- * - the message object to be logged
|
||||
- */
|
||||
- @Override
|
||||
- public void warn(String msg) {
|
||||
- logger.log(FQCN, Level.WARN, msg, null);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at the WARN level according to the specified format and
|
||||
- * argument.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the WARN level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arg
|
||||
- * the argument
|
||||
- */
|
||||
- @Override
|
||||
- public void warn(String format, Object arg) {
|
||||
- if (logger.isEnabledFor(Level.WARN)) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, arg);
|
||||
- logger.log(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at the WARN level according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the WARN level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argA
|
||||
- * the first argument
|
||||
- * @param argB
|
||||
- * the second argument
|
||||
- */
|
||||
- @Override
|
||||
- public void warn(String format, Object argA, Object argB) {
|
||||
- if (logger.isEnabledFor(Level.WARN)) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, argA, argB);
|
||||
- logger.log(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level WARN according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the WARN level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argArray
|
||||
- * an array of arguments
|
||||
- */
|
||||
- @Override
|
||||
- public void warn(String format, Object... argArray) {
|
||||
- if (logger.isEnabledFor(Level.WARN)) {
|
||||
- FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
|
||||
- logger.log(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log an exception (throwable) at the WARN level with an accompanying
|
||||
- * message.
|
||||
- *
|
||||
- * @param msg
|
||||
- * the message accompanying the exception
|
||||
- * @param t
|
||||
- * the exception (throwable) to log
|
||||
- */
|
||||
- @Override
|
||||
- public void warn(String msg, Throwable t) {
|
||||
- logger.log(FQCN, Level.WARN, msg, t);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Is this logger instance enabled for level ERROR?
|
||||
- *
|
||||
- * @return True if this Logger is enabled for level ERROR, false otherwise.
|
||||
- */
|
||||
- @Override
|
||||
- public boolean isErrorEnabled() {
|
||||
- return logger.isEnabledFor(Level.ERROR);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message object at the ERROR level.
|
||||
- *
|
||||
- * @param msg
|
||||
- * - the message object to be logged
|
||||
- */
|
||||
- @Override
|
||||
- public void error(String msg) {
|
||||
- logger.log(FQCN, Level.ERROR, msg, null);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at the ERROR level according to the specified format and
|
||||
- * argument.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the ERROR level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param arg
|
||||
- * the argument
|
||||
- */
|
||||
- @Override
|
||||
- public void error(String format, Object arg) {
|
||||
- if (logger.isEnabledFor(Level.ERROR)) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, arg);
|
||||
- logger.log(FQCN, Level.ERROR, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at the ERROR level according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the ERROR level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argA
|
||||
- * the first argument
|
||||
- * @param argB
|
||||
- * the second argument
|
||||
- */
|
||||
- @Override
|
||||
- public void error(String format, Object argA, Object argB) {
|
||||
- if (logger.isEnabledFor(Level.ERROR)) {
|
||||
- FormattingTuple ft = MessageFormatter.format(format, argA, argB);
|
||||
- logger.log(FQCN, Level.ERROR, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log a message at level ERROR according to the specified format and
|
||||
- * arguments.
|
||||
- *
|
||||
- * <p>
|
||||
- * This form avoids superfluous object creation when the logger is disabled
|
||||
- * for the ERROR level.
|
||||
- * </p>
|
||||
- *
|
||||
- * @param format
|
||||
- * the format string
|
||||
- * @param argArray
|
||||
- * an array of arguments
|
||||
- */
|
||||
- @Override
|
||||
- public void error(String format, Object... argArray) {
|
||||
- if (logger.isEnabledFor(Level.ERROR)) {
|
||||
- FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
|
||||
- logger.log(FQCN, Level.ERROR, ft.getMessage(), ft.getThrowable());
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Log an exception (throwable) at the ERROR level with an accompanying
|
||||
- * message.
|
||||
- *
|
||||
- * @param msg
|
||||
- * the message accompanying the exception
|
||||
- * @param t
|
||||
- * the exception (throwable) to log
|
||||
- */
|
||||
- @Override
|
||||
- public void error(String msg, Throwable t) {
|
||||
- logger.log(FQCN, Level.ERROR, msg, t);
|
||||
- }
|
||||
-}
|
||||
diff --git a/common/src/main/java/io/netty/util/internal/logging/Log4JLoggerFactory.java b/common/src/main/java/io/netty/util/internal/logging/Log4JLoggerFactory.java
|
||||
deleted file mode 100644
|
||||
index 399a279df3..0000000000
|
||||
--- a/common/src/main/java/io/netty/util/internal/logging/Log4JLoggerFactory.java
|
||||
+++ /dev/null
|
||||
@@ -1,40 +0,0 @@
|
||||
-/*
|
||||
- * Copyright 2012 The Netty Project
|
||||
- *
|
||||
- * The Netty Project licenses this file to you under the Apache License,
|
||||
- * version 2.0 (the "License"); you may not use this file except in compliance
|
||||
- * with the License. You may obtain a copy of the License at:
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
- * License for the specific language governing permissions and limitations
|
||||
- * under the License.
|
||||
- */
|
||||
-package io.netty.util.internal.logging;
|
||||
-
|
||||
-import org.apache.log4j.Logger;
|
||||
-
|
||||
-/**
|
||||
- * Logger factory which creates an
|
||||
- * <a href="http://logging.apache.org/log4j/1.2/index.html">Apache Log4J</a>
|
||||
- * logger.
|
||||
- */
|
||||
-public class Log4JLoggerFactory extends InternalLoggerFactory {
|
||||
-
|
||||
- public static final InternalLoggerFactory INSTANCE = new Log4JLoggerFactory();
|
||||
-
|
||||
- /**
|
||||
- * @deprecated Use {@link #INSTANCE} instead.
|
||||
- */
|
||||
- @Deprecated
|
||||
- public Log4JLoggerFactory() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public InternalLogger newInstance(String name) {
|
||||
- return new Log4JLogger(Logger.getLogger(name));
|
||||
- }
|
||||
-}
|
||||
--
|
||||
2.26.2
|
||||
|
22
codegen.bash
Executable file
22
codegen.bash
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
for type in byte char short int long; do
|
||||
case $type in
|
||||
int) object=Integer ;;
|
||||
char) object=Character ;;
|
||||
*) object=${type^} ;;
|
||||
esac
|
||||
hash='(int) key'
|
||||
if [ $type = long ]; then
|
||||
hash='(int) (key ^ (key >>> 32))'
|
||||
fi
|
||||
mkdir -p target/generated-sources/collections/java
|
||||
for file in `find src/main/templates -name '*.template'`; do
|
||||
filename=$(basename $file | sed "s/K/${type^}/;s/\.template/.java/")
|
||||
sed -e "s/@k@/${type}/g" \
|
||||
-e "s/@K@/${type^}/g" \
|
||||
-e "s/@O@/${object}/g" \
|
||||
-e "s/@KEY_NUMBER_METHOD@/${type}Value/g" \
|
||||
-e "s/@HASH_CODE@/${hash}/g" \
|
||||
$file > target/generated-sources/collections/java/$filename
|
||||
done
|
||||
done
|
418
netty.spec
Normal file
418
netty.spec
Normal file
@ -0,0 +1,418 @@
|
||||
%global namedreltag .Final
|
||||
%global namedversion %{version}%{?namedreltag}
|
||||
|
||||
Name: netty
|
||||
Version: 4.1.51
|
||||
Release: 1%{?dist}
|
||||
Summary: An asynchronous event-driven network application framework and tools for Java
|
||||
License: ASL 2.0
|
||||
URL: https://netty.io/
|
||||
Source0: https://github.com/netty/netty/archive/netty-%{namedversion}.tar.gz
|
||||
# Upsteam uses a simple template generator script written in groovy and run with gmaven
|
||||
# We don't have the plugin and want to avoid groovy dependency
|
||||
# This script is written in bash+sed and performs the same task
|
||||
Source1: codegen.bash
|
||||
Patch0: 0001-Remove-optional-dep-Blockhound.patch
|
||||
Patch1: 0002-Remove-optional-dep-conscrypt.patch
|
||||
Patch2: 0003-Remove-optional-deps-jetty-alpn-and-npn.patch
|
||||
Patch3: 0004-Remove-optional-dep-tcnative.patch
|
||||
Patch4: 0005-Remove-optional-dep-log4j.patch
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: mvn(com.jcraft:jzlib)
|
||||
BuildRequires: mvn(commons-logging:commons-logging)
|
||||
BuildRequires: mvn(kr.motd.maven:os-maven-plugin)
|
||||
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
||||
BuildRequires: mvn(org.apache.maven.plugins:maven-remote-resources-plugin)
|
||||
BuildRequires: mvn(org.bouncycastle:bcpkix-jdk15on)
|
||||
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
|
||||
BuildRequires: mvn(org.codehaus.mojo:exec-maven-plugin)
|
||||
BuildRequires: mvn(org.jctools:jctools-core)
|
||||
BuildRequires: mvn(org.slf4j:slf4j-api)
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
Netty is a NIO client server framework which enables quick and easy
|
||||
development of network applications such as protocol servers and
|
||||
clients. It greatly simplifies and streamlines network programming
|
||||
such as TCP and UDP socket server.
|
||||
|
||||
'Quick and easy' doesn't mean that a resulting application will suffer
|
||||
from a maintainability or a performance issue. Netty has been designed
|
||||
carefully with the experiences earned from the implementation of a lot
|
||||
of protocols such as FTP, SMTP, HTTP, and various binary and
|
||||
text-based legacy protocols. As a result, Netty has succeeded to find
|
||||
a way to achieve ease of development, performance, stability, and
|
||||
flexibility without a compromise.
|
||||
|
||||
%package javadoc
|
||||
Summary: API documentation for %{name}
|
||||
|
||||
%description javadoc
|
||||
%{summary}.
|
||||
|
||||
%prep
|
||||
%setup -q -n netty-netty-%{namedversion}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
# remove unnecessary dependency on parent POM
|
||||
%pom_remove_parent . bom dev-tools
|
||||
|
||||
# Disable all in one jar
|
||||
%pom_disable_module all
|
||||
|
||||
# Not needed for RPM builds
|
||||
%pom_disable_module "example"
|
||||
%pom_disable_module "tarball"
|
||||
%pom_disable_module "microbench"
|
||||
|
||||
%pom_xpath_inject 'pom:plugin[pom:artifactId="maven-remote-resources-plugin"]' '
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-dev-tools</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>'
|
||||
|
||||
%pom_remove_plugin :maven-antrun-plugin
|
||||
%pom_remove_plugin :maven-dependency-plugin
|
||||
%pom_remove_plugin :xml-maven-plugin
|
||||
%pom_remove_plugin -r :maven-checkstyle-plugin
|
||||
%pom_remove_plugin -r :animal-sniffer-maven-plugin
|
||||
%pom_remove_plugin -r :maven-enforcer-plugin
|
||||
%pom_remove_plugin -r :maven-shade-plugin
|
||||
%pom_remove_plugin -r :maven-release-plugin
|
||||
%pom_remove_plugin -r :maven-clean-plugin
|
||||
%pom_remove_plugin -r :maven-source-plugin
|
||||
%pom_remove_plugin -r :maven-deploy-plugin
|
||||
%pom_remove_plugin -r :maven-jxr-plugin
|
||||
%pom_remove_plugin -r :maven-javadoc-plugin
|
||||
%pom_remove_plugin -r :forbiddenapis
|
||||
|
||||
cp %{SOURCE1} common/codegen.bash
|
||||
%pom_add_plugin org.codehaus.mojo:exec-maven-plugin common '
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-collections</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>common/codegen.bash</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
'
|
||||
%pom_remove_plugin :groovy-maven-plugin common
|
||||
|
||||
# We don't have com.oracle.substratevm
|
||||
%pom_remove_dep "com.oracle.substratevm:" common
|
||||
rm common/src/main/java/io/netty/util/internal/svm/*
|
||||
|
||||
# The protobuf-javanano API was discontinued upstream and obsoleted in Fedora
|
||||
# so disable support for protobuf in the codecs module
|
||||
%pom_remove_dep -r "com.google.protobuf:protobuf-java"
|
||||
%pom_remove_dep -r "com.google.protobuf.nano:protobuf-javanano"
|
||||
rm codec/src/main/java/io/netty/handler/codec/protobuf/*
|
||||
sed -i '/import.*protobuf/d' codec/src/main/java/io/netty/handler/codec/DatagramPacket*.java
|
||||
|
||||
# JBoss marshalling not available in Fedora
|
||||
%pom_remove_dep -r "org.jboss.marshalling:jboss-marshalling"
|
||||
rm codec/src/main/java/io/netty/handler/codec/marshalling/*
|
||||
|
||||
# Various compression codecs not available in Fedora
|
||||
%pom_remove_dep -r com.github.jponge:lzma-java
|
||||
rm codec/src/*/java/io/netty/handler/codec/compression/Lzma*.java
|
||||
%pom_remove_dep -r com.ning:compress-lzf
|
||||
rm codec/src/*/java/io/netty/handler/codec/compression/Lzf*.java
|
||||
%pom_remove_dep -r net.jpountz.lz4:lz4
|
||||
rm codec/src/*/java/io/netty/handler/codec/compression/Lz4*.java
|
||||
|
||||
# Disable other codecs with extra dependencies
|
||||
%pom_remove_dep -r com.fasterxml:aalto-xml
|
||||
%pom_disable_module codec-xml
|
||||
|
||||
# Disable unneeded transport artifacts
|
||||
%pom_disable_module transport-native-epoll
|
||||
%pom_disable_module transport-native-kqueue
|
||||
%pom_disable_module transport-native-unix-common
|
||||
%pom_disable_module transport-rxtx
|
||||
%pom_disable_module transport-sctp
|
||||
%pom_disable_module transport-udt
|
||||
|
||||
# Disable macos native bit
|
||||
%pom_disable_module resolver-dns-native-macos
|
||||
|
||||
# Disable test suites
|
||||
%pom_disable_module testsuite
|
||||
%pom_disable_module testsuite-autobahn
|
||||
%pom_disable_module testsuite-http2
|
||||
%pom_disable_module testsuite-native-image
|
||||
%pom_disable_module testsuite-osgi
|
||||
%pom_disable_module testsuite-shading
|
||||
%pom_disable_module transport-native-unix-common-tests
|
||||
|
||||
# Upstream has jctools bundled.
|
||||
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-bundle-plugin']/pom:executions/pom:execution[pom:id = 'generate-manifest']/pom:configuration/pom:instructions/pom:Import-Package" common/pom.xml
|
||||
|
||||
# Tell xmvn to install attached artifact, which it does not
|
||||
# do by default. In this case install all attached artifacts with
|
||||
# the linux classifier.
|
||||
%mvn_package ":::linux*:"
|
||||
|
||||
%build
|
||||
# Ensure we use distro compile flags
|
||||
export CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
||||
|
||||
%mvn_build -f -- -Dsource=1.8
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
||||
%files -f .mfiles
|
||||
%license LICENSE.txt NOTICE.txt
|
||||
|
||||
%files javadoc -f .mfiles-javadoc
|
||||
%license LICENSE.txt NOTICE.txt
|
||||
|
||||
%changelog
|
||||
* Mon Sep 07 2020 Mat Booth <mat.booth@redhat.com> - 4.1.51-1
|
||||
- Update to latest upstream version
|
||||
- Native bits were not used by anything, so package is now noarch
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-19
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Fri Jul 24 2020 Mat Booth <mat.booth@redhat.com> - 4.1.13-18
|
||||
- Don't ship the bundled all-in-one jar
|
||||
- Fix java 11 build
|
||||
|
||||
* Sat Jul 11 2020 Jiri Vanek <jvanek@redhat.com> - 4.1.13-17
|
||||
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
|
||||
|
||||
* Tue Jun 30 2020 Jeff Johnston <jjohnstn@redhat.com> - 4.1.13-16
|
||||
- add BR for Java 1.8.0 and set macro which can later be set to Java 11
|
||||
|
||||
* Fri Mar 27 2020 Mat Booth <mat.booth@redhat.com> - 4.1.13-15
|
||||
- Disable JIT'd builds on arm 32 temporarily due to segfault in JDK, see bug
|
||||
1818078
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Nov 21 2019 Fabio Valentini <decathorpe@gmail.com> - 4.1.13-13
|
||||
- Remove unnecessary dependency on parent POM.
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sat Jun 08 2019 Mat Booth <mbooth@apache.org> - 4.1.13-11
|
||||
- Ensure we use the JIT on 32bit arm
|
||||
|
||||
* Sun Jun 02 2019 Mat Booth <mat.booth@redhat.com> - 4.1.13-10
|
||||
- Speed up builds on 32bit arm
|
||||
|
||||
* Thu Mar 07 2019 Mat Booth <mat.booth@redhat.com> - 4.1.13-9
|
||||
- Add more artifacts to the jp_minimal conditional
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Sat Dec 08 2018 Mat Booth <mat.booth@redhat.com> - 4.1.13-7
|
||||
- Disable support for protobuf in the codecs module due to the javanano API
|
||||
being discontinued upstream and obsoleted in Fedora
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Apr 25 2018 Michael Simacek <msimacek@redhat.com> - 4.1.13-5
|
||||
- Remove log4j from jp_minimal build
|
||||
|
||||
* Tue Apr 24 2018 mskalick@redhat.com - 4.1.13-4
|
||||
- Remove org.eclipse.jetty.alpn dependency for jp_minimal
|
||||
|
||||
* Tue Apr 24 2018 Michael Simacek <msimacek@redhat.com> - 4.1.13-3
|
||||
- Don't package test artifacts
|
||||
|
||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.13-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Mon Aug 14 2017 Michael Simacek <msimacek@redhat.com> - 4.1.13-1
|
||||
- Update to upstream version 4.1.13
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.42-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.42-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Wed Mar 29 2017 Michael Simacek <msimacek@redhat.com> - 4.0.42-5
|
||||
- Keep Import-Package default value
|
||||
|
||||
* Thu Mar 16 2017 Michael Simacek <msimacek@redhat.com> - 4.0.42-4
|
||||
- Remove maven-javadoc-plugin from POM
|
||||
|
||||
* Wed Mar 15 2017 Michael Simacek <msimacek@redhat.com> - 4.0.42-3
|
||||
- Add jp_minimal conditional
|
||||
|
||||
* Mon Feb 06 2017 Michael Simacek <msimacek@redhat.com> - 4.0.42-2
|
||||
- Remove useless plugins
|
||||
|
||||
* Thu Oct 20 2016 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.42-1
|
||||
- Remove old netty4 provides/obsoletes.
|
||||
|
||||
* Thu Oct 20 2016 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.42-1
|
||||
- Update to upstream 4.0.42 release.
|
||||
- Resolves RHBZ#1380921
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.28-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0.28-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Wed May 20 2015 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.28-1
|
||||
- Update to upstream 4.0.28 release.
|
||||
- Fixes CVE-2015-2156 (HttpOnly cookie bypass).
|
||||
- Resolves RHBZ#1111502
|
||||
|
||||
* Wed May 20 2015 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.27-1
|
||||
- Update to upstream 4.0.27 release.
|
||||
|
||||
* Wed Apr 01 2015 Severin Gehwolf <sgehwolf@redhat.com> - 4.0.19-3
|
||||
- Drop mvn(org.easymock:easymockclassextension) BR.
|
||||
Resolves: RHBZ#1207991
|
||||
|
||||
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0.19-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Mon Jun 9 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.19-1
|
||||
- Update to upstream version 4.0.19
|
||||
- Convert to arch-specific package
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0.14-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Tue Mar 04 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 4.0.14-4
|
||||
- Use Requires: java-headless rebuild (#1067528)
|
||||
|
||||
* Mon Jan 13 2014 Marek Goldmann <mgoldman@redhat.com> - 4.0.14-3
|
||||
- Enable netty-all.jar artifact
|
||||
|
||||
* Mon Jan 13 2014 Marek Goldmann <mgoldman@redhat.com> - 4.0.14-2
|
||||
- Bump the release, so Obsoletes work properly
|
||||
|
||||
* Mon Dec 30 2013 Marek Goldmann <mgoldman@redhat.com> - 4.0.14-1
|
||||
- Upstream release 4.0.14.Final
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.6-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Thu May 16 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.6-1
|
||||
- Update to upstream version 3.6.6
|
||||
|
||||
* Wed Apr 10 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.5-1
|
||||
- Update to upstream version 3.6.5
|
||||
|
||||
* Mon Apr 8 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.4-1
|
||||
- Update to upstream version 3.6.4
|
||||
|
||||
* Wed Feb 27 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.3-3
|
||||
- Set scope of optional compile dependencies to 'provided'
|
||||
|
||||
* Wed Feb 27 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.3-2
|
||||
- Drop dependency on OSGi
|
||||
- Resolves: rhbz#916139
|
||||
|
||||
* Mon Feb 25 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.3-1
|
||||
- Update to upstream version 3.6.3
|
||||
|
||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Wed Feb 06 2013 Java SIG <java-devel@lists.fedoraproject.org> - 3.6.2-2
|
||||
- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild
|
||||
- Replace maven BuildRequires with maven-local
|
||||
|
||||
* Wed Jan 16 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.2-1
|
||||
- Update to upstream version 3.6.2
|
||||
|
||||
* Tue Jan 15 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.6.1-1
|
||||
- Update to upstream version 3.6.1
|
||||
|
||||
* Thu Dec 13 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.11-2
|
||||
- Use system jzlib instead of bundled jzlib
|
||||
- Resolves: rhbz#878391
|
||||
|
||||
* Mon Dec 3 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.11-1
|
||||
- Update to upstream version 3.5.11
|
||||
|
||||
* Mon Nov 12 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.10-1
|
||||
- Update to upstream version 3.5.10
|
||||
|
||||
* Thu Oct 25 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.9-1
|
||||
- Update to upstream version 3.5.9
|
||||
|
||||
* Fri Oct 5 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.8-1
|
||||
- Update to upstream version 3.5.8
|
||||
|
||||
* Fri Sep 7 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.7-1
|
||||
- Update to upstream version 3.5.7
|
||||
|
||||
* Mon Sep 3 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.6-1
|
||||
- Update to upstream version 3.5.6
|
||||
|
||||
* Thu Aug 23 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.5-1
|
||||
- Update to upstream version 3.5.5
|
||||
|
||||
* Wed Aug 15 2012 Tomas Rohovsky <trohovsk@redhat.com> - 3.5.4-1
|
||||
- Update to upstream version 3.5.4
|
||||
|
||||
* Tue Jul 24 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.3-1
|
||||
- Update to upstream version 3.5.3
|
||||
|
||||
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.5.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Mon Jul 16 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.2-2
|
||||
- Add additional depmap for org.jboss.netty:netty
|
||||
- Fixes #840301
|
||||
|
||||
* Thu Jul 12 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.2-1
|
||||
- Update to upstream version 3.5.2
|
||||
- Convert patches to POM macros
|
||||
- Enable jboss-logging
|
||||
|
||||
* Fri May 18 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.2.4-4
|
||||
- Add enforcer-plugin to BR
|
||||
|
||||
* Wed Apr 18 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.2.4-3
|
||||
- Remove eclipse plugin from BuildRequires
|
||||
|
||||
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
* Mon Dec 5 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.2.4-1
|
||||
- Update to latest upstream version
|
||||
|
||||
* Mon Jul 4 2011 Alexander Kurtakov <akurtako@redhat.com> 3.2.3-4
|
||||
- Fix FTBFS.
|
||||
- Adapt to current guidelines.
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Mon Jan 17 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.2.3-2
|
||||
- Use maven 3 to build
|
||||
- Drop ant-contrib depmap (no longer needed)
|
||||
|
||||
* Thu Jan 13 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.2.3-1
|
||||
- Initial version of the package
|
Loading…
Reference in New Issue
Block a user