lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1067172 - in /lucene/dev/branches/branch_3x: ./ lucene/ solr/ solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/ solr/src/java/org/apache/solr/core/ solr/src/java/org/apache/solr/handler/ solr/src/java/org/apa...
Date Fri, 04 Feb 2011 12:50:15 GMT
Author: uschindler
Date: Fri Feb  4 12:50:14 2011
New Revision: 1067172

URL: http://svn.apache.org/viewvc?rev=1067172&view=rev
Log:
backport the violation fixes

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDataConfig.java
    lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/CoreContainer.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
    lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
    lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java

Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDataConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDataConfig.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDataConfig.java
(original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestDataConfig.java
Fri Feb  4 12:50:14 2011
@@ -19,9 +19,10 @@ package org.apache.solr.handler.dataimpo
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
 
 import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.ByteArrayInputStream;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -55,7 +56,7 @@ public class TestDataConfig extends Abst
   public void testBasic() throws Exception {
     javax.xml.parsers.DocumentBuilder builder = DocumentBuilderFactory
             .newInstance().newDocumentBuilder();
-    Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+    Document doc = builder.parse(new InputSource(new StringReader(xml)));
 
     DataConfig dc = new DataConfig();
     dc.readFromXml(doc.getDocumentElement());

Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java
(original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestXPathEntityProcessor.java
Fri Feb  4 12:50:14 2011
@@ -46,7 +46,7 @@ public class TestXPathEntityProcessor ex
     tmpdir.delete();
     tmpdir.mkdir();
     tmpdir.deleteOnExit();
-    createFile(tmpdir, "x.xsl", xsl.getBytes(), false);
+    createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"), false);
     Map entityAttrs = createMap("name", "e", "url", "cd.xml",
             XPathEntityProcessor.FOR_EACH, "/catalog/cd");
     List fields = new ArrayList();
@@ -211,7 +211,7 @@ public class TestXPathEntityProcessor ex
     tmpdir.delete();
     tmpdir.mkdir();
     tmpdir.deleteOnExit();
-    TestFileListEntityProcessor.createFile(tmpdir, "x.xsl", xsl.getBytes(),
+    TestFileListEntityProcessor.createFile(tmpdir, "x.xsl", xsl.getBytes("UTF-8"),
             false);
     Map entityAttrs = createMap("name", "e",
             XPathEntityProcessor.USE_SOLR_ADD_SCHEMA, "true", "xsl", ""

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/CoreContainer.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/CoreContainer.java Fri
Feb  4 12:50:14 2011
@@ -129,7 +129,7 @@ public class CoreContainer 
         cores.load(solrHome, fconf);
       } else {
         cores.defaultAbortOnConfigError = abortOnConfigurationError;
-        cores.load(solrHome, new ByteArrayInputStream(DEF_SOLR_XML.getBytes()));
+        cores.load(solrHome, new ByteArrayInputStream(DEF_SOLR_XML.getBytes("UTF-8")));
         cores.configFile = fconf;
       }
       setAbortOnConfigurationError(0 < cores.numCoresAbortOnConfigError);

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java
Fri Feb  4 12:50:14 2011
@@ -18,7 +18,7 @@
 package org.apache.solr.handler;
 
 import java.io.IOException;
-import java.io.InputStream;
+import java.io.Reader;
 import java.util.ArrayList;
 
 import org.apache.commons.io.IOUtils;
@@ -46,11 +46,11 @@ public class DumpRequestHandler extends 
         stream.add( "sourceInfo", content.getSourceInfo() );
         stream.add( "size", content.getSize() );
         stream.add( "contentType", content.getContentType() );
-        InputStream is = content.getStream();
+        Reader reader = content.getReader();
         try {
-          stream.add( "stream", IOUtils.toString(is) );
+          stream.add( "stream", IOUtils.toString(reader) );
         } finally {
-          is.close();
+          reader.close();
         }
         streams.add( stream );
       }

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
Fri Feb  4 12:50:14 2011
@@ -215,7 +215,7 @@ public class ShowFileRequestHandler exte
     try {
       SolrCore core = SolrCore.getSolrCore();
       InputStream input = core.getResourceLoader().openResource(path);
-      return IOUtils.toString( input );
+      return IOUtils.toString( input, "UTF-8" );
     }
     catch( Exception ex ) {} // ignore it
     return "";

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java
Fri Feb  4 12:50:14 2011
@@ -169,6 +169,7 @@ public class SystemInfoHandler extends R
     try {
       Process process = Runtime.getRuntime().exec(cmd);
       in = new DataInputStream( process.getInputStream() );
+      // use default charset from locale here, because the command invoked also uses the
default locale:
       return IOUtils.toString( in );
     }
     catch( Exception ex ) {

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/response/SolrParamResourceLoader.java
Fri Feb  4 12:50:14 2011
@@ -25,6 +25,7 @@ import org.apache.commons.collections.Ex
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -56,7 +57,11 @@ public class SolrParamResourceLoader ext
   @Override
   public InputStream getResourceStream(String s) throws ResourceNotFoundException {
     String template = templates.get(s);
-    return template == null ? null : new ByteArrayInputStream(template.getBytes());
+    try {
+      return template == null ? null : new ByteArrayInputStream(template.getBytes("UTF-8"));
+    } catch (UnsupportedEncodingException e) {
+      throw new RuntimeException(e); // may not happen
+    }
   }
 
   @Override

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
Fri Feb  4 12:50:14 2011
@@ -86,23 +86,23 @@ public class JettyWebappTest extends Luc
     // sure they compile ok
     
     String adminPath = "http://localhost:"+port+context+"/";
-    String html = IOUtils.toString( new URL(adminPath).openStream() );
-    assertNotNull( html ); // real error will be an exception
+    byte[] bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     adminPath += "admin/";
-    html = IOUtils.toString( new URL(adminPath).openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // analysis
-    html = IOUtils.toString( new URL(adminPath+"analysis.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"analysis.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // schema browser
-    html = IOUtils.toString( new URL(adminPath+"schema.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"schema.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
 
     // schema browser
-    html = IOUtils.toString( new URL(adminPath+"threaddump.jsp").openStream() );
-    assertNotNull( html ); // real error will be an exception
+    bytes = IOUtils.toByteArray( new URL(adminPath+"threaddump.jsp").openStream() );
+    assertNotNull( bytes ); // real error will be an exception
   }
 }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/ContentStreamTest.java
Fri Feb  4 12:50:14 2011
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
 import java.net.URL;
+import java.net.URLConnection;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
@@ -41,7 +42,7 @@ public class ContentStreamTest extends L
     String input = "aads ghaskdgasgldj asl sadg ajdsg &jag # @ hjsakg hsakdg hjkas s";
     ContentStreamBase stream = new ContentStreamBase.StringStream( input );
     assertEquals( input.length(), stream.getSize().intValue() );
-    assertEquals( input, IOUtils.toString( stream.getStream() ) );
+    assertEquals( input, IOUtils.toString( stream.getStream(), "UTF-8" ) );
     assertEquals( input, IOUtils.toString( stream.getReader() ) );
   }
 
@@ -63,33 +64,40 @@ public class ContentStreamTest extends L
 
   public void testURLStream() throws IOException 
   {
-    String content = null;
+    byte[] content = null;
+    String contentType = null;
     URL url = new URL( "http://svn.apache.org/repos/asf/lucene/dev/trunk/" );
     InputStream in = url.openStream();
     try {
-      content = IOUtils.toString( in );
+      URLConnection conn = url.openConnection();
+      in = conn.getInputStream();
+      contentType = conn.getContentType();
+      content = IOUtils.toByteArray(in);
     } 
     finally {
       IOUtils.closeQuietly(in);
     }
     
-    assertTrue( content.length() > 10 ); // found something...
+    assertTrue( content.length > 10 ); // found something...
     
     ContentStreamBase stream = new ContentStreamBase.URLStream( url );
-    assertEquals( content.length(), stream.getSize().intValue() );
+    assertEquals( content.length, stream.getSize().intValue() );
     
     // Test the stream
     in = stream.getStream();
     try {
       assertTrue( IOUtils.contentEquals( 
-          new ByteArrayInputStream( content.getBytes() ), in ) );
+          new ByteArrayInputStream(content), in ) );
     } 
     finally {
       IOUtils.closeQuietly(in);
     }
 
+    String charset = ContentStreamBase.getCharsetFromContentType(contentType);
+    if (charset == null)
+      charset = ContentStreamBase.DEFAULT_CHARSET;
     // Re-open the stream and this time use a reader
     stream = new ContentStreamBase.URLStream( url );
-    assertTrue( IOUtils.contentEquals( new StringReader( content ), stream.getReader() )
);
+    assertTrue( IOUtils.contentEquals( new StringReader(new String(content, charset)), stream.getReader()
) );
   }
 }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/common/util/DOMUtilTest.java
Fri Feb  4 12:50:14 2011
@@ -17,7 +17,7 @@
 
 package org.apache.solr.common.util;
 
-import java.io.ByteArrayInputStream;
+import java.io.StringReader;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -27,6 +27,7 @@ import javax.xml.xpath.XPathFactory;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
 
 import org.apache.lucene.util.LuceneTestCase;
 
@@ -85,6 +86,6 @@ public class DOMUtilTest extends LuceneT
   }
   
   public Document getDocument( String xml ) throws Exception {
-    return builder.parse( new ByteArrayInputStream( xml.getBytes() ) );
+    return builder.parse(new InputSource(new StringReader(xml)));
   }
 }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/DocumentAnalysisRequestHandlerTest.java
Fri Feb  4 12:50:14 2011
@@ -177,7 +177,7 @@ public class DocumentAnalysisRequestHand
       "</docs>"
     ).getBytes("ISO-8859-1");
     
