lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [2/2] lucene-solr:branch_7x: SOLR-12662: Reproducing TestPolicy failures: NPE and NoClassDefFoundError
Date Tue, 28 Aug 2018 16:43:53 GMT
SOLR-12662: Reproducing TestPolicy failures: NPE and NoClassDefFoundError


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

Branch: refs/heads/branch_7x
Commit: f6c06ae5e58d2c461c7bb7333b82aead753fa295
Parents: 86efdaa
Author: Steve Rowe <sarowe@apache.org>
Authored: Tue Aug 28 12:42:59 2018 -0400
Committer: Steve Rowe <sarowe@apache.org>
Committed: Tue Aug 28 12:43:39 2018 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                    |  3 +++
 .../solrj/cloud/autoscaling/VariableBase.java       | 16 ++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6c06ae5/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 43d4bed..62e70d9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -8108,6 +8108,9 @@ Bug Fixes
 
 * SOLR-6693: bin\solr.cmd doesn't support 32-bit JRE/JDK running on Windows due to
   parenthesis in JAVA_HOME. (Timothy Potter, Christopher Hewitt, Jan H√łydahl)
+  
+* SOLR-12662: Reproducing TestPolicy failures: NPE and NoClassDefFoundError. 
+  (Steve Rowe)
 
 Optimizations
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6c06ae5/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
index 4387eb1..8b0c1cf 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
@@ -77,7 +77,7 @@ public class VariableBase implements Variable {
   }
 
   public static Type getTagType(String name) {
-    Type info = validatetypes.get(name);
+    Type info = getValidatetypes().get(name);
     if (info == null && name.startsWith(ImplicitSnitch.SYSPROP)) info = Type.STRING;
     if (info == null && name.startsWith(Clause.METRICS_PREFIX)) info = Type.LAZY;
     return info;
@@ -196,11 +196,15 @@ public class VariableBase implements Variable {
 
   }
 
-  private static Map<String, Type> validatetypes;
+  private static Map<String, Type> validatetypes = null;
 
-  static {
-    validatetypes = new HashMap<>();
-    for (Type t : Type.values())
-      validatetypes.put(t.tagName, t);
+  /** SOLR-12662: Lazily init validatetypes to avoid Type.values() NPE due to static initializer
ordering */
+  private static Map<String, Type> getValidatetypes() {
+    if (validatetypes == null) {
+      validatetypes = new HashMap<>();
+      for (Type t : Type.values())
+        validatetypes.put(t.tagName, t);
+    }
+    return validatetypes;
   }
 }


Mime
View raw message