From 4059d7c18d29b491907ce4b1c30aa24e34ddda5f Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 30 Jun 2015 00:16:39 -0400 Subject: [PATCH] tests: fix test bugs --- .../test/java/org/elasticsearch/bootstrap/SecurityTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java b/core/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java index 1e4fc0159ce..980e9dca341 100644 --- a/core/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java +++ b/core/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java @@ -184,7 +184,10 @@ public class SecurityTests extends ElasticsearchTestCase { public void testUnsafeAccess() throws Exception { assumeTrue("test requires security manager", System.getSecurityManager() != null); try { - Class.forName("sun.misc.Unsafe"); + // class could be legitimately loaded, so we might not fail until setAccessible + Class.forName("sun.misc.Unsafe") + .getDeclaredField("theUnsafe") + .setAccessible(true); fail("didn't get expected exception"); } catch (SecurityException expected) { // ok