-    // we declare a content stream without charset:
+    // we declare a content stream with charset:
     final ContentStream cs = new ByteStream(xmlBytes, "application/xml; charset=ISO-8859-1");
     
     ModifiableSolrParams params = new ModifiableSolrParams();

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
Fri Feb  4 12:50:14 2011
@@ -656,7 +656,7 @@ public class TestReplicationHandler exte
         try {
           url = new URL(masterUrl);
           stream = url.openStream();
-          response = IOUtils.toString(stream);
+          response = IOUtils.toString(stream, "UTF-8");
           if(response.contains("<str name=\"status\">success</str>")) {
             success = true;
           }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
Fri Feb  4 12:50:14 2011
@@ -74,7 +74,7 @@ public class SolrRequestParserTest exten
     List<ContentStream> streams = new ArrayList<ContentStream>();
     SolrQueryRequest req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ),
streams );
     assertEquals( 1, streams.size() );
-    assertEquals( body1, IOUtils.toString( streams.get(0).getStream() ) );
+    assertEquals( body1, IOUtils.toString( streams.get(0).getReader() ) );
     req.close();
 
     // Now add three and make sure they come out ok
@@ -87,9 +87,9 @@ public class SolrRequestParserTest exten
     input.add( body1 );
     input.add( body2 );
     input.add( body3 );
