You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2016/10/31 15:14:59 UTC

[07/15] lucene-solr:jira/solr-8593: LUCENE-7135: work around security manager when checking for 32/64 bit JVM

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


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

Branch: refs/heads/jira/solr-8593
Commit: 813b6855656ecd50a7a28376822bd7b65154cee8
Parents: dbc2bc7
Author: Mike McCandless <mi...@apache.org>
Authored: Sun Oct 30 20:04:37 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Sun Oct 30 20:04:37 2016 -0400

----------------------------------------------------------------------
 lucene/CHANGES.txt                                |  4 ++++
 .../java/org/apache/lucene/util/Constants.java    | 18 ++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/813b6855/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 5a6601b..385a9ae 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -110,6 +110,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

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/813b6855/lucene/core/src/java/org/apache/lucene/util/Constants.java
----------------------------------------------------------------------
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 7df0efc..e6a9609 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;
   }