From 08fb32386924fc2091c9edafa06449b47862e839 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Sat, 21 Mar 2009 06:02:43 +0000 Subject: [PATCH] SOLR-973 followup -- Lookup the charset only once git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@756879 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/client/solrj/request/RequestWriter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/solrj/org/apache/solr/client/solrj/request/RequestWriter.java b/src/solrj/org/apache/solr/client/solrj/request/RequestWriter.java index e5355778184..63cd0c008ad 100644 --- a/src/solrj/org/apache/solr/client/solrj/request/RequestWriter.java +++ b/src/solrj/org/apache/solr/client/solrj/request/RequestWriter.java @@ -26,6 +26,7 @@ import java.io.*; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.nio.charset.Charset; /** * A RequestWriter is used to write requests to Solr. @@ -36,6 +37,7 @@ import java.util.List; * @since solr 1.4 */ public class RequestWriter { + public static final Charset UTF_8 = Charset.forName("UTF-8"); public Collection getContentStreams(SolrRequest req) throws IOException { if (req instanceof UpdateRequest) { @@ -66,7 +68,7 @@ public class RequestWriter { public void write(SolrRequest request, OutputStream os) throws IOException { if (request instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) request; - OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); + OutputStreamWriter writer = new OutputStreamWriter(os, UTF_8); updateRequest.writeXML(writer); writer.flush(); }