You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/01/28 11:12:10 UTC

svn commit: r1439327 - /lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java

Author: shaie
Date: Mon Jan 28 10:12:09 2013
New Revision: 1439327

URL: http://svn.apache.org/viewvc?rev=1439327&view=rev
Log:
LUCENE-4711: workaround to J9 1.7.0 JIT bug

Modified:
    lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java

Modified: lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java?rev=1439327&r1=1439326&r2=1439327&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java (original)
+++ lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/CategoryPath.java Mon Jan 28 10:12:09 2013
@@ -1,6 +1,5 @@
 package org.apache.lucene.facet.taxonomy;
 
-import org.apache.lucene.util.Constants;
 
 
 /*
@@ -28,10 +27,6 @@ import org.apache.lucene.util.Constants;
  */
 public class CategoryPath implements Comparable<CategoryPath> {
 
-  // TODO: revisit when IBM releases Java 7 newer than SR3 (with a fix)
-  // to validate, run e.g. TestAssociationExample with -Dtests.iters=1000
-  private static final boolean IS_J9_JAVA7 = Constants.JRE_IS_MINIMUM_JAVA7 && Constants.JVM_VENDOR.contains("IBM");
-
   /** An empty {@link CategoryPath} */
   public static final CategoryPath EMPTY = new CategoryPath();
 
@@ -48,7 +43,7 @@ public class CategoryPath implements Com
 
   // Used by singleton EMPTY
   private CategoryPath() {
-    components = new String[0];
+    components = null;
     length = 0;
   }
 
@@ -67,16 +62,7 @@ public class CategoryPath implements Com
   /** Construct from the given path components. */
   public CategoryPath(final String... components) {
     assert components.length > 0 : "use CategoryPath.EMPTY to create an empty path";
-    if (IS_J9_JAVA7) {
-      // On IBM J9 Java 1.7.0, if we do 'this.components = components', then
-      // at some point its length becomes 0 ... quite unexpectedly. If JIT is
-      // disabled, it doesn't happen. This bypasses the bug by copying the 
-      // array (note, Arrays.copyOf did not help either!).
-      this.components = new String[components.length];
-      System.arraycopy(components, 0, this.components, 0, components.length);
-    } else {
-      this.components = components;
-    }
+    this.components = components;
     length = components.length;
   }
 
@@ -84,7 +70,7 @@ public class CategoryPath implements Com
   public CategoryPath(final String pathString, final char delimiter) {
     String[] comps = pathString.split(Character.toString(delimiter));
     if (comps.length == 1 && comps[0].isEmpty()) {
-      components = EMPTY.components;
+      components = null;
       length = 0;
     } else {
       components = comps;