Skip to content

Apache Lucene open-source search software

LUCENE-6774: Remove solr hack in MorfologikFilter

Robert Muir387c7d207770
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 02ca50c3607..4163de27dd3 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -100,6 +100,8 @@ Bug Fixes
* LUCENE-6748: UsageTrackingQueryCachingPolicy no longer caches trivial queries
like MatchAllDocsQuery. (Adrien Grand)
+* LUCENE-6774: Remove solr hack in MorfologikFilter. (Robert Muir)
+
Other
* LUCENE-6174: Improve "ant eclipse" to select right JRE for building.
diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java
index ff54b413072..4a25d29e2b5 100644
--- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java
+++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java
@@ -76,17 +76,8 @@ public class MorfologikFilter extends TokenFilter {
public MorfologikFilter(final TokenStream in, final String dict) {
super(in);
this.input = in;
-
- // SOLR-4007: temporarily substitute context class loader to allow finding dictionary resources.
- Thread me = Thread.currentThread();
- ClassLoader cl = me.getContextClassLoader();
- try {
- me.setContextClassLoader(morfologik.stemming.Dictionary.class.getClassLoader());
- this.stemmer = new DictionaryLookup(morfologik.stemming.Dictionary.getForLanguage(dict));
- this.lemmaList = Collections.emptyList();
- } finally {
- me.setContextClassLoader(cl);
- }
+ this.stemmer = new DictionaryLookup(morfologik.stemming.Dictionary.getForLanguage(dict));
+ this.lemmaList = Collections.emptyList();
}
/**
diff --git a/lucene/tools/junit4/tests.policy b/lucene/tools/junit4/tests.policy
index 35a966b2781..439bdbe9a98 100644
--- a/lucene/tools/junit4/tests.policy
+++ b/lucene/tools/junit4/tests.policy
@@ -67,8 +67,6 @@ grant {
permission java.lang.RuntimePermission "accessClassInPackage.sun.util";
// needed for test of IOUtils.spins (maybe it can be avoided)
permission java.lang.RuntimePermission "getFileStoreAttributes";
- // analyzers/morfologik: needed for a horrible context classloader hack for solr in morfologikfilter: nuke this
- permission java.lang.RuntimePermission "setContextClassLoader";
// analyzers/uima: needed by UIMA message localization... (?)
permission java.lang.RuntimePermission "createSecurityManager";
permission java.lang.RuntimePermission "createClassLoader";