lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1618276 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/test-framework/ lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
Date Fri, 15 Aug 2014 21:17:22 GMT
Author: uschindler
Date: Fri Aug 15 21:17:22 2014
New Revision: 1618276

URL: http://svn.apache.org/r1618276
Log:
Merged revision(s) 1618275 from lucene/dev/trunk:
SOLR-6382: Add Java9 fix for RAMUsageTester (SecurityException when trying to do reflection
on Class class)

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java

Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java?rev=1618276&r1=1618275&r2=1618276&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
Fri Aug 15 21:17:22 2014
@@ -191,6 +191,10 @@ public final class RamUsageTester {
     long shallowInstanceSize = RamUsageEstimator.NUM_BYTES_OBJECT_HEADER;
     final ArrayList<Field> referenceFields = new ArrayList<>(32);
     for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
+      if (c == Class.class) {
+        // prevent inspection of Class' fields, throws SecurityException in Java 9!
+        continue; 
+      }
       final Field[] fields = c.getDeclaredFields();
       for (final Field f : fields) {
         if (!Modifier.isStatic(f.getModifiers())) {



Mime
View raw message