Merge branch 'develop' of https://github.com/sleuthkit/autopsy into substring_search_2384

This commit is contained in:
Eugene Livis 2017-03-16 13:42:04 -04:00
commit 32ef2bc03f
2 changed files with 23 additions and 35 deletions

View File

@ -346,14 +346,12 @@ final class LocalDiskPanel extends JPanel {
String path = disk.getName();
// Remove all non-ASCII characters
path = path.replaceAll("[^\\p{ASCII}]", ""); //NON-NLS
// Remove all control characters
path = path.replaceAll("[\\p{Cntrl}]", ""); //NON-NLS
// Remove / \ : ? ' "
path = path.replaceAll("[/?:'\"\\\\]", ""); //NON-NLS
// Remove any character that isn't alphanumeric, a space, parent, or underscore.
// If the name ends up empty or starting with a space, prepend "localDisk"
path = path.replaceAll("[^0-9A-Za-z _()]", ""); // NON-NLS
if(path.isEmpty() || path.startsWith(" ")){
path = "localDisk" + path;
}
path += " " + System.currentTimeMillis();
path += ".vhd";

View File

@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.directorytree;
import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.prefs.PreferenceChangeEvent;
@ -30,7 +29,6 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
@ -111,7 +109,7 @@ public class DataResultFilterNode extends FilterNode {
* @param em ExplorerManager for component that is creating the node
*/
public DataResultFilterNode(Node node, ExplorerManager em) {
super(node, Children.create(new DataResultFilterChildren(node, em), true));
super(node, new DataResultFilterChildren(node, em));
this.sourceEm = em;
}
@ -121,8 +119,8 @@ public class DataResultFilterNode extends FilterNode {
* @param node Root node to be passed to DataResult viewers
* @param em ExplorerManager for component that is creating the node
*/
private DataResultFilterNode(Node node, ExplorerManager em, boolean filterKnown, boolean filterSlack) {
super(node, Children.create(new DataResultFilterChildren(node, em, filterKnown, filterSlack), true));
private DataResultFilterNode(Node node, ExplorerManager em, boolean filterKnown, boolean filterSlack) {
super(node, new DataResultFilterChildren(node, em, filterKnown, filterSlack));
this.sourceEm = em;
}
@ -196,20 +194,18 @@ public class DataResultFilterNode extends FilterNode {
* DataResultFilterNode that created in the DataResultFilterNode.java.
*
*/
private static class DataResultFilterChildren extends ChildFactory<Node> {
private static class DataResultFilterChildren extends FilterNode.Children {
private final ExplorerManager sourceEm;
private final ExplorerManager sourceEm;
private boolean filterKnown;
private boolean filterSlack;
private final Node parent;
/**
* the constructor
*/
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm) {
super();
this.parent = arg;
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm) {
super(arg);
switch (SelectionContext.getSelectionContext(arg)) {
case DATA_SOURCES:
filterSlack = filterSlackFromDataSources;
@ -227,33 +223,24 @@ public class DataResultFilterNode extends FilterNode {
this.sourceEm = sourceEm;
}
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm, boolean filterKnown, boolean filterSlack) {
super();
this.parent = arg;
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm, boolean filterKnown, boolean filterSlack) {
super(arg);
this.filterKnown = filterKnown;
this.filterSlack = filterSlack;
this.sourceEm = sourceEm;
}
@Override
protected boolean createKeys(List<Node> list) {
list.addAll(Arrays.asList(parent.getChildren().getNodes()));
return true;
}
@Override
protected Node[] createNodesForKey(Node key) {
protected Node[] createNodes(Node key) {
AbstractFile file = key.getLookup().lookup(AbstractFile.class);
if (file != null) {
if (filterKnown && (file.getKnown() == TskData.FileKnown.KNOWN)) {
// Filter out child nodes that represent known files
return null;
return new Node[]{};
}
if (filterSlack && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
// Filter out child nodes that represent slack files
return null;
return new Node[]{};
}
}
return new Node[]{new DataResultFilterNode(key, sourceEm, filterKnown, filterSlack)};
@ -351,7 +338,8 @@ public class DataResultFilterNode extends FilterNode {
public List<Action> visit(FileTypesNode fileTypes) {
return defaultVisit(fileTypes);
}
@Override
protected List<Action> defaultVisit(DisplayableItemNode ditem) {
//preserve the default node's actions
@ -443,12 +431,14 @@ public class DataResultFilterNode extends FilterNode {
protected AbstractAction defaultVisit(DisplayableItemNode c) {
return openChild(c);
}
@Override
public AbstractAction visit(FileTypesNode fileTypes) {
return openChild(fileTypes);
}
/**
* Tell the originating ExplorerManager to display the given
* dataModelNode.