diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 001f4925b4c..8d7ddc5afad 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -144,6 +144,9 @@ Bug Fixes * SOLR-13963: JavaBinCodec has concurrent modification of CharArr resulting in corrupt internode updates (Colvin Cowie, noble) +* SOLR-13971: Velocity response writer's resource loading now possible only through startup parameters. Also, removed velocity + response writer from _default configset. (Ishan Chattopadhyaya) + ================== 8.3.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java index 6279ee3dd11..7617649ed67 100644 --- a/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java +++ b/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java @@ -62,9 +62,11 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar // init param names, these are _only_ loaded at init time (no per-request control of these) // - multiple different named writers could be created with different init params public static final String TEMPLATE_BASE_DIR = "template.base.dir"; + public static final String PROPERTIES_FILE = "init.properties.file"; + + // System property names, these are _only_ loaded at node startup (no per-request control of these) public static final String PARAMS_RESOURCE_LOADER_ENABLED = "params.resource.loader.enabled"; public static final String SOLR_RESOURCE_LOADER_ENABLED = "solr.resource.loader.enabled"; - public static final String PROPERTIES_FILE = "init.properties.file"; // request param names public static final String TEMPLATE = "v.template"; @@ -106,12 +108,12 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar } // params resource loader: off by default - Boolean prle = args.getBooleanArg(PARAMS_RESOURCE_LOADER_ENABLED); + Boolean prle = Boolean.getBoolean(PARAMS_RESOURCE_LOADER_ENABLED); paramsResourceLoaderEnabled = (null == prle ? false : prle); - // solr resource loader: on by default - Boolean srle = args.getBooleanArg(SOLR_RESOURCE_LOADER_ENABLED); - solrResourceLoaderEnabled = (null == srle ? true : srle); + // solr resource loader: off by default + Boolean srle = Boolean.getBoolean(SOLR_RESOURCE_LOADER_ENABLED); + solrResourceLoaderEnabled = (null == srle ? false : srle); initPropertiesFileName = (String) args.get(PROPERTIES_FILE); diff --git a/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java b/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java index e36624e7226..f41ae5b046c 100644 --- a/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java +++ b/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java @@ -27,16 +27,25 @@ import org.apache.solr.response.QueryResponseWriter; import org.apache.solr.response.SolrParamResourceLoader; import org.apache.solr.response.SolrQueryResponse; import org.apache.solr.response.VelocityResponseWriter; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; public class VelocityResponseWriterTest extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { + System.setProperty("params.resource.loader.enabled", "true"); + System.setProperty("solr.resource.loader.enabled", "true"); initCore("solrconfig.xml", "schema.xml", getFile("velocity/solr").getAbsolutePath()); System.out.println(getFile("velocity/solr").getAbsolutePath()); } + @AfterClass + public static void afterClass() throws Exception { + System.clearProperty("params.resource.loader.enabled"); + System.clearProperty("solr.resource.loader.enabled"); + } + @Test public void testVelocityResponseWriterRegistered() { QueryResponseWriter writer = h.getCore().getQueryResponseWriter("velocity"); diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml index 33b25cd4e18..3af7d76cc58 100644 --- a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml +++ b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml @@ -81,8 +81,6 @@ - - - + explicit @@ -1299,15 +1297,6 @@ text/plain; charset=UTF-8 - - - ${velocity.template.base.dir:} - ${velocity.solr.resource.loader.enabled:true} - ${velocity.params.resource.loader.enabled:false} - - - + explicit @@ -1299,15 +1297,6 @@ text/plain; charset=UTF-8 - - - ${velocity.template.base.dir:} - ${velocity.solr.resource.loader.enabled:true} - ${velocity.params.resource.loader.enabled:false} - -