Closed
Description
Copying from #43197 (comment) :
.. it seems like most of the places we use CharArrays like this we have a BytesReference, and we end up copying to a byte array in order to convert to chars. I wonder if we could flip the CharArrays input around so it takes a BytesReference, so that we don't need to have the try/finally like this. In the few cases we actually have a real bytes array, we can wrap the array in a bytesreference.