You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2016/02/29 10:02:34 UTC

lucene-solr git commit: LUCENE-6989: Also print missing permission if unmap hack does not work; rename method to make stack trace look nice while executing unmapping

Repository: lucene-solr
Updated Branches:
  refs/heads/master 8ffa436f0 -> 5f9db0183


LUCENE-6989: Also print missing permission if unmap hack does not work; rename method to make stack trace look nice while executing unmapping


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5f9db018
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5f9db018
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5f9db018

Branch: refs/heads/master
Commit: 5f9db018337c8173201b1b542e8ea7c38feecd00
Parents: 8ffa436
Author: Uwe Schindler <us...@apache.org>
Authored: Mon Feb 29 10:01:43 2016 +0100
Committer: Uwe Schindler <us...@apache.org>
Committed: Mon Feb 29 10:01:43 2016 +0100

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/store/MMapDirectory.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5f9db018/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
----------------------------------------------------------------------
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 ff16324..60ca103 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
@@ -323,7 +323,7 @@ public class MMapDirectory extends FSDirectory {
   private static final BufferCleaner CLEANER;
   
   static {
-    final Object hack = AccessController.doPrivileged((PrivilegedAction<Object>) MMapDirectory::initUnmapHack);
+    final Object hack = AccessController.doPrivileged((PrivilegedAction<Object>) MMapDirectory::unmapHackImpl);
     if (hack instanceof BufferCleaner) {
       CLEANER = (BufferCleaner) hack;
       UNMAP_SUPPORTED = true;
@@ -336,7 +336,7 @@ public class MMapDirectory extends FSDirectory {
   }
   
   @SuppressForbidden(reason = "Needs access to private APIs in DirectBuffer and sun.misc.Cleaner to enable hack")
-  private static Object initUnmapHack() {
+  private static Object unmapHackImpl() {
     final Lookup lookup = lookup();
     try {
       final Class<?> directBufferClass = Class.forName("java.nio.DirectByteBuffer");
@@ -388,10 +388,10 @@ public class MMapDirectory extends FSDirectory {
     } catch (ReflectiveOperationException e) {
       return "Unmapping is not supported on this platform, because internal Java APIs are not compatible to this Lucene version: " + e; 
     } catch (SecurityException e) {
-      return "Unmapping is not supported, because not all required permissions are given to the Lucene JAR file. " +
-          "Please grant at least the following permissions: RuntimePermission(\"accessClassInPackage.sun.misc\"), " +
+      return "Unmapping is not supported, because not all required permissions are given to the Lucene JAR file: " + e +
+          " [Please grant at least the following permissions: RuntimePermission(\"accessClassInPackage.sun.misc\"), " +
           "RuntimePermission(\"accessClassInPackage.jdk.internal.ref\"), and " +
-          "ReflectPermission(\"suppressAccessChecks\")";
+          "ReflectPermission(\"suppressAccessChecks\")]";
     }
   }