From b745a9f608ebdb5f965dffb9a2345378986d3a42 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 14 Aug 2015 11:24:09 +0000 Subject: [PATCH] LUCENE-6618: MMapDirectory.checkUnmapSupported is buggy git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1695859 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 +++ .../core/src/java/org/apache/lucene/store/MMapDirectory.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 83bd5ad1a4b..8677c6e7861 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -70,6 +70,9 @@ Bug Fixes * LUCENE-6730: Hyper-parameter c is ignored in term frequency NormalizationH1. (Ahmet Arslan via Robert Muir) +* LUCENE-6618: Properly set MMapDirectory.UNMAP_SUPPORTED when it is now allowed + by security policy. (Robert Muir) + Other * LUCENE-6174: Improve "ant eclipse" to select right JRE for building. diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java index 4d828a603cf..65486d41d77 100644 --- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java +++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java @@ -167,7 +167,9 @@ public class MMapDirectory extends FSDirectory { private static boolean checkUnmapSupported() { try { - Class.forName("java.nio.DirectByteBuffer").getMethod("cleaner"); + Class clazz = Class.forName("java.nio.DirectByteBuffer"); + Method method = clazz.getMethod("cleaner"); + method.setAccessible(true); return true; } catch (Exception e) { return false;