From 4d9594e65abe0a2d33f21e66d2875ec4a0999802 Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Mon, 19 Mar 2018 13:37:50 -0400 Subject: [PATCH] clean up codacy --- .../directorytree/ExternalViewerAction.java | 16 +++++++++++++--- ruleset.xml | 15 ++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java index 60ef8f0750..96c24d7532 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/ExternalViewerAction.java @@ -42,10 +42,15 @@ import org.sleuthkit.autopsy.datamodel.SlackFileNode; public class ExternalViewerAction extends AbstractAction { private final static Logger logger = Logger.getLogger(ExternalViewerAction.class.getName()); - private org.sleuthkit.datamodel.AbstractFile fileObject; + private final org.sleuthkit.datamodel.AbstractFile fileObject; private String fileObjectExt; final static String[] EXECUTABLE_EXT = {".exe", ".dll", ".com", ".bat", ".msi", ".reg", ".scr", ".cmd"}; //NON-NLS + /** + * + * @param title Name of the action + * @param fileNode File to display + */ public ExternalViewerAction(String title, Node fileNode) { super(title); this.fileObject = fileNode.getLookup().lookup(org.sleuthkit.datamodel.AbstractFile.class); @@ -127,9 +132,9 @@ public class ExternalViewerAction extends AbstractAction { } if (!exePath.equals("")) { Runtime runtime = Runtime.getRuntime(); - String[] s = new String[]{exePath, file.getAbsolutePath()}; + String[] execArray = new String[]{exePath, file.getAbsolutePath()}; try { - runtime.exec(s); + runtime.exec(execArray); } catch (IOException ex) { logger.log(Level.WARNING, "Could not open the specified viewer for the given file: " + file.getName(), ex); //NON-NLS JOptionPane.showMessageDialog(null, Bundle.ExternalViewerAction_actionPerformed_failure_IO_message(), Bundle.ExternalViewerAction_actionPerformed_failure_title(), JOptionPane.ERROR_MESSAGE); @@ -165,6 +170,11 @@ public class ExternalViewerAction extends AbstractAction { } } + /** + * Opens a URL using the default desktop browser + * + * @param path URL to open + */ public static void openURL(String path) { String url_path = path.replaceAll("\\\\","/"); try { diff --git a/ruleset.xml b/ruleset.xml index b97681d624..e48144160e 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -106,7 +106,8 @@ - + @@ -118,7 +119,8 @@ - + @@ -155,7 +157,8 @@ - + @@ -227,7 +230,8 @@ --> - + @@ -272,7 +276,8 @@ - +