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
This commit is contained in:
Shalin Shekhar Mangar 2015-08-27 14:16:20 +00:00
parent 90e775cd5b
commit f8eaccd19f
1 changed files with 1 additions and 1 deletions

View File

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