lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whosc...@apache.org
Subject svn commit: r475844 - /lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
Date Thu, 16 Nov 2006 18:16:28 GMT
Author: whoschek
Date: Thu Nov 16 10:16:27 2006
New Revision: 475844

URL: http://svn.apache.org/viewvc?view=rev&rev=475844
Log:
better memory estimate

Modified:
    lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java

Modified: lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?view=diff&rev=475844&r1=475843&r2=475844
==============================================================================
--- lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
(original)
+++ lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
Thu Nov 16 10:16:27 2006
@@ -478,11 +478,15 @@
   } 
 
   private static boolean is64BitVM() {
-    int bits = Integer.getInteger("sun.arch.data.model", 0).intValue();
-    if (bits != 0) return bits == 64;
-        
-    // fallback if sun.arch.data.model isn't available
-    return System.getProperty("java.vm.name").toLowerCase().indexOf("64") >= 0;
+    try {
+      int bits = Integer.getInteger("sun.arch.data.model", 0).intValue();
+      if (bits != 0) return bits == 64;
+            
+      // fallback if sun.arch.data.model isn't available
+      return System.getProperty("java.vm.name").toLowerCase().indexOf("64") >= 0;
+    } catch (Throwable t) {
+      return false; // better safe than sorry (applets, security managers, etc.) ...
+    }
   }
     
   private int numPositions(ArrayIntList positions) {



Mime
View raw message