Issue#215 fixed tests dependencies

This commit is contained in:
Greg Wilkins 2017-09-21 09:02:24 +10:00
parent 817dabe873
commit 687561e1c9
3 changed files with 50 additions and 8 deletions

View File

@ -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<Client> 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();

View File

@ -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<Server> 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();

View File

@ -50,12 +50,6 @@
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-openjdk8-server</artifactId>
@ -86,4 +80,21 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>jdk9</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>