Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlink.java 
Thu Apr 16 22:11:16 2020
@@ -18,12 +18,13 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
 
 /**
- * This class represents the data of a link in the document. 
+ * This class represents the data of a link in the document.
  * @author Nick Burch
  */
 public class ExHyperlink extends RecordContainer {
@@ -35,12 +36,12 @@ public class ExHyperlink extends RecordC
        private ExHyperlinkAtom linkAtom;
        private CString linkDetailsA;
        private CString linkDetailsB;
-       
-       /** 
+
+       /**
         * Returns the ExHyperlinkAtom of this link
-        */ 
+        */
        public ExHyperlinkAtom getExHyperlinkAtom() { return linkAtom; }
-       
+
        /**
         * Returns the URL of the link.
      *
@@ -68,7 +69,7 @@ public class ExHyperlink extends RecordC
                        linkDetailsB.setText(url);
                }
        }
-       
+
     public void setLinkOptions(int options) {
         if(linkDetailsB != null) {
             linkDetailsB.setOptions(options);
@@ -80,7 +81,7 @@ public class ExHyperlink extends RecordC
             linkDetailsA.setText(title);
         }
     }
-    
+
        /**
         * Get the link details (field A)
         */
@@ -94,13 +95,12 @@ public class ExHyperlink extends RecordC
                return linkDetailsB == null ? null : linkDetailsB.getText();
        }
 
