You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/09/10 03:20:24 UTC

svn commit: r1702141 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java

Author: rmuir
Date: Thu Sep 10 01:20:23 2015
New Revision: 1702141

URL: http://svn.apache.org/r1702141
Log:
LUCENE-6795: remove reflection hack completely, see http://mail.openjdk.java.net/pipermail/nio-dev/2015-September/003322.html

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java

Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java?rev=1702141&r1=1702140&r2=1702141&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileChannel.java Thu Sep 10 01:20:23 2015
@@ -17,17 +17,13 @@ package org.apache.lucene.mockfile;
  * limitations under the License.
  */
 
-import java.io.IOError;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.WritableByteChannel;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.Objects;
 
 /**  
@@ -138,27 +134,8 @@ public class FilterFileChannel extends F
 
   @Override
   protected void implCloseChannel() throws IOException {
-    // our only way to call delegate.implCloseChannel()
-    AccessController.doPrivileged(new PrivilegedAction<Void>() {
-      @Override
-      public Void run() {
-        for (Class<?> clazz = delegate.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
-          final Method method;
-          try {
-            method = clazz.getDeclaredMethod("implCloseChannel");
-          } catch (NoSuchMethodException e) {
-            continue;
-          }
-          try {
-            method.setAccessible(true);
-            method.invoke(delegate);
-            return null;
-          } catch (ReflectiveOperationException e) {
-            throw new IOError(e);
-          }
-        }
-        throw new AssertionError();
-      }
-    });
+    // we can't call implCloseChannel, but calling this instead is "ok":
+    // http://mail.openjdk.java.net/pipermail/nio-dev/2015-September/003322.html
+    delegate.close();
   }
 }