From 99e5b118bdc853610387d3b55c330e4178c39db1 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 24 Apr 2017 11:03:57 +0200 Subject: [PATCH] Fixes to make code compatible with JDK 9. --- .../jetty/annotations/AnnotationParser.java | 4 ++-- .../io/SelectChannelEndPointSslTest.java | 21 +++++++------------ .../jetty/webapp/ClasspathPatternTest.java | 5 +++++ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java index 16f7a290838..1520370a86a 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationParser.java @@ -581,7 +581,7 @@ public class AnnotationParser throws Exception { Class cz = clazz; - while (cz != null) + while (cz != Object.class) { if (!isParsed(cz.getName())) { @@ -601,7 +601,7 @@ public class AnnotationParser if (visitSuperClasses) cz = cz.getSuperclass(); else - cz = null; + break; } } diff --git a/jetty-io/src/test/java/org/eclipse/jetty/io/SelectChannelEndPointSslTest.java b/jetty-io/src/test/java/org/eclipse/jetty/io/SelectChannelEndPointSslTest.java index a4da692b838..acafab0fdbd 100644 --- a/jetty-io/src/test/java/org/eclipse/jetty/io/SelectChannelEndPointSslTest.java +++ b/jetty-io/src/test/java/org/eclipse/jetty/io/SelectChannelEndPointSslTest.java @@ -18,10 +18,6 @@ package org.eclipse.jetty.io; -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - import java.io.File; import java.io.IOException; import java.net.Socket; @@ -37,15 +33,21 @@ import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocket; import org.eclipse.jetty.io.ssl.SslConnection; +import org.eclipse.jetty.toolchain.test.JDK; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.annotation.Stress; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.junit.Assert; +import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest { @@ -261,6 +263,8 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest @Test public void checkSslEngineBehaviour() throws Exception { + Assume.assumeFalse(JDK.IS_9); + SSLEngine server = __sslCtxFactory.newSSLEngine(); SSLEngine client = __sslCtxFactory.newSSLEngine(); @@ -297,13 +301,11 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest netC2S.flip(); assertEquals(netC2S.remaining(),result.bytesProduced()); - // start the server server.setUseClientMode(false); server.beginHandshake(); Assert.assertEquals(HandshakeStatus.NEED_UNWRAP,server.getHandshakeStatus()); - // what if we try a needless wrap? serverOut.put(BufferUtil.toBuffer("Hello World")); serverOut.flip(); @@ -314,7 +316,6 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest assertEquals(0,result.bytesProduced()); assertEquals(HandshakeStatus.NEED_UNWRAP,result.getHandshakeStatus()); - // Do the needed unwrap, to an empty buffer result=server.unwrap(netC2S,BufferUtil.EMPTY_BUFFER); assertEquals(SSLEngineResult.Status.BUFFER_OVERFLOW,result.getStatus()); @@ -322,7 +323,6 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest assertEquals(0,result.bytesProduced()); assertEquals(HandshakeStatus.NEED_UNWRAP,result.getHandshakeStatus()); - // Do the needed unwrap, to a full buffer serverIn.position(serverIn.limit()); result=server.unwrap(netC2S,serverIn); @@ -331,7 +331,6 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest assertEquals(0,result.bytesProduced()); assertEquals(HandshakeStatus.NEED_UNWRAP,result.getHandshakeStatus()); - // Do the needed unwrap, to an empty buffer serverIn.clear(); result=server.unwrap(netC2S,serverIn); @@ -343,9 +342,5 @@ public class SelectChannelEndPointSslTest extends SelectChannelEndPointTest server.getDelegatedTask().run(); assertEquals(HandshakeStatus.NEED_WRAP,server.getHandshakeStatus()); - - - - } } diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java index 8482107d30d..468ea5068d4 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClasspathPatternTest.java @@ -25,6 +25,7 @@ import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.resource.Resource; import org.hamcrest.Matchers; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; import sun.security.provider.Sun; @@ -114,6 +115,8 @@ public class ClasspathPatternTest @Test public void testIncludedLocations() throws Exception { + Assume.assumeFalse(JDK.IS_9); + // jar from JVM classloader Resource loc_string = TypeUtil.getLoadedFrom(String.class); // System.err.println(loc_string); @@ -167,6 +170,8 @@ public class ClasspathPatternTest @Test public void testExcludeLocations() throws Exception { + Assume.assumeFalse(JDK.IS_9); + // jar from JVM classloader Resource loc_string = TypeUtil.getLoadedFrom(String.class); // System.err.println(loc_string);