Apache Lucene open-source search software
LUCENE-6618: MMapDirectory.checkUnmapSupported is buggy
Robert Muirb745a9f608eb
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 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.javaindex 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;