Adding defensive copy of text

Creating a temp fix of using a char[] to store document text by making
defensive copy.