-    output.add( IOUtils.toString( streams.get(0).getStream() ) );
-    output.add( IOUtils.toString( streams.get(1).getStream() ) );
-    output.add( IOUtils.toString( streams.get(2).getStream() ) );
+    output.add( IOUtils.toString( streams.get(0).getReader() ) );
+    output.add( IOUtils.toString( streams.get(1).getReader() ) );
+    output.add( IOUtils.toString( streams.get(2).getReader() ) );
     // sort them so the output is consistent
     Collections.sort( input );
     Collections.sort( output );
@@ -112,13 +112,13 @@ public class SolrRequestParserTest exten
   {
     boolean ok = false;
     String url = "http://www.apache.org/dist/lucene/solr/";
-    String txt = null;
+    byte[] bytes = null;
     try {
       URLConnection connection = new URL(url).openConnection();
       connection.setConnectTimeout(5000);
       connection.setReadTimeout(5000);
       connection.connect();
-      txt = IOUtils.toString( connection.getInputStream());
+      bytes = IOUtils.toByteArray( connection.getInputStream());
     }
     catch( Exception ex ) {
       assumeNoException("Unable to connect to " + url + " to run the test.", ex);
@@ -134,7 +134,7 @@ public class SolrRequestParserTest exten
     List<ContentStream> streams = new ArrayList<ContentStream>();
     SolrQueryRequest req = parser.buildRequestFrom( core, new MultiMapSolrParams( args ),
streams );
     assertEquals( 1, streams.size() );
-    assertEquals( txt, IOUtils.toString( streams.get(0).getStream() ) );
+    assertArrayEquals( bytes, IOUtils.toByteArray( streams.get(0).getStream() ) );
     req.close();
   }
   

Modified: lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
Fri Feb  4 12:50:14 2011
@@ -65,7 +65,7 @@ public class SolrDispatchFilter implemen
 
   public SolrDispatchFilter() {
     try {
-      adminRequestParser = new SolrRequestParsers(new Config(null,"solr",new ByteArrayInputStream("<root/>".getBytes()),"")
);
+      adminRequestParser = new SolrRequestParsers(new Config(null,"solr",new ByteArrayInputStream("<root/>".getBytes("UTF-8")),"")
);
     } catch (Exception e) {
       //unlikely
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,e);

Modified: lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java?rev=1067172&r1=1067171&r2=1067172&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/webapp/src/org/apache/solr/servlet/cache/HttpCacheHeaderUtil.java
Fri Feb  4 12:50:14 2011
@@ -18,6 +18,7 @@
 package org.apache.solr.servlet.cache;
 
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.util.Collections;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -75,11 +76,15 @@ public final class HttpCacheHeaderUtil {
       if (currentIndexVersion != indexVersionCache) {
         indexVersionCache=currentIndexVersion;
         
-        etagCache = "\""
-          + new String(Base64.encodeBase64((Long.toHexString
-                                            (Long.reverse(indexVersionCache))
-                                            + etagSeed).getBytes()))
-          + "\"";
+        try {
+          etagCache = "\""
+           + new String(Base64.encodeBase64((Long.toHexString
+                                             (Long.reverse(indexVersionCache))
+                                             + etagSeed).getBytes()), "US-ASCII")
+           + "\"";
+        } catch (UnsupportedEncodingException e) {
+          throw new RuntimeException(e); // may not happen
+        }
       }
       
       return etagCache;



Mime
View raw message