-       /** 
+       /**
         * Set things up, and find our more interesting children
         */
        protected ExHyperlink(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
@@ -111,7 +111,7 @@ public class ExHyperlink extends RecordC
         * Go through our child records, picking out the ones that are
         *  interesting, and saving those for use by the easy helper
         *  methods.
-        */     
+        */
        private void findInterestingChildren() {
 
                // First child should be the ExHyperlinkAtom
@@ -138,11 +138,11 @@ public class ExHyperlink extends RecordC
        public ExHyperlink() {
                _header = new byte[8];
                _children = new org.apache.poi.hslf.record.Record[3];
-               
+
                // Setup our header block
                _header[0] = 0x0f; // We are a container record
                LittleEndian.putShort(_header, 2, (short)_type);
-               
+
                // Setup our child records
                CString csa = new CString();
                CString csb = new CString();

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExHyperlinkAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -70,12 +71,10 @@ public final class ExHyperlinkAtom exten
      */
     protected ExHyperlinkAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         // Must be at least 4 bytes long
         if(_data.length < 4) {

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMCIMovie.java Thu 
Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
@@ -39,8 +40,7 @@ public class ExMCIMovie extends RecordCo
      */
     protected ExMCIMovie(byte[] source, int start, int len) {
         // Grab the header
-        _header = new byte[8];
-        System.arraycopy(source, start, _header, 0, 8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Find our children
         _children = Record.findChildRecords(source, start + 8, len - 8);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExMediaAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -89,12 +90,10 @@ public final class ExMediaAtom extends R
      */
     protected ExMediaAtom(byte[] source, int start, int len) {
         // Get the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Grab the record data
-        _recdata = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_recdata,0,len-8);
+        _recdata = IOUtils.safelyClone(source,start+8, len-8, 
MAX_RECORD_LENGTH);
     }
 
     /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjList.java Thu 
Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 
@@ -30,15 +31,15 @@ import org.apache.poi.util.LittleEndian;
 public class ExObjList extends RecordContainer {
        private byte[] _header;
        private static final long _type = RecordTypes.ExObjList.typeID;
-       
+
        // Links to our more interesting children
-       private ExObjListAtom exObjListAtom; 
-       
-       /** 
+       private ExObjListAtom exObjListAtom;
+
+       /**
         * Returns the ExObjListAtom of this list
-        */ 
+        */
        public ExObjListAtom getExObjListAtom() { return exObjListAtom; }
-       
+
        /**
         * Returns all the ExHyperlinks
         */
@@ -53,13 +54,12 @@ public class ExObjList extends RecordCon
                return links.toArray(new ExHyperlink[0]);
        }
 
-       /** 
+       /**
         * Set things up, and find our more interesting children
         */
        protected ExObjList(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
@@ -70,7 +70,7 @@ public class ExObjList extends RecordCon
         * Go through our child records, picking out the ones that are
         *  interesting, and saving those for use by the easy helper
         *  methods.
-        */     
+        */
        private void findInterestingChildren() {
                // First child should be the atom
                if(_children[0] instanceof ExObjListAtom) {
@@ -79,18 +79,18 @@ public class ExObjList extends RecordCon
                        throw new IllegalStateException("First child record 
wasn't a ExObjListAtom, was of type " + _children[0].getRecordType());
                }
        }
-       
+
        /**
         * Create a new ExObjList, with blank fields
         */
        public ExObjList() {
                _header = new byte[8];
                _children = new org.apache.poi.hslf.record.Record[1];
-               
+
                // Setup our header block
                _header[0] = 0x0f; // We are a container record
                LittleEndian.putShort(_header, 2, (short)_type);
-               
+
                // Setup our child records
                _children[0] = new ExObjListAtom();
                findInterestingChildren();

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjListAtom.java 
Thu Apr 16 22:11:16 2020
@@ -14,12 +14,13 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 
 package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -58,7 +59,7 @@ public class ExObjListAtom extends Recor
 
         LittleEndian.putShort(_header, 2, (short)getRecordType());
         LittleEndian.putInt(_header, 4, _data.length);
-        
+
         // It is fine for the other values to be zero
     }
 
@@ -72,13 +73,11 @@ public class ExObjListAtom extends Recor
      */
     protected ExObjListAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
-        
+        _header = Arrays.copyOfRange(source, start, start+8);
+
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
-        
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
+
         // Must be at least 4 bytes long
         if(_data.length < 4) {
                throw new IllegalArgumentException("The length of the data for 
a ExObjListAtom must be at least 4 bytes, but was only " + _data.length);
@@ -101,7 +100,7 @@ public class ExObjListAtom extends Recor
     public void setObjectIDSeed(int seed) {
         LittleEndian.putInt(_data,0,seed);
     }
-    
+
     /**
      * Gets the record type.
      * @return the record type.

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExObjRefAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -55,17 +56,14 @@ public final class ExObjRefAtom extends
 
     /**
      * Build an instance of <code>ExObjRefAtom</code> from on-disk data
-     * 
+     *
      * @param source the source data as a byte array.
      * @param start the start offset into the byte array.
      * @param len the length of the slice in the byte array.
      */
        protected ExObjRefAtom(byte[] source, int start, int len) {
-               _header = new byte[8];
-        int offset = start;
-        System.arraycopy(source,start,_header,0,8);
-        offset += _header.length;
-        exObjIdRef = (int)LittleEndian.getUInt(source, offset);
+        _header = Arrays.copyOfRange(source, start, start+8);
+        exObjIdRef = (int)LittleEndian.getUInt(source, start+8);
        }
 
     /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java 
Thu Apr 16 22:11:16 2020
@@ -22,6 +22,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -187,12 +188,10 @@ public class ExOleObjAtom extends Record
      */
     protected ExOleObjAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         // Must be at least 24 bytes long
         if(_data.length < 24) {
@@ -258,7 +257,7 @@ public class ExOleObjAtom extends Record
 
     /**
      * Gets the type of OLE object.
-     * 
+     *
      * @return the sub-type, one of the {@code SUBTYPE_*} constants.
      */
     public int getSubType() {
@@ -303,7 +302,7 @@ public class ExOleObjAtom extends Record
         // Even though this is a mere boolean, KOffice's code says it's an int.
         return LittleEndian.getInt(_data, 20) != 0;
     }
-    
+
     /**
      * Gets misc options (the last four bytes in the atom).
      *

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java 
Thu Apr 16 22:11:16 2020
@@ -22,6 +22,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 import java.util.zip.DeflaterOutputStream;
@@ -51,7 +52,7 @@ public class ExOleObjStg extends Positio
      * Record data.
      */
     private byte[] _data;
-    
+
     /**
      * Constructs a new empty storage container.
      */
@@ -74,12 +75,10 @@ public class ExOleObjStg extends Positio
      */
     protected ExOleObjStg(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
     }
 
     public boolean isCompressed() {
@@ -155,7 +154,7 @@ public class ExOleObjStg extends Positio
     public int getRecordInstance() {
         return (LittleEndian.getUShort(_header, 0) >>> 4);
     }
-    
+
     /**
      * Write the contents of the record back, so it can be written
      * to disk.

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/ExVideoContainer.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
@@ -41,8 +42,7 @@ public final class ExVideoContainer exte
         */
        protected ExVideoContainer(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontCollection.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,8 +48,7 @@ public final class FontCollection extend
     private byte[] _header;
 
        /* package */ FontCollection(byte[] source, int start, int len) {
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
                _children = Record.findChildRecords(source,start+8,len-8);
 
@@ -86,10 +86,10 @@ public final class FontCollection extend
 
     /**
      * Add font with the given FontInfo configuration to the font collection.
-     * The returned FontInfo contains the HSLF specific details and the 
collection 
+     * The returned FontInfo contains the HSLF specific details and the 
collection
      * uniquely contains fonts based on their typeface, i.e. calling the 
method with FontInfo
      * objects having the same name results in the same HSLFFontInfo reference.
-     * 
+     *
      * @param fontInfo the FontInfo configuration, can be a instance of {@link 
HSLFFontInfo},
      *      {@link HSLFFontInfoPredefined} or a custom implementation
      * @return the register HSLFFontInfo object
@@ -168,9 +168,9 @@ public final class FontCollection extend
 
     /**
      * Lookup a FontInfo object by its typeface
-     * 
+     *
      * @param typeface the full font name
-     * 
+     *
      * @return the HSLFFontInfo for the given name or {@code null} if not found
      */
     public HSLFFontInfo getFontInfo(String typeface) {
@@ -195,9 +195,9 @@ public final class FontCollection extend
 
     /**
      * Lookup a FontInfo object by its internal font index
-     * 
+     *
      * @param index the internal font index
-     * 
+     *
      * @return the HSLFFontInfo for the given index or {@code null} if not 
found
      */
     public HSLFFontInfo getFontInfo(int index) {
@@ -208,7 +208,7 @@ public final class FontCollection extend
         }
         return null;
     }
-    
+
     /**
      * @return the number of registered fonts
      */

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEmbeddedData.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -63,12 +64,10 @@ public class FontEmbeddedData extends Re
      */
     /* package */ FontEmbeddedData(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         // Must be at least 4 bytes long
         if(_data.length < 4) {

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/FontEntityAtom.java 
Thu Apr 16 22:11:16 2020
@@ -62,7 +62,7 @@ public final class FontEntityAtom extend
     /**
      * record header
      */
-    private final byte[] _header = new byte[8];
+    private final byte[] _header;
 
        /**
      * record data
@@ -74,11 +74,10 @@ public final class FontEntityAtom extend
      */
        /* package */ FontEntityAtom(byte[] source, int start, int len) {
                // Get the header
-               System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the record data
-               _recdata = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+8,_recdata,0,len-8);
+               _recdata = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
        }
 
     /**
@@ -86,6 +85,7 @@ public final class FontEntityAtom extend
      */
     public FontEntityAtom() {
         _recdata = new byte[68];
+        _header = new byte[8];
 
         LittleEndian.putShort(_header, 2, (short)getRecordType());
         LittleEndian.putInt(_header, 4, _recdata.length);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HSLFEscherClientDataRecord.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HSLFEscherClientDataRecord.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HSLFEscherClientDataRecord.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HSLFEscherClientDataRecord.java
 Thu Apr 16 22:11:16 2020
@@ -68,8 +68,7 @@ public class HSLFEscherClientDataRecord
     @Override
     public int fillFields(byte[] data, int offset, EscherRecordFactory 
recordFactory) {
         int bytesRemaining = readHeader( data, offset );
-        byte[] remainingData = IOUtils.safelyAllocate(bytesRemaining, 
MAX_RECORD_LENGTH);
-        System.arraycopy(data, offset+8, remainingData, 0, bytesRemaining);
+        byte[] remainingData = IOUtils.safelyClone(data,  offset+8,  
bytesRemaining, MAX_RECORD_LENGTH);
         setRemainingData(remainingData);
         return bytesRemaining + 8;
     }

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersAtom.java 
Thu Apr 16 22:11:16 2020
@@ -22,6 +22,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -142,12 +143,10 @@ public final class HeadersFootersAtom ex
      */
        protected HeadersFootersAtom(byte[] source, int start, int len) {
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the record data
-               _recdata = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+8,_recdata,0,len-8);
+               _recdata = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
        }
 
     /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/HeadersFootersContainer.java
 Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
@@ -59,8 +60,7 @@ public final class HeadersFootersContain
 
     protected HeadersFootersContainer(byte[] source, int start, int len) {
         // Grab the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         _children = Record.findChildRecords(source,start+8,len-8);
         findInterestingChildren();

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfo.java 
Thu Apr 16 22:11:16 2020
@@ -18,6 +18,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.POILogger;
@@ -31,22 +32,21 @@ import org.apache.poi.util.POILogger;
 public class InteractiveInfo extends RecordContainer {
        private byte[] _header;
        private static final long _type = RecordTypes.InteractiveInfo.typeID;
-       
+
        // Links to our more interesting children
        private InteractiveInfoAtom infoAtom;
-       
-       /** 
+
+       /**
         * Returns the InteractiveInfoAtom of this InteractiveInfo
-        */ 
+        */
        public InteractiveInfoAtom getInteractiveInfoAtom() { return infoAtom; }
-       
-       /** 
+
+       /**
         * Set things up, and find our more interesting children
         */
        protected InteractiveInfo(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
@@ -57,7 +57,7 @@ public class InteractiveInfo extends Rec
         * Go through our child records, picking out the ones that are
         *  interesting, and saving those for use by the easy helper
         *  methods.
-        */     
+        */
        private void findInterestingChildren() {
                // First child should be the InteractiveInfoAtom
            if (_children == null || _children.length == 0 || !(_children[0] 
instanceof InteractiveInfoAtom)) {
@@ -67,18 +67,18 @@ public class InteractiveInfo extends Rec
 
            infoAtom = (InteractiveInfoAtom)_children[0];
        }
-       
+
        /**
         * Create a new InteractiveInfo, with blank fields
         */
        public InteractiveInfo() {
                _header = new byte[8];
                _children = new org.apache.poi.hslf.record.Record[1];
-               
+
                // Setup our header block
                _header[0] = 0x0f; // We are a container record
                LittleEndian.putShort(_header, 2, (short)_type);
-               
+
                // Setup our child records
                infoAtom = new InteractiveInfoAtom();
                _children[0] = infoAtom;

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/InteractiveInfoAtom.java
 Thu Apr 16 22:11:16 2020
@@ -22,6 +22,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -153,12 +154,10 @@ public class InteractiveInfoAtom extends
      */
     protected InteractiveInfoAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         // Must be at least 16 bytes long
         if(_data.length < 16) {

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MainMaster.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MainMaster.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MainMaster.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MainMaster.java Thu 
Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * Master slide
@@ -57,8 +58,7 @@ public final class MainMaster extends Sh
         */
        protected MainMaster(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
@@ -66,19 +66,19 @@ public final class MainMaster extends Sh
                ArrayList<TxMasterStyleAtom> tx = new ArrayList<>();
                ArrayList<ColorSchemeAtom> clr = new ArrayList<>();
                // Find the interesting ones in there
-               for(int i=0; i<_children.length; i++) {
-                       if(_children[i] instanceof SlideAtom) {
-                               slideAtom = (SlideAtom)_children[i];
-                       } else if(_children[i] instanceof PPDrawing) {
-                               ppDrawing = (PPDrawing)_children[i];
-                       } else if(_children[i] instanceof TxMasterStyleAtom) {
-                               tx.add( (TxMasterStyleAtom)_children[i] );
-                       } else if(_children[i] instanceof ColorSchemeAtom) {
-                               clr.add( (ColorSchemeAtom)_children[i] );
+               for (Record child : _children) {
+                       if (child instanceof SlideAtom) {
+                               slideAtom = (SlideAtom) child;
+                       } else if (child instanceof PPDrawing) {
+                               ppDrawing = (PPDrawing) child;
+                       } else if (child instanceof TxMasterStyleAtom) {
+                               tx.add((TxMasterStyleAtom) child);
+                       } else if (child instanceof ColorSchemeAtom) {
+                               clr.add((ColorSchemeAtom) child);
                        }
 
-                       if(ppDrawing != null && _children[i] instanceof 
ColorSchemeAtom) {
-                               _colorScheme = (ColorSchemeAtom)_children[i];
+                       if (ppDrawing != null && child instanceof 
ColorSchemeAtom) {
+                               _colorScheme = (ColorSchemeAtom) child;
                        }
 
                }

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/MasterTextPropAtom.java 
Thu Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -76,12 +77,10 @@ public final class MasterTextPropAtom ex
      */
     protected MasterTextPropAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         try {
             read();

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Notes.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Notes.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Notes.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Notes.java Thu Apr 
16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 /**
  * Master container for Notes. There is one of these for every page of
@@ -53,23 +54,22 @@ public final class Notes extends SheetCo
         */
        protected Notes(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
 
                // Find the interesting ones in there
-               for(int i=0; i<_children.length; i++) {
-                       if(_children[i] instanceof NotesAtom) {
-                               notesAtom = (NotesAtom)_children[i];
+               for (Record child : _children) {
+                       if (child instanceof NotesAtom) {
+                               notesAtom = (NotesAtom) child;
                        }
-                       if(_children[i] instanceof PPDrawing) {
-                               ppDrawing = (PPDrawing)_children[i];
+                       if (child instanceof PPDrawing) {
+                               ppDrawing = (PPDrawing) child;
+                       }
+                       if (ppDrawing != null && child instanceof 
ColorSchemeAtom) {
+                               _colorScheme = (ColorSchemeAtom) child;
                        }
-            if(ppDrawing != null && _children[i] instanceof ColorSchemeAtom) {
-                _colorScheme = (ColorSchemeAtom)_children[i];
-            }
                }
        }
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/NotesAtom.java Thu 
Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -70,33 +71,19 @@ public final class NotesAtom extends Rec
                if(len < 8) { len = 8; }
 
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Get the slide ID
                slideID = LittleEndian.getInt(source,start+8);
 
                // Grok the flags, stored as bits
                int flags = LittleEndian.getUShort(source,start+12);
-               if((flags&4) == 4) {
-                       followMasterBackground = true;
-               } else {
-                       followMasterBackground = false;
-               }
-               if((flags&2) == 2) {
-                       followMasterScheme = true;
-               } else {
-                       followMasterScheme = false;
-               }
-               if((flags&1) == 1) {
-                       followMasterObjects = true;
-               } else {
-                       followMasterObjects = false;
-               }
+               followMasterBackground = (flags & 4) == 4;
+               followMasterScheme = (flags & 2) == 2;
+               followMasterObjects = (flags & 1) == 1;
 
                // There might be 2 more bytes, which are a reserved field
-               reserved = IOUtils.safelyAllocate(len-14, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+14,reserved,0,reserved.length);
+               reserved = IOUtils.safelyClone(source, start+14, len-14, 
MAX_RECORD_LENGTH);
        }
 
        /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -28,7 +29,7 @@ import org.apache.poi.util.LittleEndian;
 
 /**
  * OEPlaceholderAtom (3011).<p>
- * 
+ *
  * An atom record that specifies whether a shape is a placeholder shape.
  *
  * @see Placeholder
@@ -77,10 +78,8 @@ public final class OEPlaceholderAtom ext
      * Build an instance of {@code OEPlaceholderAtom} from on-disk data
      */
        protected OEPlaceholderAtom(byte[] source, int start, int len) {
-               _header = new byte[8];
-        int offset = start;
-        System.arraycopy(source,start,_header,0,8);
-        offset += _header.length;
+        _header = Arrays.copyOfRange(source, start, start+8);
+        int offset = start+8;
 
         placementId = LittleEndian.getInt(source, offset); offset += 4;
         placeholderId = LittleEndian.getUByte(source, offset); offset++;
@@ -96,7 +95,7 @@ public final class OEPlaceholderAtom ext
 
     /**
      * Returns the placement Id.<p>
-     * 
+     *
      * The placement Id is a number assigned to the placeholder. It goes from 
-1 to the number of placeholders.
      * It SHOULD be unique among all PlacholderAtom records contained in the 
corresponding slide.
      * The value 0xFFFFFFFF specifies that the corresponding shape is not a 
placeholder shape.

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -55,8 +56,7 @@ public final class OutlineTextRefAtom ex
      */
     protected OutlineTextRefAtom(byte[] source, int start, int len) {
         // Get the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Grab the record data
         _index = LittleEndian.getInt(source, start+8);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawing.java Thu 
Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -114,15 +115,13 @@ public final class PPDrawing extends Rec
         */
        PPDrawing(byte[] source, int start, int len) {
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Get the type
                _type = LittleEndian.getUShort(_header,2);
 
                // Get the contents for now
-               final byte[] contents = IOUtils.safelyAllocate(len, 
MAX_RECORD_LENGTH);
-               System.arraycopy(source,start,contents,0,len);
+               final byte[] contents = IOUtils.safelyClone(source, start, len, 
MAX_RECORD_LENGTH);
 
                // Build up a tree of Escher records contained within
                final DefaultEscherRecordFactory erf = new 
HSLFEscherRecordFactory();
@@ -342,7 +341,7 @@ public final class PPDrawing extends Rec
                spContainer.addChildRecord(opt);
 
                dgContainer.addChildRecord(spContainer);
-               
+
                childRecords.add(dgContainer);
        }
 
@@ -364,7 +363,7 @@ public final class PPDrawing extends Rec
        public EscherContainerRecord getDgContainer() {
                return (EscherContainerRecord)firstEscherRecord(this, 
EscherRecordTypes.DG_CONTAINER).orElse(null);
        }
-       
+
        /**
         * Return EscherDgRecord which keeps track of the number of shapes and 
shapeId in this drawing group
         *

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java 
Thu Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -50,12 +51,10 @@ public final class PPDrawingGroup extend
 
     protected PPDrawingGroup(byte[] source, int start, int len) {
         // Get the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the contents for now
-        byte[] contents = IOUtils.safelyAllocate(len, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start,contents,0,len);
+        byte[] contents = IOUtils.safelyClone(source, start, len, 
MAX_RECORD_LENGTH);
 
         DefaultEscherRecordFactory erf = new HSLFEscherRecordFactory();
         EscherRecord child = erf.createRecord(contents, 0);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java 
Thu Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -65,7 +66,7 @@ public final class PersistPtrHolder exte
 
        private static final BitField persistIdFld = 
BitFieldFactory.getInstance(0X000FFFFF);
        private static final BitField cntPersistFld  = 
BitFieldFactory.getInstance(0XFFF00000);
-       
+
     /**
      * Return the value we were given at creation, be it 6001 or 6002
      */
@@ -93,7 +94,7 @@ public final class PersistPtrHolder exte
        public Map<Integer,Integer> getSlideLocationsLookup() {
                return Collections.unmodifiableMap(_slideLocations);
        }
-       
+
        /**
         * Create a new holder for a PersistPtr record
         */
@@ -103,8 +104,7 @@ public final class PersistPtrHolder exte
                if(len < 8) { len = 8; }
 
                // Treat as an atom, grab and hold everything
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
                _type = LittleEndian.getUShort(_header,2);
 
                // Try to make sense of the data part:
@@ -115,8 +115,7 @@ public final class PersistPtrHolder exte
                //   count * 32 bit offsets
                // Repeat as many times as you have data
                _slideLocations = new HashMap<>();
-               _ptrData = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+8,_ptrData,0,_ptrData.length);
+               _ptrData = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
 
                int pos = 0;
                while(pos < _ptrData.length) {
@@ -127,7 +126,7 @@ public final class PersistPtrHolder exte
                        // Remaining 12 bits = offset count
             int offset_no = persistIdFld.getValue(info);
                        int offset_count = cntPersistFld.getValue(info);
-                       
+
                        // Wind on by the 4 byte info header
                        pos += 4;
 
@@ -145,13 +144,13 @@ public final class PersistPtrHolder exte
 
     /**
      *  remove all slide references
-     *  
+     *
      *  Convenience method provided, for easier reviewing of invocations
      */
     public void clear() {
         _slideLocations.clear();
     }
-    
+
     /**
      * Adds a new slide, notes or similar, to be looked up by this.
      */
@@ -187,7 +186,7 @@ public final class PersistPtrHolder exte
 
        private void normalizePersistDirectory() {
         TreeMap<Integer,Integer> orderedSlideLocations = new 
TreeMap<>(_slideLocations);
-        
+
         @SuppressWarnings("resource")
         BufAccessBAOS bos = new BufAccessBAOS(); // NOSONAR
         byte[] intbuf = new byte[4];
@@ -200,7 +199,7 @@ public final class PersistPtrHolder exte
                 // Building the info block
                 // First 20 bits = offset number = slide ID (persistIdFld, 
i.e. first slide ID of a continuous group)
                 // Remaining 12 bits = offset count = 1 (cntPersistFld, i.e. 
continuous entries in a group)
-                
+
                 if (lastSlideId+1 == nextSlideId) {
                     // use existing PersistDirectoryEntry, need to increase 
entry count
                     assert(lastPersistEntry != -1);
@@ -225,14 +224,14 @@ public final class PersistPtrHolder exte
                 throw new HSLFException(e);
             }
         }
-        
+
         // Save the new ptr data
         _ptrData = bos.toByteArray();
 
         // Update the atom header
         LittleEndian.putInt(_header,4,bos.size());
        }
-       
+
        /**
         * Write the contents of the record back, so it can be written
         *  to disk
@@ -243,7 +242,7 @@ public final class PersistPtrHolder exte
                out.write(_header);
                out.write(_ptrData);
        }
-       
+
     private static class BufAccessBAOS extends ByteArrayOutputStream {
         public byte[] getBuf() {
             return buf;

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RecordContainer.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -76,8 +77,7 @@ public abstract class RecordContainer ex
         */
        private int appendChild(Record newChild) {
                // Copy over, and pop the child in at the end
-               Record[] nc = new 
org.apache.poi.hslf.record.Record[(_children.length + 1)];
-               System.arraycopy(_children, 0, nc, 0, _children.length);
+               Record[] nc = Arrays.copyOf(_children, _children.length+1, 
org.apache.poi.hslf.record.Record[].class);
                // Switch the arrays
                nc[_children.length] = newChild;
                _children = nc;

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RoundTripHFPlaceholder12.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RoundTripHFPlaceholder12.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RoundTripHFPlaceholder12.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/RoundTripHFPlaceholder12.java
 Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -55,7 +56,7 @@ public final class RoundTripHFPlaceholde
         LittleEndian.putInt(_header, 4, 8);
         _placeholderId = 0;
     }
-    
+
     /**
      * Constructs the comment atom record from its source data.
      *
@@ -65,8 +66,7 @@ public final class RoundTripHFPlaceholde
      */
     protected RoundTripHFPlaceholder12(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
         _placeholderId = source[start+8];

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SSSlideInfoAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SSSlideInfoAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SSSlideInfoAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SSSlideInfoAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -31,7 +32,7 @@ import org.apache.poi.util.LittleEndianC
 /**
  * A SlideShowSlideInfo Atom (type 1017).<br>
  * <br>
- *  
+ *
  * An atom record that specifies which transition effects to perform
  * during a slide show, and how to advance to the next presentation slide.<br>
  * <br>
@@ -70,30 +71,30 @@ public class SSSlideInfoAtom extends Rec
      * manually advanced by the user during the slide show.
      */
     public static final int MANUAL_ADVANCE_BIT     = 1 << 0;
-    
+
     /**
-     * A bit that specifies whether the corresponding slide is 
+     * A bit that specifies whether the corresponding slide is
      * hidden and is not displayed during the slide show.
      */
     public static final int HIDDEN_BIT             = 1 << 2;
-    
+
     /**
      * A bit that specifies whether to play the sound specified by soundIfRef.
      */
     public static final int SOUND_BIT              = 1 << 4;
-    
+
     /**
      * A bit that specifies whether the sound specified by soundIdRef is
      * looped continuously when playing until the next sound plays.
      */
     public static final int LOOP_SOUND_BIT         = 1 << 6;
-    
+
     /**
-     * A bit that specifies whether to stop any currently playing 
+     * A bit that specifies whether to stop any currently playing
      * sound when the transition starts.
      */
     public static final int STOP_SOUND_BIT         = 1 << 8;
-    
+
     /**
      * A bit that specifies whether the slide will automatically
      * advance after slideTime milliseconds during the slide show.
@@ -102,10 +103,10 @@ public class SSSlideInfoAtom extends Rec
 
     /**
      * A bit that specifies whether to display the cursor during
-     * the slide show. 
+     * the slide show.
      */
     public static final int CURSOR_VISIBLE_BIT     = 1 << 12;
-    
+
     // public static int RESERVED1_BIT       = 1 << 1;
     // public static int RESERVED2_BIT       = 1 << 3;
     // public static int RESERVED3_BIT       = 1 << 5;
@@ -144,9 +145,9 @@ public class SSSlideInfoAtom extends Rec
      * less than or equal to 86399000. It MUST be ignored unless 
AUTO_ADVANCE_BIT is TRUE.
      */
     private int _slideTime;
-    
+
     /**
-     * A SoundIdRef that specifies which sound to play when the transition 
starts. 
+     * A SoundIdRef that specifies which sound to play when the transition 
starts.
      */
     private int _soundIdRef;
 
@@ -155,23 +156,23 @@ public class SSSlideInfoAtom extends Rec
      * there are further restriction and specification of this field.
      */
     private short _effectDirection; // byte
-    
+
     /**
      * A byte that specifies which transition is used when transitioning to the
-     * next presentation slide during a slide show. Exact rendering of any 
transition is 
+     * next presentation slide during a slide show. Exact rendering of any 
transition is
      * determined by the rendering application. As such, the same transition 
can have
      * many variations depending on the implementation.
      */
     private short _effectType; // byte
-    
+
     /**
      * Various flags - see bitmask for more details
      */
     private short _effectTransitionFlags;
-    
+
     /**
      * A byte value that specifies how long the transition takes to run.
-     * (0x00 = 0.75 seconds, 0x01 = 0.5 seconds, 0x02 = 0.25 seconds) 
+     * (0x00 = 0.75 seconds, 0x01 = 0.5 seconds, 0x02 = 0.25 seconds)
      */
     private short _speed; // byte
     private byte[] _unused; // 3-byte
@@ -184,18 +185,18 @@ public class SSSlideInfoAtom extends Rec
         LittleEndian.putShort(_header, 6, (short)0);
         _unused = new byte[3];
     }
-    
+
     public SSSlideInfoAtom(byte[] source, int offset, int len) {
         int ofs = offset;
 
         // Sanity Checking
         if(len != 24) len = 24;
         assert(source.length >= offset+len);
-        
+
         // Get the header
-        _header = LittleEndian.getByteArray(source,ofs,8);
+        _header = Arrays.copyOfRange(source, ofs, ofs+8);
         ofs += _header.length;
-        
+
         assert(LittleEndian.getShort(_header, 0) == 0);
         assert(LittleEndian.getShort(_header, 2) == 
RecordTypes.SSSlideInfoAtom.typeID);
         assert(LittleEndian.getShort(_header, 4) == 0x10);
@@ -214,7 +215,7 @@ public class SSSlideInfoAtom extends Rec
         ofs += LittleEndianConsts.SHORT_SIZE;
         _speed = LittleEndian.getUByte(source, ofs);
         ofs += LittleEndianConsts.BYTE_SIZE;
-        _unused = LittleEndian.getByteArray(source,ofs,3);
+        _unused = Arrays.copyOfRange(source,ofs,ofs+3);
     }
 
     /**
@@ -232,7 +233,7 @@ public class SSSlideInfoAtom extends Rec
         out.write(byteBuf);
         LittleEndian.putUByte(byteBuf, 0, _effectType);
         out.write(byteBuf);
-        
+
         writeLittleEndian(_effectTransitionFlags, out);
         LittleEndian.putUByte(byteBuf, 0, _speed);
         out.write(byteBuf);
@@ -240,7 +241,7 @@ public class SSSlideInfoAtom extends Rec
         assert(_unused.length == 3);
         out.write(_unused);
     }
-    
+
     /**
      * We are of type 1017
      */
@@ -303,7 +304,7 @@ public class SSSlideInfoAtom extends Rec
     public boolean getEffectTransitionFlagByBit(int bitmask) {
         return ((_effectTransitionFlags & bitmask) != 0);
     }
-    
+
     public short getSpeed() {
         return _speed;
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Slide.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Slide.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Slide.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Slide.java Thu Apr 
16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 
@@ -56,24 +57,22 @@ public final class Slide extends SheetCo
         */
        protected Slide(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
 
                // Find the interesting ones in there
-               for(int i=0; i<_children.length; i++) {
-                       if(_children[i] instanceof SlideAtom) {
-                               slideAtom = (SlideAtom)_children[i];
-                       }
-                       else if(_children[i] instanceof PPDrawing) {
-                               ppDrawing = (PPDrawing)_children[i];
+               for (Record child : _children) {
+                       if (child instanceof SlideAtom) {
+                               slideAtom = (SlideAtom) child;
+                       } else if (child instanceof PPDrawing) {
+                               ppDrawing = (PPDrawing) child;
                        }
 
-            if(ppDrawing != null && _children[i] instanceof ColorSchemeAtom) {
-                _colorScheme = (ColorSchemeAtom)_children[i];
-            }
+                       if (ppDrawing != null && child instanceof 
ColorSchemeAtom) {
+                               _colorScheme = (ColorSchemeAtom) child;
+                       }
                }
        }
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtom.java Thu 
Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -83,12 +84,10 @@ public final class SlideAtom extends Rec
                if(len < 30) { len = 30; }
 
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the 12 bytes that is "SSlideLayoutAtom"
-               byte[] SSlideLayoutAtomData = new byte[12];
-               System.arraycopy(source,start+8,SSlideLayoutAtomData,0,12);
+               byte[] SSlideLayoutAtomData = 
Arrays.copyOfRange(source,start+8, start+12+8);
                // Use them to build up the SSlideLayoutAtom
                layoutAtom = new SlideAtomLayout(SSlideLayoutAtomData);
 
@@ -98,26 +97,13 @@ public final class SlideAtom extends Rec
 
                // Grok the flags, stored as bits
                int flags = LittleEndian.getUShort(source,start+20+8);
-               if((flags&4) == 4) {
-                       followMasterBackground = true;
-               } else {
-                       followMasterBackground = false;
-               }
-               if((flags&2) == 2) {
-                       followMasterScheme = true;
-               } else {
-                       followMasterScheme = false;
-               }
-               if((flags&1) == 1) {
-                       followMasterObjects = true;
-               } else {
-                       followMasterObjects = false;
-               }
+               followMasterBackground = (flags & 4) == 4;
+               followMasterScheme = (flags & 2) == 2;
+               followMasterObjects = (flags & 1) == 1;
 
                // If there's any other bits of data, keep them about
                // 8 bytes header + 20 bytes to flags + 2 bytes flags = 30 bytes
-               reserved = IOUtils.safelyAllocate(len-30, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+30,reserved,0,reserved.length);
+               reserved = IOUtils.safelyClone(source,start+30, len-30, 
MAX_RECORD_LENGTH);
        }
 
        /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtomLayout.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtomLayout.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtomLayout.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideAtomLayout.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -32,7 +33,7 @@ import org.apache.poi.util.LittleEndian;
  * Holds the geometry of the Slide, and the ID of the placeholders on the 
slide.
  * Embedded inside a SlideAtom is a SlideAtomLayout, without the usual record 
header.
  * Since it's a fixed size and tied to the SlideAtom, we'll hold it here.<p>
- * 
+ *
  * This might eventually merged with the XSLF counterpart
  */
 @Internal
@@ -82,7 +83,7 @@ public class SlideAtomLayout implements
         SlideLayoutType(int nativeId) {
             this.nativeId = nativeId;
         }
-        
+
         public int getNativeId() {
             return nativeId;
         }
@@ -117,8 +118,7 @@ public class SlideAtomLayout implements
 
         // Grab out our data
         geometry = SlideLayoutType.forNativeID(LittleEndian.getInt(data,0));
-        placeholderIDs = new byte[8];
-        System.arraycopy(data,4,placeholderIDs,0,8);
+        placeholderIDs = Arrays.copyOfRange(data,4, 4+8);
     }
 
     /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlideListWithText.java 
Thu Apr 16 22:11:16 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hslf.record;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.poi.util.LittleEndian;
@@ -74,8 +75,7 @@ public final class SlideListWithText ext
         */
        protected SlideListWithText(byte[] source, int start, int len) {
                // Grab the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Find our children
                _children = Record.findChildRecords(source,start+8,len-8);
@@ -96,8 +96,7 @@ public final class SlideListWithText ext
 
                                // Create a SlideAtomsSets, not caring if 
they're empty
                                //if(emptySet) { continue; }
-                               org.apache.poi.hslf.record.Record[] spaChildren 
= new org.apache.poi.hslf.record.Record[clen];
-                               
System.arraycopy(_children,i+1,spaChildren,0,clen);
+                               org.apache.poi.hslf.record.Record[] spaChildren 
= Arrays.copyOfRange(_children,i+1, i+1+clen, 
org.apache.poi.hslf.record.Record[].class);
                                SlideAtomsSet set = new 
SlideAtomsSet((SlidePersistAtom)_children[i],spaChildren);
                                sets.add(set);
 

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlidePersistAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlidePersistAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlidePersistAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SlidePersistAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import static org.apache.poi.util.Generi
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -44,7 +45,7 @@ public final class SlidePersistAtom exte
        private static final String[] FLAGS_NAMES = { 
"HAS_SHAPES_OTHER_THAN_PLACEHOLDERS" };
 
 
-       private final byte[] _header = new byte[8];
+       private final byte[] _header;
 
        /** Slide reference ID. Should correspond to the PersistPtr "sheet ID" 
of the matching slide/notes record */
        private int refID;
@@ -91,7 +92,7 @@ public final class SlidePersistAtom exte
                if(len < 8) { len = 8; }
 
                // Get the header
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the reference ID
                refID = LittleEndian.getInt(source,start+8);
@@ -107,14 +108,14 @@ public final class SlidePersistAtom exte
 
                // Finally you have typically 4 or 8 bytes of reserved fields,
                //  all zero running from 24 bytes in to the end
-               reservedFields = IOUtils.safelyAllocate(len-24, 
MAX_RECORD_LENGTH);
-               
System.arraycopy(source,start+24,reservedFields,0,reservedFields.length);
+               reservedFields = IOUtils.safelyClone(source,start+24, len-24, 
MAX_RECORD_LENGTH);
        }
 
        /**
         * Create a new SlidePersistAtom, for use with a new Slide
         */
        public SlidePersistAtom() {
+               _header = new byte[8];
                LittleEndian.putUShort(_header, 0, 0);
                LittleEndian.putUShort(_header, 2, (int)_type);
                LittleEndian.putInt(_header, 4, 20);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/Sound.java Thu Apr 
16 22:11:16 2020
@@ -17,10 +17,11 @@
 
 package org.apache.poi.hslf.record;
 
-import org.apache.poi.util.POILogger;
-
-import java.io.OutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+
+import org.apache.poi.util.POILogger;
 
 /**
  * A container holding information about a sound. It contains:
@@ -55,8 +56,7 @@ public final class Sound extends RecordC
      */
     protected Sound(byte[] source, int start, int len) {
         // Grab the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Find our children
         _children = Record.findChildRecords(source,start+8,len-8);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundCollection.java 
Thu Apr 16 22:11:16 2020
@@ -17,8 +17,9 @@
 
 package org.apache.poi.hslf.record;
 
-import java.io.OutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
 
 /**
  * Is a container for all sound related atoms and containers. It contains:
@@ -42,8 +43,7 @@ public final class SoundCollection exten
      */
     protected SoundCollection(byte[] source, int start, int len) {
         // Grab the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Find our children
         _children = Record.findChildRecords(source,start+8,len-8);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/SoundData.java Thu 
Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -68,12 +69,10 @@ public final class SoundData extends Rec
      */
     protected SoundData(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
     }
 
     /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextProp9Atom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextProp9Atom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextProp9Atom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextProp9Atom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -45,7 +46,7 @@ public final class StyleTextProp9Atom ex
     private short version;
     private short recordId;
     private int length;
-    
+
     /**
      * Constructs the link related atom record from its
      *  source data.
@@ -57,35 +58,33 @@ public final class StyleTextProp9Atom ex
     protected StyleTextProp9Atom(byte[] source, int start, int len) {
         // Get the header.
         final List<TextPFException9> schemes = new LinkedList<>();
-        header = new byte[8];
-        System.arraycopy(source,start, header,0,8);
+        header = Arrays.copyOfRange(source, start, start+8);
         this.version  = LittleEndian.getShort(header, 0);
         this.recordId = LittleEndian.getShort(header, 2);
         this.length   = LittleEndian.getInt(header, 4);
-        
+
         // Get the record data.
-        data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source, start+8, data, 0, len-8);
+        data = IOUtils.safelyClone(source,  start+8, len-8, MAX_RECORD_LENGTH);
         for (int i = 0; i < data.length; ) {
             final TextPFException9 item = new TextPFException9(data, i);
             schemes.add(item);
             i += item.getRecordLength();
-            
+
             if (i+4 >= data.length) {
                 break;
             }
             int textCfException9 = LittleEndian.getInt(data, i );
             i += 4;
             //TODO analyze textCfException when have some test data
-            
+
             if (i+4 >= data.length) {
                 break;
             }
             int textSiException = LittleEndian.getInt(data, i );
             i += 4;//TextCFException9 + SIException
-            
-            if (0 != (textSiException & 0x40)) { 
-                i += 2; //skip fBidi 
+
+            if (0 != (textSiException & 0x40)) {
+                i += 2; //skip fBidi
             }
             if (i+4 >= data.length) {
                 break;

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Supplier;
@@ -130,13 +131,11 @@ public final class StyleTextPropAtom ext
         }
 
         // Get the header
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Save the contents of the atom, until we're asked to go and
         //  decode them (via a call to setParentTextSize(int)
-        rawContents = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,rawContents,0,rawContents.length);
+        rawContents = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
         reserved = new byte[0];
 
         // Set empty lists, ready for when they call setParentTextSize
@@ -289,8 +288,7 @@ public final class StyleTextPropAtom ext
 
         // Handle anything left over
         if(pos < rawContents.length) {
-            reserved = IOUtils.safelyAllocate(rawContents.length-pos, 
rawContents.length);
-            System.arraycopy(rawContents,pos,reserved,0,reserved.length);
+            reserved = IOUtils.safelyClone(rawContents, pos, 
rawContents.length-pos, rawContents.length);
         }
 
         initialised = true;

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextBytesAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextBytesAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextBytesAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextBytesAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -69,12 +70,10 @@ public final class TextBytesAtom extends
                if(len < 8) { len = 8; }
 
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the text
-               _text = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+8,_text,0,len-8);
+               _text = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
        }
 
        /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextCharsAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextCharsAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextCharsAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextCharsAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -68,12 +69,10 @@ public final class TextCharsAtom extends
                if(len < 8) { len = 8; }
 
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the text
-               _text = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start+8,_text,0,len-8);
+               _text = IOUtils.safelyClone(source, start+8, len-8, 
MAX_RECORD_LENGTH);
        }
        /**
         * Create an empty TextCharsAtom

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextHeaderAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextHeaderAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextHeaderAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextHeaderAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -84,8 +85,7 @@ public final class TextHeaderAtom extend
                }
 
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,start,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
 
                // Grab the type
                textType = LittleEndian.getInt(source,start+8);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Supplier;
@@ -43,7 +44,7 @@ public final class TextSpecInfoAtom exte
     private static final int MAX_RECORD_LENGTH = 100_000;
 
     private static final long _type = RecordTypes.TextSpecInfoAtom.typeID;
-    
+
     /**
      * Record header.
      */
@@ -55,14 +56,14 @@ public final class TextSpecInfoAtom exte
     private byte[] _data;
 
     /**
-     * Constructs an empty atom, with a default run of size 1 
+     * Constructs an empty atom, with a default run of size 1
      */
     public TextSpecInfoAtom() {
         _header = new byte[8];
         LittleEndian.putUInt(_header, 4, _type);
         reset(1);
     }
-    
+
     /**
      * Constructs the link related atom record from its
      *  source data.
@@ -73,13 +74,10 @@ public final class TextSpecInfoAtom exte
      */
     public TextSpecInfoAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
-
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
     }
     /**
      * Gets the record type.
@@ -157,7 +155,7 @@ public final class TextSpecInfoAtom exte
         // Update the size (header bytes 5-8)
         LittleEndian.putInt(_header, 4, _data.length);
     }
-    
+
     /**
      * Get the number of characters covered by this records
      *

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxInteractiveInfoAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxInteractiveInfoAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxInteractiveInfoAtom.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxInteractiveInfoAtom.java
 Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -67,13 +68,10 @@ public final class TxInteractiveInfoAtom
      */
     protected TxInteractiveInfoAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,len-8);
-
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
     }
 
     /**

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxMasterStyleAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxMasterStyleAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxMasterStyleAtom.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/TxMasterStyleAtom.java 
Thu Apr 16 22:11:16 2020
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Supplier;
@@ -70,11 +71,9 @@ public final class TxMasterStyleAtom ext
     private List<TextPropCollection> charStyles;
 
     protected TxMasterStyleAtom(byte[] source, int start, int len) {
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
-        _data = IOUtils.safelyAllocate(len-8, MAX_RECORD_LENGTH);
-        System.arraycopy(source,start+8,_data,0,_data.length);
+        _data = IOUtils.safelyClone(source, start+8, len-8, MAX_RECORD_LENGTH);
 
         //read available styles
         try {

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UnknownRecordPlaceholder.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UnknownRecordPlaceholder.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UnknownRecordPlaceholder.java
 (original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UnknownRecordPlaceholder.java
 Thu Apr 16 22:11:16 2020
@@ -53,8 +53,7 @@ public final class UnknownRecordPlacehol
                if(len < 0) { len = 0; }
 
                // Treat as an atom, grab and hold everything
-               _contents = IOUtils.safelyAllocate(len, MAX_RECORD_LENGTH);
-               System.arraycopy(source,start,_contents,0,len);
+               _contents = IOUtils.safelyClone(source, start, len, 
MAX_RECORD_LENGTH);
                _type = LittleEndian.getUShort(_contents,2);
        }
 

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -89,8 +90,7 @@ public final class UserEditAtom extends
 
                int offset = start;
                // Get the header
-               _header = new byte[8];
-               System.arraycopy(source,offset,_header,0,8);
+               _header = Arrays.copyOfRange(source, start, start+8);
                offset += 8;
 
                // Get the last viewed slide ID
@@ -125,7 +125,7 @@ public final class UserEditAtom extends
                // Last view type
                lastViewType = LittleEndian.getShort(source,offset);
                offset += LittleEndianConsts.SHORT_SIZE;
-               
+
                // unused
                unused = LittleEndian.getShort(source,offset);
                offset += LittleEndianConsts.SHORT_SIZE;
@@ -135,7 +135,7 @@ public final class UserEditAtom extends
                    encryptSessionPersistIdRef = 
LittleEndian.getInt(source,offset);
                    offset += LittleEndianConsts.INT_SIZE;
                }
-               
+
                assert(offset-start == len);
        }
 

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoAtom.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoAtom.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoAtom.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoAtom.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.function.Supplier;
 
@@ -30,7 +31,7 @@ import org.apache.poi.util.LittleEndian;
  */
 public final class VBAInfoAtom extends RecordAtom {
     private static final long _type = RecordTypes.VBAInfoAtom.typeID;
-    
+
     /**
      * Record header.
      */
@@ -44,7 +45,7 @@ public final class VBAInfoAtom extends R
     private long version;
 
     /**
-     * Constructs an empty atom - not yet supported 
+     * Constructs an empty atom - not yet supported
      */
     private VBAInfoAtom() {
         _header = new byte[8];
@@ -54,7 +55,7 @@ public final class VBAInfoAtom extends R
         hasMacros = true;
         version = 2;
     }
-    
+
     /**
      * Constructs the vba atom record from its source data.
      *
@@ -64,8 +65,7 @@ public final class VBAInfoAtom extends R
      */
     public VBAInfoAtom(byte[] source, int start, int len) {
         // Get the header.
-        _header = new byte[8];
-        System.arraycopy(source,start,_header,0,8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Get the record data.
         persistIdRef = LittleEndian.getUInt(source, start+8);

Modified: 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoContainer.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoContainer.java?rev=1876640&r1=1876639&r2=1876640&view=diff
==============================================================================
--- 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoContainer.java 
(original)
+++ 
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/VBAInfoContainer.java 
Thu Apr 16 22:11:16 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.record;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 import org.apache.poi.util.LittleEndian;
 
@@ -36,8 +37,7 @@ public final class VBAInfoContainer exte
      */
     protected VBAInfoContainer(byte[] source, int start, int len) {
         // Grab the header
-        _header = new byte[8];
-        System.arraycopy(source, start, _header, 0, 8);
+        _header = Arrays.copyOfRange(source, start, start+8);
 
         // Find our children
         _children = Record.findChildRecords(source, start + 8, len - 8);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to