Merge pull request #5005 from wschaeferB/5297-CodacyErrorCleanup

5297 codacy error cleanup
This commit is contained in:
Richard Cordovano 2019-11-08 12:12:42 -05:00 committed by GitHub
commit c557b6264c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 112 additions and 82 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.coreutils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
@ -35,43 +36,43 @@ import org.sleuthkit.autopsy.coreutils.LnkEnums.NetworkProviderType;
*/ */
public class JLNK { public class JLNK {
private int header; private final int header;
private byte[] linkClassIdentifier; private final byte[] linkClassIdentifier;
private List<LinkFlags> linkFlags; private final List<LinkFlags> linkFlags;
private List<FileAttributesFlags> fileAttributesFlags; private final List<FileAttributesFlags> fileAttributesFlags;
private long crtime; private final long crtime;
private long atime; private final long atime;
private long mtime; private final long mtime;
private int fileSize; private final int fileSize;
private int iconIndex; private final int iconIndex;
private int showCommand; private final int showCommand;
private short hotKey; private final short hotKey;
private List<String> linkTargetIdList; private final List<String> linkTargetIdList;
private boolean hasUnicodeLocalBaseAndCommonSuffixOffset; private final boolean hasUnicodeLocalBaseAndCommonSuffixOffset;
private String localBasePath; private final String localBasePath;
private String commonPathSuffix; private final String commonPathSuffix;
private String localBasePathUnicode; private final String localBasePathUnicode;
private String commonPathSuffixUnicode; private final String commonPathSuffixUnicode;
private String name; private final String name;
private String relativePath; private final String relativePath;
private String workingDir; private final String workingDir;
private String arguments; private final String arguments;
private String iconLocation; private final String iconLocation;
private int driveSerialNumber; private final int driveSerialNumber;
private DriveType driveType; private final DriveType driveType;
private String volumeLabel; private final String volumeLabel;
private List<CommonNetworkRelativeLinkFlags> commonNetworkRelativeListFlags; private final List<CommonNetworkRelativeLinkFlags> commonNetworkRelativeListFlags;
private NetworkProviderType networkProviderType; private final NetworkProviderType networkProviderType;
private boolean unicodeNetAndDeviceName; private final boolean unicodeNetAndDeviceName;
private String netName; private final String netName;
private String netNameUnicode; private final String netNameUnicode;
private String deviceName; private final String deviceName;
private String deviceNameUnicode; private final String deviceNameUnicode;
public JLNK(int header, byte[] linkClassIdentifier, int linkFlags, public JLNK(int header, byte[] linkClassIdentifier, int linkFlags,
int fileAttributesFlags, long crtime, long atime, int fileAttributesFlags, long crtime, long atime,
@ -87,14 +88,14 @@ public class JLNK {
String netName, String netNameUnicode, String deviceName, String netName, String netNameUnicode, String deviceName,
String deviceNameUnicode) { String deviceNameUnicode) {
this.header = header; this.header = header;
this.linkClassIdentifier = linkClassIdentifier; this.linkClassIdentifier = linkClassIdentifier.clone();
this.linkFlags = new ArrayList<LinkFlags>(); this.linkFlags = new ArrayList<>();
for (LnkEnums.LinkFlags enumVal : LnkEnums.LinkFlags.values()) { for (LnkEnums.LinkFlags enumVal : LnkEnums.LinkFlags.values()) {
if ((linkFlags & enumVal.getFlag()) == enumVal.getFlag()) { if ((linkFlags & enumVal.getFlag()) == enumVal.getFlag()) {
this.linkFlags.add(enumVal); this.linkFlags.add(enumVal);
} }
} }
this.fileAttributesFlags = new ArrayList<FileAttributesFlags>(); this.fileAttributesFlags = new ArrayList<>();
for (LnkEnums.FileAttributesFlags enumVal : LnkEnums.FileAttributesFlags.values()) { for (LnkEnums.FileAttributesFlags enumVal : LnkEnums.FileAttributesFlags.values()) {
if ((fileAttributesFlags & enumVal.getFlag()) == enumVal.getFlag()) { if ((fileAttributesFlags & enumVal.getFlag()) == enumVal.getFlag()) {
this.fileAttributesFlags.add(enumVal); this.fileAttributesFlags.add(enumVal);
@ -121,7 +122,7 @@ public class JLNK {
this.driveSerialNumber = driveSerialNumber; this.driveSerialNumber = driveSerialNumber;
this.driveType = driveType; this.driveType = driveType;
this.volumeLabel = volumeLabel; this.volumeLabel = volumeLabel;
this.commonNetworkRelativeListFlags = new ArrayList<CommonNetworkRelativeLinkFlags>(); this.commonNetworkRelativeListFlags = new ArrayList<>();
for (LnkEnums.CommonNetworkRelativeLinkFlags enumVal : LnkEnums.CommonNetworkRelativeLinkFlags.values()) { for (LnkEnums.CommonNetworkRelativeLinkFlags enumVal : LnkEnums.CommonNetworkRelativeLinkFlags.values()) {
if ((commonNetworkRelativeListFlags & enumVal.getFlag()) == enumVal.getFlag()) { if ((commonNetworkRelativeListFlags & enumVal.getFlag()) == enumVal.getFlag()) {
this.commonNetworkRelativeListFlags.add(enumVal); this.commonNetworkRelativeListFlags.add(enumVal);
@ -140,7 +141,7 @@ public class JLNK {
} }
public List<CommonNetworkRelativeLinkFlags> getCommonNetworkRelativeListFlags() { public List<CommonNetworkRelativeLinkFlags> getCommonNetworkRelativeListFlags() {
return commonNetworkRelativeListFlags; return Collections.unmodifiableList(commonNetworkRelativeListFlags);
} }
public String getCommonPathSuffix() { public String getCommonPathSuffix() {
@ -176,7 +177,7 @@ public class JLNK {
} }
public List<FileAttributesFlags> getFileAttributesFlags() { public List<FileAttributesFlags> getFileAttributesFlags() {
return fileAttributesFlags; return Collections.unmodifiableList(fileAttributesFlags);
} }
public int getFileSize() { public int getFileSize() {
@ -196,7 +197,7 @@ public class JLNK {
} }
public List<String> getLinkTargetIdList() { public List<String> getLinkTargetIdList() {
return linkTargetIdList; return Collections.unmodifiableList(linkTargetIdList);
} }
public int getIconIndex() { public int getIconIndex() {
@ -208,11 +209,11 @@ public class JLNK {
} }
public byte[] getLinkClassIdentifier() { public byte[] getLinkClassIdentifier() {
return linkClassIdentifier; return linkClassIdentifier.clone();
} }
public List<LinkFlags> getLinkFlags() { public List<LinkFlags> getLinkFlags() {
return linkFlags; return Collections.unmodifiableList(linkFlags);
} }
public String getLocalBasePath() { public String getLocalBasePath() {

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2012 Basis Technology Corp. * Copyright 2012-2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -31,6 +31,10 @@ class LnkEnums {
private static final byte[] IEFRAME = new byte[]{(byte) 0x80, 0x53, 0x1c, (byte) 0x87, (byte) 0xa0, private static final byte[] IEFRAME = new byte[]{(byte) 0x80, 0x53, 0x1c, (byte) 0x87, (byte) 0xa0,
0x42, 0x69, 0x10, (byte) 0xa2, (byte) 0xea, 0x08, 0x00, 0x2b, 0x30, 0x30, (byte) 0x9d}; 0x42, 0x69, 0x10, (byte) 0xa2, (byte) 0xea, 0x08, 0x00, 0x2b, 0x30, 0x30, (byte) 0x9d};
private LnkEnums() {
//private constructor for utility class
}
public enum CommonCLSIDS { public enum CommonCLSIDS {
CDrivesFolder(CDRIVES), CDrivesFolder(CDRIVES),
@ -38,20 +42,24 @@ class LnkEnums {
IEFrameDLL(IEFRAME), IEFrameDLL(IEFRAME),
Unknown(new byte[16]); Unknown(new byte[16]);
private byte[] flag; private final byte[] flag;
private CommonCLSIDS(byte[] flag) { private CommonCLSIDS(byte[] flag) {
this.flag = flag; this.flag = flag.clone();
} }
static CommonCLSIDS valueOf(byte[] type) { static CommonCLSIDS valueOf(byte[] type) {
for (CommonCLSIDS value : CommonCLSIDS.values()) { for (CommonCLSIDS value : CommonCLSIDS.values()) {
if (java.util.Arrays.equals(value.flag, type)) { if (java.util.Arrays.equals(value.getFlag(), type)) {
return value; return value;
} }
} }
return Unknown; return Unknown;
} }
byte[] getFlag() {
return flag.clone();
}
} }
public enum LinkFlags { public enum LinkFlags {
@ -84,7 +92,7 @@ class LnkEnums {
PreferEnvironmentPath(0x02000000), PreferEnvironmentPath(0x02000000),
KeepLocalIDListForUNCTarget(0x04000000); KeepLocalIDListForUNCTarget(0x04000000);
private int flag; private final int flag;
private LinkFlags(int flag) { private LinkFlags(int flag) {
this.flag = flag; this.flag = flag;
@ -105,7 +113,7 @@ class LnkEnums {
DRIVE_CDROM(0x00000005), DRIVE_CDROM(0x00000005),
DRIVE_RAMDISK(0x00000006); DRIVE_RAMDISK(0x00000006);
private int flag; private final int flag;
private DriveType(int flag) { private DriveType(int flag) {
this.flag = flag; this.flag = flag;
@ -117,7 +125,7 @@ class LnkEnums {
static DriveType valueOf(int type) { static DriveType valueOf(int type) {
for (DriveType value : DriveType.values()) { for (DriveType value : DriveType.values()) {
if (value.flag == type) { if (value.getFlag() == type) {
return value; return value;
} }
} }
@ -143,7 +151,7 @@ class LnkEnums {
NOT_CONTENT_INDEXED(0x00002000), NOT_CONTENT_INDEXED(0x00002000),
ENCRYPTED(0x00004000); ENCRYPTED(0x00004000);
private int flag; private final int flag;
private FileAttributesFlags(int flag) { private FileAttributesFlags(int flag) {
this.flag = flag; this.flag = flag;
@ -159,7 +167,7 @@ class LnkEnums {
VolumeIDAndLocalBasePath(0x00000001), VolumeIDAndLocalBasePath(0x00000001),
CommonNetworkRelativeLinkAndPathSuffix(0x00000002); CommonNetworkRelativeLinkAndPathSuffix(0x00000002);
private int flag; private final int flag;
private LinkInfoFlags(int flag) { private LinkInfoFlags(int flag) {
this.flag = flag; this.flag = flag;
@ -175,7 +183,7 @@ class LnkEnums {
ValidDevice(0x00000001), ValidDevice(0x00000001),
ValidNetType(0x00000002); ValidNetType(0x00000002);
private int flag; private final int flag;
private CommonNetworkRelativeLinkFlags(int flag) { private CommonNetworkRelativeLinkFlags(int flag) {
this.flag = flag; this.flag = flag;
@ -231,7 +239,7 @@ class LnkEnums {
WNNC_NET_GOOGLE(0x00430000), WNNC_NET_GOOGLE(0x00430000),
WNNC_NET_UNKNOWN(0x00000000); WNNC_NET_UNKNOWN(0x00000000);
private int flag; private final int flag;
private NetworkProviderType(int flag) { private NetworkProviderType(int flag) {
this.flag = flag; this.flag = flag;
@ -239,7 +247,7 @@ class LnkEnums {
static NetworkProviderType valueOf(int type) { static NetworkProviderType valueOf(int type) {
for (NetworkProviderType value : NetworkProviderType.values()) { for (NetworkProviderType value : NetworkProviderType.values()) {
if (value.flag == type) { if (value.getFlag() == type) {
return value; return value;
} }
} }
@ -250,4 +258,5 @@ class LnkEnums {
return flag; return flag;
} }
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,6 +25,7 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.apache.commons.lang3.SerializationUtils;
import org.openide.DialogDescriptor; import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer; import org.openide.DialogDisplayer;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
@ -65,7 +66,7 @@ public final class ModalDialogProgressIndicator implements ProgressIndicator {
this.title = title; this.title = title;
progressPanel = new ProgressPanel(); progressPanel = new ProgressPanel();
progressPanel.setIndeterminate(true); progressPanel.setIndeterminate(true);
this.buttonLabels = buttonLabels; this.buttonLabels = SerializationUtils.clone(buttonLabels);
this.focusedButtonLabel = focusedButtonLabel; this.focusedButtonLabel = focusedButtonLabel;
this.buttonListener = buttonListener; this.buttonListener = buttonListener;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2018-2018 Basis Technology Corp. * Copyright 2018-2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -44,7 +44,7 @@ final class SqliteTextExtractor implements TextExtractor {
private static final Logger logger = Logger.getLogger(SqliteTextExtractor.class.getName()); private static final Logger logger = Logger.getLogger(SqliteTextExtractor.class.getName());
private final AbstractFile file; private final AbstractFile file;
public SqliteTextExtractor(AbstractFile file) { SqliteTextExtractor(AbstractFile file) {
this.file = file; this.file = file;
} }
/** /**
@ -101,7 +101,7 @@ final class SqliteTextExtractor implements TextExtractor {
* *
* @param file Sqlite file * @param file Sqlite file
*/ */
public SQLiteStreamReader(AbstractFile file) { SQLiteStreamReader(AbstractFile file) {
this.file = file; this.file = file;
reader = new SQLiteTableReader.Builder(file) reader = new SQLiteTableReader.Builder(file)
.forAllColumnNames(getColumnNameStrategy()) .forAllColumnNames(getColumnNameStrategy())
@ -140,7 +140,7 @@ final class SqliteTextExtractor implements TextExtractor {
} }
fillBuffer(objectStr); fillBuffer(objectStr);
columnIndex = columnIndex % totalColumns; columnIndex %= totalColumns;
} }
}; };
} }
@ -171,7 +171,7 @@ final class SqliteTextExtractor implements TextExtractor {
fillBuffer(columnName + ((columnIndex == totalColumns) ? "\n" : " ")); fillBuffer(columnName + ((columnIndex == totalColumns) ? "\n" : " "));
//Reset the columnCount to 0 for next table read //Reset the columnCount to 0 for next table read
columnIndex = columnIndex % totalColumns; columnIndex %= totalColumns;
} }
}; };
} }
@ -204,7 +204,7 @@ final class SqliteTextExtractor implements TextExtractor {
*/ */
@Override @Override
public int read(char[] cbuf, int off, int len) throws IOException { public int read(char[] cbuf, int off, int len) throws IOException {
buf = cbuf; buf = cbuf; //needs to be the same memory address and not a copy of the contents since we are filling it in
bufIndex = off; bufIndex = off;
@ -277,12 +277,12 @@ final class SqliteTextExtractor implements TextExtractor {
private final String entity; private final String entity;
private Integer pointer; private Integer pointer;
public ExcessBytes(String entity, Integer pointer) { ExcessBytes(String entity, Integer pointer) {
this.entity = entity; this.entity = entity;
this.pointer = pointer; this.pointer = pointer;
} }
public boolean isFinished() { boolean isFinished() {
return entity.length() == pointer; return entity.length() == pointer;
} }
@ -296,7 +296,7 @@ final class SqliteTextExtractor implements TextExtractor {
* *
* @return number of characters read into the buffer * @return number of characters read into the buffer
*/ */
public int read(char[] buf, int off, int len) { int read(char[] buf, int off, int len) {
for (int i = off; i < len; i++) { for (int i = off; i < len; i++) {
if (isFinished()) { if (isFinished()) {
return i - off; return i - off;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015-2018 Basis Technology Corp. * Copyright 2015-2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -178,6 +178,20 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
this.artifactConditions = new ArrayList<>(); this.artifactConditions = new ArrayList<>();
} }
/**
* Sort the file size conditions of this rule.
*/
void sortFileSizeConditions() {
this.fileSizeConditions.sort(null);
}
/**
* Sort the artifact conditions of this rule.
*/
void sortArtifactConditions() {
this.artifactConditions.sort(null);
}
/** /**
* Gets the name of the rule. * Gets the name of the rule.
* *
@ -336,13 +350,13 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) { if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) {
return false; return false;
} }
this.fileSizeConditions.sort(null); this.sortFileSizeConditions();
that.fileSizeConditions.sort(null); that.sortFileSizeConditions();
if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) { if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) {
return false; return false;
} }
this.artifactConditions.sort(null); this.sortArtifactConditions();
that.artifactConditions.sort(null); that.sortArtifactConditions();
return this.artifactConditions.equals(that.getArtifactConditions()); return this.artifactConditions.equals(that.getArtifactConditions());
} }
@ -376,8 +390,8 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
List<Long> evaluate(long dataSourceId) throws ExportRulesException { List<Long> evaluate(long dataSourceId) throws ExportRulesException {
try { try {
SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase(); SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase();
try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId))) { try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId));
ResultSet resultSet = queryResult.getResultSet(); ResultSet resultSet = queryResult.getResultSet();) {
List<Long> fileIds = new ArrayList<>(); List<Long> fileIds = new ArrayList<>();
while (resultSet.next()) { while (resultSet.next()) {
fileIds.add(resultSet.getLong("obj_id")); fileIds.add(resultSet.getLong("obj_id"));
@ -889,7 +903,7 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
* @return The value, may be null. * @return The value, may be null.
*/ */
byte[] getByteValue() { byte[] getByteValue() {
return this.byteValue; return this.byteValue.clone();
} }
/** /**
@ -908,7 +922,7 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
* @return The value, may be null. * @return The value, may be null.
*/ */
String getStringRepresentationOfValue() { String getStringRepresentationOfValue() {
String valueText = ""; String valueText;
switch (this.attributeValueType) { switch (this.attributeValueType) {
case BYTE: case BYTE:
valueText = new String(Hex.encodeHex(getByteValue())); valueText = new String(Hex.encodeHex(getByteValue()));
@ -1069,20 +1083,20 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
} }
SleuthkitCase caseDb = currentCase.getSleuthkitCase(); SleuthkitCase caseDb = currentCase.getSleuthkitCase();
BlackboardArtifact.Type artifactType; BlackboardArtifact.Type artifactType;
BlackboardAttribute.Type attributeType;
try { try {
artifactType = caseDb.getArtifactType(artifactTypeName); artifactType = caseDb.getArtifactType(artifactTypeName);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
throw new ExportRulesException(String.format("The specified %s artifact type does not exist in case database for %s", artifactTypeName, currentCase.getCaseDirectory()), ex); throw new ExportRulesException(String.format("The specified %s artifact type does not exist in case database for %s", artifactTypeName, currentCase.getCaseDirectory()), ex);
} }
BlackboardAttribute.Type attributeType;
try { try {
attributeType = caseDb.getAttributeType(attributeTypeName); attributeType = caseDb.getAttributeType(attributeTypeName);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
throw new ExportRulesException(String.format("The specified %s attribute type does not exist in case database for %s", attributeTypeName, currentCase.getCaseDirectory()), ex); throw new ExportRulesException(String.format("The specified %s attribute type does not exist in case database for %s", attributeTypeName, currentCase.getCaseDirectory()), ex);
} }
String clause = String.format("files.obj_id = arts%d.obj_id AND arts%d.artifact_type_id = %d AND attrs%d.artifact_id = arts%d.artifact_id AND attrs%d.attribute_type_id = %d AND ", String clause = String.format("files.obj_id = arts%d.obj_id AND arts%d.artifact_type_id = %d AND attrs%d.artifact_id = arts%d.artifact_id AND attrs%d.attribute_type_id = %d AND ",
index, index, artifactType.getTypeID(), index, index, index, attributeType.getTypeID()); index, index, artifactType.getTypeID(), index, index, index, attributeType.getTypeID());
switch (this.attributeValueType) { switch (this.attributeValueType) {
case INTEGER: case INTEGER:
clause += String.format("attrs%d.value_int32 %s %d", index, this.op.getSymbol(), this.intValue); clause += String.format("attrs%d.value_int32 %s %d", index, this.op.getSymbol(), this.intValue);
@ -1100,7 +1114,9 @@ final class FileExportRuleSet implements Serializable, Comparable<FileExportRule
clause += String.format("attrs%d.value_byte %s decode('%s', 'hex')", index, this.op.getSymbol(), new String(Hex.encodeHex(getByteValue()))); clause += String.format("attrs%d.value_byte %s decode('%s', 'hex')", index, this.op.getSymbol(), new String(Hex.encodeHex(getByteValue())));
break; break;
case DATETIME: case DATETIME:
clause += String.format("attrs%d.value_int64 %s '%s'", index, this.op.getSymbol(), this.dateTimeValue.getMillis()/1000); clause += String.format("attrs%d.value_int64 %s '%s'", index, this.op.getSymbol(), this.dateTimeValue.getMillis() / 1000);
break;
default:
break; break;
} }
return clause; return clause;

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 {
@ -414,7 +416,8 @@ final class BinaryCookieReader implements Iterable<Cookie> {
* offset ending at the first null terminator found. * offset ending at the first null terminator found.
* *
* @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) {