You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2015/08/26 02:15:18 UTC

svn commit: r1697789 - in /lucene/dev/trunk/solr: ./ contrib/velocity/src/java/org/apache/solr/response/ contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/ contrib/velocity/src/test/org/apache/solr/velocity/

Author: ehatcher
Date: Wed Aug 26 00:15:18 2015
New Revision: 1697789

URL: http://svn.apache.org/r1697789
Log:
SOLR-7972: Fix VelocityResponseWriter template encoding issue

Added:
    lucene/dev/trunk/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm
Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
    lucene/dev/trunk/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1697789&r1=1697788&r2=1697789&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Aug 26 00:15:18 2015
@@ -153,6 +153,9 @@ Bug Fixes
 * SOLR-7956: There are interrupts on shutdown in places that can cause ChannelAlreadyClosed
   exceptions which prevents proper closing of transaction logs. (Mark Miller)
 
+* SOLR-7972: Fix VelocityResponseWriter template encoding issue.
+  Templates must be UTF-8 encoded. (Erik Hatcher)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1697789&r1=1697788&r2=1697789&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Wed Aug 26 00:15:18 2015
@@ -284,6 +284,8 @@ public class VelocityResponseWriter impl
 
     engine.setProperty(RuntimeConstants.RESOURCE_LOADER, StringUtils.join(loaders,','));
 
+    engine.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8");
+
     // bring in any custom properties too
     engine.init(velocityInitProps);
 

Added: lucene/dev/trunk/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm?rev=1697789&view=auto
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm (added)
+++ lucene/dev/trunk/solr/contrib/velocity/src/test-files/velocity/solr/collection1/conf/velocity/encoding.vm Wed Aug 26 00:15:18 2015
@@ -0,0 +1 @@
+éñçø∂îñg
\ No newline at end of file

Modified: lucene/dev/trunk/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java?rev=1697789&r1=1697788&r2=1697789&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java (original)
+++ lucene/dev/trunk/solr/contrib/velocity/src/test/org/apache/solr/velocity/VelocityResponseWriterTest.java Wed Aug 26 00:15:18 2015
@@ -93,6 +93,11 @@ public class VelocityResponseWriterTest
   }
 
   @Test
+  public void testEncoding() throws Exception {
+    assertEquals("éñçø∂îñg", h.query(req("q","*:*", "wt","velocity",VelocityResponseWriter.TEMPLATE,"encoding")));
+  }
+
+  @Test
   public void testMacros() throws Exception {
     // tests that a macro in a custom macros.vm is visible
     assertEquals("test_macro_SUCCESS", h.query(req("q","*:*", "wt","velocity",VelocityResponseWriter.TEMPLATE,"test_macro_visible")));