From 687561e1c9d990c07ffdbdc579b1f102c7d3c82e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 21 Sep 2017 09:02:24 +1000 Subject: [PATCH] Issue#215 fixed tests dependencies --- .../client/ALPNClientConnectionFactory.java | 18 ++++++++++++++- .../server/ALPNServerConnectionFactory.java | 17 +++++++++++++- jetty-http2/http2-alpn-tests/pom.xml | 23 ++++++++++++++----- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/jetty-alpn/jetty-alpn-client/src/main/java/org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory.java b/jetty-alpn/jetty-alpn-client/src/main/java/org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory.java index a7203cd12b4..1fc8b560956 100644 --- a/jetty-alpn/jetty-alpn-client/src/main/java/org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory.java +++ b/jetty-alpn/jetty-alpn-client/src/main/java/org/eclipse/jetty/alpn/client/ALPNClientConnectionFactory.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.alpn.client; import java.io.IOException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ServiceLoader; @@ -54,8 +55,23 @@ public class ALPNClientConnectionFactory extends NegotiatingClientConnectionFact this.protocols = protocols; IllegalStateException failure = new IllegalStateException("No Client ALPNProcessors!"); - for (Client processor : ServiceLoader.load(Client.class)) + + // Use a for loop on iterator so load exceptions can be caught and ignored + for (Iterator i = ServiceLoader.load(Client.class).iterator(); i.hasNext();) { + Client processor; + try + { + processor = i.next(); + } + catch(Throwable x) + { + if (LOG.isDebugEnabled()) + LOG.debug(x); + failure.addSuppressed(x); + continue; + } + try { processor.init(); diff --git a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java index 0bf03f6ddd3..56135bd008d 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java +++ b/jetty-alpn/jetty-alpn-server/src/main/java/org/eclipse/jetty/alpn/server/ALPNServerConnectionFactory.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.alpn.server; import java.util.ArrayList; import java.util.Arrays; +import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; @@ -50,8 +51,22 @@ public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFact super("alpn", protocols); IllegalStateException failure = new IllegalStateException("No Server ALPNProcessors!"); - for (Server processor : ServiceLoader.load(Server.class)) + // Use a for loop on iterator so load exceptions can be caught and ignored + for (Iterator i = ServiceLoader.load(Server.class).iterator(); i.hasNext();) { + Server processor; + try + { + processor = i.next(); + } + catch(Throwable x) + { + if (LOG.isDebugEnabled()) + LOG.debug(x); + failure.addSuppressed(x); + continue; + } + try { processor.init(); diff --git a/jetty-http2/http2-alpn-tests/pom.xml b/jetty-http2/http2-alpn-tests/pom.xml index ca55d3fa952..c472fa13921 100644 --- a/jetty-http2/http2-alpn-tests/pom.xml +++ b/jetty-http2/http2-alpn-tests/pom.xml @@ -50,12 +50,6 @@ - - org.eclipse.jetty - jetty-alpn-java-server - ${project.version} - test - org.eclipse.jetty jetty-alpn-openjdk8-server @@ -86,4 +80,21 @@ + + + jdk9 + + [1.9,) + + + + + org.eclipse.jetty + jetty-alpn-java-server + ${project.version} + test + + + +