From 19e3be1f39c7dabd7abdc5dbbf066072b6d5eb45 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 2 Jul 2019 13:56:39 -0400 Subject: [PATCH] Address Codacy error and and netbeans suggestion in BinaryCookieReader.java, array now copied --- .../autopsy/recentactivity/BinaryCookieReader.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/BinaryCookieReader.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/BinaryCookieReader.java index ce92c2e084..1937377804 100755 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/BinaryCookieReader.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/BinaryCookieReader.java @@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.recentactivity.BinaryCookieReader.Cookie; */ final class BinaryCookieReader implements Iterable { + private static final Logger LOG = Logger.getLogger(BinaryCookieReader.class.getName()); private static final int MAGIC_SIZE = 4; private static final int SIZEOF_INT_BYTES = 4; private static final int PAGE_HEADER_VALUE = 256; @@ -53,8 +54,6 @@ final class BinaryCookieReader implements Iterable { private final int[] pageSizeArray; 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 mac .binarycookie files into one class. @@ -62,7 +61,7 @@ final class BinaryCookieReader implements Iterable { */ private BinaryCookieReader(File cookieFile, int[] pageSizeArray) { this.cookieFile = cookieFile; - this.pageSizeArray = pageSizeArray; + this.pageSizeArray = pageSizeArray.clone(); } /** @@ -71,7 +70,9 @@ final class BinaryCookieReader implements Iterable { * open. * * @param cookieFile binarycookie file + * * @return An instance of the reader + * * @throws FileNotFoundException * @throws IOException */ @@ -229,6 +230,7 @@ final class BinaryCookieReader implements Iterable { * correct format by checking for the header value of 0x0100. * * @param page byte array representing a cookie page + * * @throws IOException */ CookiePage(byte[] page) throws IOException { @@ -414,7 +416,8 @@ final class BinaryCookieReader implements Iterable { * offset ending at the first null terminator found. * * @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 */ private String decodeString(byte[] byteArray, int offset) {