codacy fixes

This commit is contained in:
millmanorama 2018-08-30 14:02:09 +02:00
parent 15b36b2349
commit b838c17c11
12 changed files with 15 additions and 33 deletions

View File

@ -230,6 +230,7 @@
<package>org.apache.commons.codec.digest</package> <package>org.apache.commons.codec.digest</package>
<package>org.apache.commons.codec.language</package> <package>org.apache.commons.codec.language</package>
<package>org.apache.commons.codec.net</package> <package>org.apache.commons.codec.net</package>
<package>org.apache.commons.collections4</package>
<package>org.apache.commons.csv</package> <package>org.apache.commons.csv</package>
<package>org.apache.commons.io</package> <package>org.apache.commons.io</package>
<package>org.apache.commons.io.comparator</package> <package>org.apache.commons.io.comparator</package>

View File

@ -161,7 +161,7 @@ public final class ImageGalleryController {
return thumbnailSize.getReadOnlyProperty(); return thumbnailSize.getReadOnlyProperty();
} }
private GroupViewState getViewState() { public GroupViewState getViewState() {
return historyManager.getCurrentState(); return historyManager.getCurrentState();
} }
@ -956,8 +956,6 @@ public final class ImageGalleryController {
@NbBundle.Messages({"PrePopulateDataSourceFiles.committingDb.status=committing image/video database"}) @NbBundle.Messages({"PrePopulateDataSourceFiles.committingDb.status=committing image/video database"})
static private class PrePopulateDataSourceFiles extends BulkTransferTask { static private class PrePopulateDataSourceFiles extends BulkTransferTask {
private static final Logger LOGGER = Logger.getLogger(PrePopulateDataSourceFiles.class.getName());
/** /**
* *
* @param dataSourceId Data source object ID * @param dataSourceId Data source object ID

View File

@ -52,7 +52,7 @@ public class CategorizeGroupAction extends CategorizeAction {
public CategorizeGroupAction(DhsImageCategory newCat, ImageGalleryController controller) { public CategorizeGroupAction(DhsImageCategory newCat, ImageGalleryController controller) {
super(controller, newCat, null); super(controller, newCat, null);
setEventHandler(actionEvent -> { setEventHandler(actionEvent -> {
ObservableList<Long> fileIDs = controller.viewState().get().getGroup().getFileIDs(); ObservableList<Long> fileIDs = controller.getViewState().getGroup().getFileIDs();
if (ImageGalleryPreferences.isGroupCategorizationWarningDisabled()) { if (ImageGalleryPreferences.isGroupCategorizationWarningDisabled()) {
//if they have preveiously disabled the warning, just go ahead and apply categories. //if they have preveiously disabled the warning, just go ahead and apply categories.

View File

@ -64,8 +64,7 @@ public class NextUnseenGroup extends Action {
setEventHandler(event -> { //on fx-thread setEventHandler(event -> { //on fx-thread
//if there is a group assigned to the view, mark it as seen //if there is a group assigned to the view, mark it as seen
Optional.ofNullable(controller.viewState()) Optional.ofNullable(controller.getViewState())
.map(ObservableValue<GroupViewState>::getValue)
.map(GroupViewState::getGroup) .map(GroupViewState::getGroup)
.ifPresent(group -> { .ifPresent(group -> {
groupManager.setGroupSeen(group, true) groupManager.setGroupSeen(group, true)

View File

@ -21,16 +21,11 @@ package org.sleuthkit.autopsy.imagegallery.actions;
import java.awt.Component; import java.awt.Component;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level; import java.util.logging.Level;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.image.Image;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
@ -49,7 +44,6 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.core.Installer;
import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule; import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryTopComponent; import org.sleuthkit.autopsy.imagegallery.ImageGalleryTopComponent;

View File

@ -30,7 +30,7 @@ public class TagGroupAction extends AddTagAction {
public TagGroupAction(final TagName tagName, ImageGalleryController controller) { public TagGroupAction(final TagName tagName, ImageGalleryController controller) {
super(controller, tagName, null); super(controller, tagName, null);
setEventHandler(actionEvent -> setEventHandler(actionEvent ->
new AddTagAction(controller, tagName, ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs())). new AddTagAction(controller, tagName, ImmutableSet.copyOf(controller.getViewState().getGroup().getFileIDs())).
handle(actionEvent) handle(actionEvent)
); );
} }

View File

@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.imagegallery.datamodel;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -51,6 +50,7 @@ import javax.swing.SortOrder;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.autopsy.imagegallery.FileTypeUtils; import org.sleuthkit.autopsy.imagegallery.FileTypeUtils;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule; import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
@ -61,11 +61,11 @@ import static org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy.
import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.CaseDbAccessManager.CaseDbAccessQueryCallback;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.CaseDbAccessManager.CaseDbAccessQueryCallback;
import org.sleuthkit.datamodel.DataSource; import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction;
import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
@ -83,7 +83,7 @@ import org.sqlite.SQLiteJDBCLoader;
*/ */
public final class DrawableDB { public final class DrawableDB {
private static final org.sleuthkit.autopsy.coreutils.Logger logger = Logger.getLogger(DrawableDB.class.getName()); private static final Logger logger = Logger.getLogger(DrawableDB.class.getName());
//column name constants////////////////////// //column name constants//////////////////////
private static final String ANALYZED = "analyzed"; //NON-NLS private static final String ANALYZED = "analyzed"; //NON-NLS

View File

@ -98,10 +98,7 @@ public class GroupKey<T extends Comparable<T>> implements Comparable<GroupKey<T>
if (!Objects.equals(this.attr, other.attr)) { if (!Objects.equals(this.attr, other.attr)) {
return false; return false;
} }
if (!Objects.equals(this.dataSource, other.dataSource)) { return Objects.equals(this.dataSource, other.dataSource);
return false;
}
return true;
} }
@Override @Override

View File

@ -21,14 +21,12 @@ package org.sleuthkit.autopsy.imagegallery.datamodel.grouping;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -42,9 +40,6 @@ import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -67,6 +62,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.GuardedBy;
import javax.swing.SortOrder; import javax.swing.SortOrder;
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.commons.lang3.concurrent.BasicThreadFactory;
@ -508,7 +504,7 @@ public class GroupManager {
//only re-query the db if the data source or group by attribute changed or it is forced //only re-query the db if the data source or group by attribute changed or it is forced
if (dataSource != getDataSource() if (dataSource != getDataSource()
|| groupBy != getGroupBy() || groupBy != getGroupBy()
|| force == true) { || force) {
setDataSource(dataSource); setDataSource(dataSource);
setGroupBy(groupBy); setGroupBy(groupBy);
@ -784,7 +780,7 @@ public class GroupManager {
groupProgress.finish(); groupProgress.finish();
groupProgress = null; groupProgress = null;
} }
if (unSeenGroups.isEmpty() == false) { if (isNotEmpty(unSeenGroups)) {
controller.advance(GroupViewState.tile(unSeenGroups.get(0)), true); controller.advance(GroupViewState.tile(unSeenGroups.get(0)), true);
} }
} }

View File

@ -31,7 +31,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.InvalidationListener; import javafx.beans.InvalidationListener;
@ -59,7 +58,6 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane; import javafx.scene.layout.Pane;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.util.Duration;
import javafx.util.StringConverter; import javafx.util.StringConverter;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import org.controlsfx.control.Notifications; import org.controlsfx.control.Notifications;

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2016 Basis Technology Corp. * Copyright 2016-18 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");
@ -22,7 +22,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import javafx.application.Platform;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.BooleanBinding;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;

View File

@ -95,7 +95,7 @@ abstract class NavPanel<X> extends Tab {
//keep selection in sync with controller //keep selection in sync with controller
controller.viewState().addListener(observable -> { controller.viewState().addListener(observable -> {
Platform.runLater(() -> { Platform.runLater(() -> {
Optional.ofNullable(controller.viewState().get()) Optional.ofNullable(controller.getViewState())
.map(GroupViewState::getGroup) .map(GroupViewState::getGroup)
.ifPresent(this::setFocusedGroup); .ifPresent(this::setFocusedGroup);
}); });