You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2020/09/29 09:49:06 UTC

[lucene-solr] 01/01: SOLR-14151: Reverting recent changes

This is an automated email from the ASF dual-hosted git repository.

ishan pushed a commit to branch jira/solr-14151-revert-8x-2
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 85c34916281d0b72c42c81d344e1dca35f9e6e21
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Tue Sep 29 15:17:56 2020 +0530

    SOLR-14151: Reverting recent changes
    
    This commit takes us back to this commit point:
    
    commit f5219061252912c000f5d119d49bb315e5e6f1ae (jira/solr-14151-new-revert-8x)
    Author: noble <no...@apache.org>
    Date:   Tue Sep 29 15:27:50 2020 +1000
    
        SOLR-14901: TestPackages uses binary precompiled classes to refer to analysis factory FQCNs
---
 .../java/org/apache/solr/schema/IndexSchema.java   | 37 ++--------------------
 .../org/apache/solr/schema/ManagedIndexSchema.java |  6 ++--
 2 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index 26286c2..bd4ae7e 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -20,7 +20,6 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Writer;
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
@@ -47,7 +46,6 @@ import java.util.stream.Stream;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.DelegatingAnalyzerWrapper;
-import org.apache.lucene.analysis.util.ResourceLoader;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.queries.payloads.PayloadDecoder;
 import org.apache.lucene.search.similarities.Similarity;
@@ -138,7 +136,6 @@ public class IndexSchema {
   protected final Version luceneVersion;
   protected float version;
   protected final SolrResourceLoader loader;
-  protected ResourceLoader resourceLoader;
   protected final SolrClassLoader solrClassLoader;
   protected final Properties substitutableProperties;
 
@@ -184,7 +181,7 @@ public class IndexSchema {
     this.resourceName = Objects.requireNonNull(name);
     try {
       readSchema(is);
-      loader.inform(this.resourceLoader);
+      loader.inform(loader);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
@@ -193,36 +190,8 @@ public class IndexSchema {
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
     this.luceneVersion = Objects.requireNonNull(luceneVersion);
     this.loader = loader;
-    this.solrClassLoader = loader.getSchemaLoader() == null ?
-        loader :
-        loader.getSchemaLoader();
-    resourceLoader = this.solrClassLoader instanceof SolrResourceLoader ?
-        (ResourceLoader) this.solrClassLoader :
-        wrappedResourceLoader(this.solrClassLoader);
-    this.substitutableProperties = substitutableProper`ties;
-  }
-
-  /**We want resources to be loaded using {@link SolrResourceLoader}
-   * and classes to be loaded using {@link org.apache.solr.pkg.PackageListeningClassLoader}
-   *
-   */
-  private ResourceLoader wrappedResourceLoader(SolrClassLoader solrClassLoader) {
-    return new ResourceLoader() {
-      @Override
-      public InputStream openResource(String resource) throws IOException {
-        return loader.openResource(resource);
-      }
-
-      @Override
-      public <T> Class<? extends T> findClass(String cname, Class<T> expectedType) {
-        return solrClassLoader.findClass(cname, expectedType);
-      }
-
-      @Override
-      public <T> T newInstance(String cname, Class<T> expectedType) {
-        return solrClassLoader.newInstance(cname, expectedType);
-      }
-    };
+    this.solrClassLoader = loader.getSchemaLoader() == null ? loader : loader.getSchemaLoader();
+    this.substitutableProperties = substitutableProperties;
   }
 
   /**
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
index b22ba69..f4ae860 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
@@ -1319,7 +1319,7 @@ public final class ManagedIndexSchema extends IndexSchema {
     for (CharFilterFactory next : charFilters) {
       if (next instanceof ResourceLoaderAware) {
         try {
-          ((ResourceLoaderAware) next).inform(resourceLoader);
+          ((ResourceLoaderAware) next).inform(loader);
         } catch (IOException e) {
           throw new SolrException(ErrorCode.SERVER_ERROR, e);
         }
@@ -1329,7 +1329,7 @@ public final class ManagedIndexSchema extends IndexSchema {
     TokenizerFactory tokenizerFactory = chain.getTokenizerFactory();
     if (tokenizerFactory instanceof ResourceLoaderAware) {
       try {
-        ((ResourceLoaderAware) tokenizerFactory).inform(resourceLoader);
+        ((ResourceLoaderAware) tokenizerFactory).inform(loader);
       } catch (IOException e) {
         throw new SolrException(ErrorCode.SERVER_ERROR, e);
       }
@@ -1340,7 +1340,7 @@ public final class ManagedIndexSchema extends IndexSchema {
       if (next instanceof ResourceLoaderAware) {
         SolrResourceLoader.CURRENT_AWARE.set((ResourceLoaderAware) next);
         try {
-          ((ResourceLoaderAware) next).inform(resourceLoader);
+          ((ResourceLoaderAware) next).inform(loader);
         } catch (IOException e) {
           throw new SolrException(ErrorCode.SERVER_ERROR, e);
         } finally {