More charset violations

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1067163 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-02-04 12:27:16 +00:00
parent 0188da6a73
commit 783c8fd7b5
3 changed files with 18 additions and 8 deletions

View File

@ -46,7 +46,7 @@ public class TestXPathEntityProcessor extends AbstractDataImportHandlerTestCase
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 extends AbstractDataImportHandlerTestCase
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", ""

View File

@ -25,6 +25,7 @@ import org.apache.commons.collections.ExtendedProperties;
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 extends ResourceLoader {
@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

View File

@ -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;