Apache Solr open-source search software
LUCENE-2182: DEFAULT_ATTRIBUTE_FACTORY was failing to load implementation class when interface was loaded by a different class loader
Uwe Schindler5e77ec984524
diff --git a/CHANGES.txt b/CHANGES.txtindex 51eed575f9a..02c2b97e7ec 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -83,6 +83,10 @@ Bug fixes* LUCENE-2158: At high indexing rates, NRT reader could temporarilylose deletions. (Mike McCandless)+* LUCENE-2182: DEFAULT_ATTRIBUTE_FACTORY was failing to load+ implementation class when interface was loaded by a different+ class loader. (Uwe Schindler, reported on java-user by Ahmed El-dawy)+New features* LUCENE-2128: Parallelized fetching document frequencies during weightdiff --git a/src/java/org/apache/lucene/util/AttributeSource.java b/src/java/org/apache/lucene/util/AttributeSource.javaindex 8dfeb46f311..adf7d888347 100644--- a/src/java/org/apache/lucene/util/AttributeSource.java+++ b/src/java/org/apache/lucene/util/AttributeSource.java@@ -64,9 +64,9 @@ public class AttributeSource {try {return getClassForInterface(attClass).newInstance();} catch (InstantiationException e) {- throw new IllegalArgumentException("Could not instantiate class " + attClass.getName());+ throw new IllegalArgumentException("Could not instantiate implementing class for " + attClass.getName());} catch (IllegalAccessException e) {- throw new IllegalArgumentException("Could not instantiate class " + attClass.getName());+ throw new IllegalArgumentException("Could not instantiate implementing class for " + attClass.getName());}}@@ -75,7 +75,10 @@ public class AttributeSource {Class<? extends AttributeImpl> clazz = attClassImplMap.get(attClass);if (clazz == null) {try {- attClassImplMap.put(attClass, clazz = Class.forName(attClass.getName() + "Impl").asSubclass(AttributeImpl.class));+ attClassImplMap.put(attClass,+ clazz = Class.forName(attClass.getName() + "Impl", true, attClass.getClassLoader())+ .asSubclass(AttributeImpl.class)+ );} catch (ClassNotFoundException e) {throw new IllegalArgumentException("Could not find implementing class for " + attClass.getName());}