From 955029d30dda42d73c69a8e8137a5130755731f7 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 31 Aug 2016 08:20:52 -0400 Subject: [PATCH] Skip transport client plugin installed on JDK 9 This commit adds an assumption to PreBuiltTransportClientTests#testPluginInstalled on JDK 9. The underlying issue is that Netty attempts to access sun.nio.ch but this package is not exported from java.base on JDK 9. This throws an uncaught InaccessibleObjectException causing the test to fail. This assumption can be removed when Netty 4.1.6 is released as it will include a fix for this scenario. --- .../transport/client/PreBuiltTransportClientTests.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/transport/src/test/java/org/elasticsearch/transport/client/PreBuiltTransportClientTests.java b/client/transport/src/test/java/org/elasticsearch/transport/client/PreBuiltTransportClientTests.java index 0b7c3380b94d9..a1d95b68af703 100644 --- a/client/transport/src/test/java/org/elasticsearch/transport/client/PreBuiltTransportClientTests.java +++ b/client/transport/src/test/java/org/elasticsearch/transport/client/PreBuiltTransportClientTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.transport.client; import com.carrotsearch.randomizedtesting.RandomizedTest; +import org.apache.lucene.util.Constants; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; @@ -40,6 +41,8 @@ public class PreBuiltTransportClientTests extends RandomizedTest { @Test public void testPluginInstalled() { + // TODO: remove when Netty 4.1.5 is upgraded to Netty 4.1.6 including https://github.com/netty/netty/pull/5778 + assumeFalse(Constants.JRE_IS_MINIMUM_JAVA9); try (TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)) { Settings settings = client.settings(); assertEquals(Netty4Plugin.NETTY_TRANSPORT_NAME, NetworkModule.HTTP_DEFAULT_TYPE_SETTING.get(settings)); @@ -49,9 +52,7 @@ public void testPluginInstalled() { @Test public void testInstallPluginTwice() { - - for (Class plugin : Arrays.asList(ReindexPlugin.class, PercolatorPlugin.class, - MustachePlugin.class)) { + for (Class plugin : Arrays.asList(ReindexPlugin.class, PercolatorPlugin.class, MustachePlugin.class)) { try { new PreBuiltTransportClient(Settings.EMPTY, plugin); fail("exception expected");