From b6e603a467bf5670d94055d973b540968c00e328 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 17 Jan 2017 11:31:03 +0100 Subject: [PATCH 1/2] Issue #486 - JDK 9 ALPN implementation. Prevented NPEs in case there is no ALPN provider. --- .../jetty/alpn/java/client/JDK9ClientALPNProcessor.java | 3 ++- .../jetty/alpn/java/server/JDK9ServerALPNProcessor.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jetty-alpn/jetty-alpn-java-client/src/main/java/org/eclipse/jetty/alpn/java/client/JDK9ClientALPNProcessor.java b/jetty-alpn/jetty-alpn-java-client/src/main/java/org/eclipse/jetty/alpn/java/client/JDK9ClientALPNProcessor.java index fff7072b959..b06fc76b275 100644 --- a/jetty-alpn/jetty-alpn-java-client/src/main/java/org/eclipse/jetty/alpn/java/client/JDK9ClientALPNProcessor.java +++ b/jetty-alpn/jetty-alpn-java-client/src/main/java/org/eclipse/jetty/alpn/java/client/JDK9ClientALPNProcessor.java @@ -44,7 +44,8 @@ public class JDK9ClientALPNProcessor implements ALPNProcessor.Client try { ALPN.ClientProvider provider = (ALPN.ClientProvider)ALPN.get(sslEngine); - provider.selected(sslEngine.getApplicationProtocol()); + if (provider != null) + provider.selected(sslEngine.getApplicationProtocol()); } catch (SSLException x) { diff --git a/jetty-alpn/jetty-alpn-java-server/src/main/java/org/eclipse/jetty/alpn/java/server/JDK9ServerALPNProcessor.java b/jetty-alpn/jetty-alpn-java-server/src/main/java/org/eclipse/jetty/alpn/java/server/JDK9ServerALPNProcessor.java index 44241ff3f3e..34c9424e9ae 100644 --- a/jetty-alpn/jetty-alpn-java-server/src/main/java/org/eclipse/jetty/alpn/java/server/JDK9ServerALPNProcessor.java +++ b/jetty-alpn/jetty-alpn-java-server/src/main/java/org/eclipse/jetty/alpn/java/server/JDK9ServerALPNProcessor.java @@ -46,7 +46,7 @@ public class JDK9ServerALPNProcessor implements ALPNProcessor.Server, SslHandsha if (LOG.isDebugEnabled()) LOG.debug("ALPN selecting among client{}", protocols); ALPN.ServerProvider provider = (ALPN.ServerProvider)ALPN.remove(sslEngine); - return provider.select(protocols); + return provider == null ? "" : provider.select(protocols); } catch (SSLException x) { From 9e9ee03d7f1858a724aeab0c6a0b6b605960489d Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 17 Jan 2017 11:32:20 +0100 Subject: [PATCH 2/2] Issue #1073 - JDK9 support in Jetty 9.3.x. Fixed dependencies for modules that run tests that require ALPN. --- .../http2-http-client-transport/pom.xml | 19 +++++++++ jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 22 +--------- tests/test-http-client-transport/pom.xml | 41 +++++++++++++++---- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/jetty-http2/http2-http-client-transport/pom.xml b/jetty-http2/http2-http-client-transport/pom.xml index 5f13c29a894..18b22ef1d01 100644 --- a/jetty-http2/http2-http-client-transport/pom.xml +++ b/jetty-http2/http2-http-client-transport/pom.xml @@ -55,6 +55,25 @@ + + jdk9 + + [1.9,) + + + + org.eclipse.jetty + jetty-alpn-java-client + ${project.version} + + + org.eclipse.jetty + jetty-alpn-java-server + ${project.version} + test + + + diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index b1b7ff5671b..149f6a51bd4 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -36,7 +36,7 @@ - jdk9 + jdk8 [1.8,1.9) diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 7c223579b61..a63d1afd88a 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -20,7 +20,6 @@ - org.ops4j.pax.exam pax-exam @@ -33,16 +32,13 @@ ${exam.version} test - - - + org.ops4j.pax.exam pax-exam-container-forked ${exam.version} test - org.ops4j.pax.exam pax-exam-junit4 @@ -95,7 +91,6 @@ test - org.eclipse.jetty.osgi @@ -129,7 +124,6 @@ - org.eclipse.jetty.osgi jetty-httpservice @@ -142,14 +136,12 @@ jetty-osgi-servlet-api 3.1.0.M3 - org.apache.geronimo.specs geronimo-jta_1.1_spec 1.1.1 test - org.apache.geronimo.specs geronimo-atinject_1.0_spec @@ -162,7 +154,6 @@ 1.0.1 test - org.glassfish.web javax.servlet.jsp.jstl @@ -186,7 +177,6 @@ - org.eclipse.jetty.orbit javax.servlet.jsp.jstl @@ -339,8 +329,6 @@ jetty-schemas runtime - - org.eclipse.jetty jetty-plus @@ -356,7 +344,6 @@ webbundle test - org.eclipse.jetty.tests test-spec-webapp @@ -364,28 +351,23 @@ war test - org.eclipse.jetty.tests test-container-initializer ${project.version} test - org.eclipse.jetty.osgi test-jetty-osgi-fragment ${project.version} test - - org.eclipse.jetty.tests test-mock-resources ${project.version} - org.eclipse.jetty.osgi test-jetty-osgi-context @@ -410,7 +392,7 @@ maven-surefire-plugin - + -Dmortbay-alpn-boot=${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn.version}/alpn-boot-${alpn.version}.jar diff --git a/tests/test-http-client-transport/pom.xml b/tests/test-http-client-transport/pom.xml index 1272b9ad734..e697a7fb6ab 100644 --- a/tests/test-http-client-transport/pom.xml +++ b/tests/test-http-client-transport/pom.xml @@ -54,19 +54,44 @@ - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - + + jdk9 + + [1.9,) + + + + org.eclipse.jetty + jetty-alpn-java-client + ${project.version} + test + + + org.eclipse.jetty + jetty-alpn-java-server + ${project.version} + test + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + + org.eclipse.jetty