diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index aebfa596825..981e87614d1 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -59,6 +59,10 @@ Bug Fixes * LUCENE-7429: AnalyzerWrapper can now modify the normalization chain too and DelegatingAnalyzerWrapper does the right thing automatically. (Adrien Grand) +* Lucene's check for 32 or 64 bit JVM now works around security + manager blocking access to some properties (Aaron Madlon-Kay via + Mike McCandless) + Improvements * LUCENE-7439: FuzzyQuery now matches all terms within the specified diff --git a/lucene/core/src/java/org/apache/lucene/util/Constants.java b/lucene/core/src/java/org/apache/lucene/util/Constants.java index 7df0efca4c5..e6a96096616 100644 --- a/lucene/core/src/java/org/apache/lucene/util/Constants.java +++ b/lucene/core/src/java/org/apache/lucene/util/Constants.java @@ -68,15 +68,17 @@ public final class Constants { JVM_MINOR_VERSION = 0; } boolean is64Bit = false; - final String x = System.getProperty("sun.arch.data.model"); - if (x != null) { - is64Bit = x.contains("64"); - } else { - if (OS_ARCH != null && OS_ARCH.contains("64")) { - is64Bit = true; - } else { - is64Bit = false; + String datamodel = null; + try { + datamodel = System.getProperty("sun.arch.data.model"); + if (datamodel != null) { + is64Bit = datamodel.contains("64"); } + } catch (SecurityException ex) {} + if (datamodel == null && OS_ARCH != null && OS_ARCH.contains("64")) { + is64Bit = true; + } else { + is64Bit = false; } JRE_IS_64BIT = is64Bit; }