Address Codacy error and and netbeans suggestion in BinaryCookieReader.java, array now copied

This commit is contained in:
William Schaefer 2019-07-02 13:56:39 -04:00
parent dfeeb60367
commit 19e3be1f39

View File

@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.recentactivity.BinaryCookieReader.Cookie;
*/ */
final class BinaryCookieReader implements Iterable<Cookie> { final class BinaryCookieReader implements Iterable<Cookie> {
private static final Logger LOG = Logger.getLogger(BinaryCookieReader.class.getName());
private static final int MAGIC_SIZE = 4; private static final int MAGIC_SIZE = 4;
private static final int SIZEOF_INT_BYTES = 4; private static final int SIZEOF_INT_BYTES = 4;
private static final int PAGE_HEADER_VALUE = 256; private static final int PAGE_HEADER_VALUE = 256;
@ -53,8 +54,6 @@ final class BinaryCookieReader implements Iterable<Cookie> {
private final int[] pageSizeArray; private final int[] pageSizeArray;
private final File cookieFile; private final File cookieFile;
private static final Logger LOG = Logger.getLogger(BinaryCookieReader.class.getName());
/** /**
* The binary cookie reader encapsulates all the knowledge of how to read * The binary cookie reader encapsulates all the knowledge of how to read
* the mac .binarycookie files into one class. * the mac .binarycookie files into one class.
@ -62,7 +61,7 @@ final class BinaryCookieReader implements Iterable<Cookie> {
*/ */
private BinaryCookieReader(File cookieFile, int[] pageSizeArray) { private BinaryCookieReader(File cookieFile, int[] pageSizeArray) {
this.cookieFile = cookieFile; this.cookieFile = cookieFile;
this.pageSizeArray = pageSizeArray; this.pageSizeArray = pageSizeArray.clone();
} }
/** /**
@ -71,7 +70,9 @@ final class BinaryCookieReader implements Iterable<Cookie> {
* open. * open.
* *
* @param cookieFile binarycookie file * @param cookieFile binarycookie file
*
* @return An instance of the reader * @return An instance of the reader
*
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws IOException * @throws IOException
*/ */
@ -229,6 +230,7 @@ final class BinaryCookieReader implements Iterable<Cookie> {
* correct format by checking for the header value of 0x0100. * correct format by checking for the header value of 0x0100.
* *
* @param page byte array representing a cookie page * @param page byte array representing a cookie page
*
* @throws IOException * @throws IOException
*/ */
CookiePage(byte[] page) throws IOException { CookiePage(byte[] page) throws IOException {
@ -415,6 +417,7 @@ final class BinaryCookieReader implements Iterable<Cookie> {
* *
* @param byteArray Array of bytes * @param byteArray Array of bytes
* @param offset starting offset in the array * @param offset starting offset in the array
*
* @return String with bytes converted to ascii * @return String with bytes converted to ascii
*/ */
private String decodeString(byte[] byteArray, int offset) { private String decodeString(byte[] byteArray, int offset) {