diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java index 36187a9c784..c1254b383e2 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java +++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java @@ -763,7 +763,7 @@ public class SolrResourceLoader implements ResourceLoader,Closeable /** * Utility function to throw an exception if the class is invalid */ - void assertAwareCompatibility( Class aware, Object obj ) + static void assertAwareCompatibility( Class aware, Object obj ) { Class[] valid = awareCompatibility.get( aware ); if( valid == null ) { diff --git a/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java b/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java index 0007a783a7f..9a1e44d8ad2 100644 --- a/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java +++ b/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.core.KeywordTokenizerFactory; import org.apache.lucene.analysis.ngram.NGramFilterFactory; import org.apache.lucene.util.IOUtils; -import org.apache.lucene.util.TestUtil; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.SolrException; import org.apache.solr.handler.admin.LukeRequestHandler; @@ -46,6 +45,8 @@ import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; +import static org.apache.solr.core.SolrResourceLoader.assertAwareCompatibility; + public class ResourceLoaderTest extends SolrTestCaseJ4 { public void testInstanceDir() throws Exception { @@ -87,8 +88,8 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 Class clazz = ResourceLoaderAware.class; // Check ResourceLoaderAware valid objects - loader.assertAwareCompatibility( clazz, new NGramFilterFactory(new HashMap()) ); - loader.assertAwareCompatibility( clazz, new KeywordTokenizerFactory(new HashMap()) ); + assertAwareCompatibility(clazz, new NGramFilterFactory(new HashMap<>())); + assertAwareCompatibility(clazz, new KeywordTokenizerFactory(new HashMap<>())); // Make sure it throws an error for invalid objects Object[] invalid = new Object[] { @@ -99,7 +100,7 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 }; for( Object obj : invalid ) { try { - loader.assertAwareCompatibility( clazz, obj ); + assertAwareCompatibility(clazz, obj); Assert.fail( "Should be invalid class: "+obj + " FOR " + clazz ); } catch( SolrException ex ) { } // OK @@ -108,19 +109,19 @@ public class ResourceLoaderTest extends SolrTestCaseJ4 clazz = SolrCoreAware.class; // Check ResourceLoaderAware valid objects - loader.assertAwareCompatibility( clazz, new LukeRequestHandler() ); - loader.assertAwareCompatibility( clazz, new FacetComponent() ); - loader.assertAwareCompatibility( clazz, new JSONResponseWriter() ); + assertAwareCompatibility(clazz, new LukeRequestHandler()); + assertAwareCompatibility(clazz, new FacetComponent()); + assertAwareCompatibility(clazz, new JSONResponseWriter()); // Make sure it throws an error for invalid objects invalid = new Object[] { - new NGramFilterFactory(new HashMap()), + new NGramFilterFactory(new HashMap<>()), "hello", new Float( 12.3f ), - new KeywordTokenizerFactory(new HashMap()) + new KeywordTokenizerFactory(new HashMap<>()) }; for( Object obj : invalid ) { try { - loader.assertAwareCompatibility( clazz, obj ); + assertAwareCompatibility(clazz, obj); Assert.fail( "Should be invalid class: "+obj + " FOR " + clazz ); } catch( SolrException ex ) { } // OK