From f8eaccd19fd6e1a5080786ad3583290d6e1f73b3 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 27 Aug 2015 14:16:20 +0000 Subject: [PATCH] SOLR-7983: Utils.toUTF8 uses shorter buffer than necessary for holding UTF8 data git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1698160 13f79535-47bb-0310-9956-ffa450edef68 --- solr/solrj/src/java/org/apache/solr/common/util/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java index e28c717f60c..8e656ba6606 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java @@ -84,7 +84,7 @@ public class Utils { } public static byte[] toUTF8(CharArr out) { - byte[] arr = new byte[out.size() << 2]; // is 4x the real worst-case upper-bound? + byte[] arr = new byte[out.size() * 3]; int nBytes = ByteUtils.UTF16toUTF8(out, 0, out.size(), arr, 0); return Arrays.copyOf(arr, nBytes); }