LUCENE-7135: work around security manager when checking for 32/64 bit JVM

This commit is contained in:
Mike McCandless 2016-10-30 20:04:37 -04:00
parent dbc2bc7ce8
commit 813b685565
2 changed files with 14 additions and 8 deletions

View File

@ -110,6 +110,10 @@ Bug Fixes
* LUCENE-7429: AnalyzerWrapper can now modify the normalization chain too and * LUCENE-7429: AnalyzerWrapper can now modify the normalization chain too and
DelegatingAnalyzerWrapper does the right thing automatically. (Adrien Grand) 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 Improvements
* LUCENE-7439: FuzzyQuery now matches all terms within the specified * LUCENE-7439: FuzzyQuery now matches all terms within the specified

View File

@ -68,15 +68,17 @@ public final class Constants {
JVM_MINOR_VERSION = 0; JVM_MINOR_VERSION = 0;
} }
boolean is64Bit = false; boolean is64Bit = false;
final String x = System.getProperty("sun.arch.data.model"); String datamodel = null;
if (x != null) { try {
is64Bit = x.contains("64"); datamodel = System.getProperty("sun.arch.data.model");
} else { if (datamodel != null) {
if (OS_ARCH != null && OS_ARCH.contains("64")) { is64Bit = datamodel.contains("64");
is64Bit = true;
} else {
is64Bit = false;
} }
} catch (SecurityException ex) {}
if (datamodel == null && OS_ARCH != null && OS_ARCH.contains("64")) {
is64Bit = true;
} else {
is64Bit = false;
} }
JRE_IS_64BIT = is64Bit; JRE_IS_64BIT = is64Bit;
} }