diff --git a/build.gradle b/build.gradle index 58e98210..541a4526 100644 --- a/build.gradle +++ b/build.gradle @@ -4,16 +4,33 @@ import org.gradle.api.tasks.Copy plugins { // Apply the application plugin to add support for building a CLI application in Java. id 'application' + id 'com.github.spotbugs' version '6.0.4' apply false } // Global checkstyle file ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml") +subprojects { + apply plugin: "com.github.spotbugs" + + spotbugs { + excludeFilter = file('config/spotbugs/spotbugs-exclude.xml') + } + + tasks.withType(com.github.spotsbugs.snom.SpotBugsTask) { + reports { + html { + enabled = true + } + } + } +} + dependencies { repositories { - // Use Maven Central for resolving dependencies. - mavenCentral() - } + // Use Maven Central for resolving dependencies. + mavenCentral() + } } def projectVersion = rootProject.file('VERSION').text.trim() diff --git a/tools/tcg_eventlog_tool/src/main/java/hirs/tcg_eventlog/Commander.java b/tools/tcg_eventlog_tool/src/main/java/hirs/tcg_eventlog/Commander.java index fec243e1..2172a256 100644 --- a/tools/tcg_eventlog_tool/src/main/java/hirs/tcg_eventlog/Commander.java +++ b/tools/tcg_eventlog_tool/src/main/java/hirs/tcg_eventlog/Commander.java @@ -59,10 +59,10 @@ public class Commander { if (hasArguments) { parseArguments(args); } else { - String[] defualtArgs = new String[1]; - defualtArgs[0] = "-e"; + String[] defaultArgs = new String[1]; + defaultArgs[0] = "-e"; hasArguments = true; - parseArguments(defualtArgs); + parseArguments(defaultArgs); } } @@ -445,14 +445,17 @@ public class Commander { * @return true if path is valid */ public static boolean isValidPath(final String filepath) { + System.out.println("Checking for a valid creation path..."); + if (filepath != null) { + return false; + } try { - System.out.println("Checking for a valid creation path..."); File file = new File(filepath); boolean test = file.createNewFile(); if (!test) { return false; } - } catch (IOException | InvalidPathException | NullPointerException ex) { + } catch (IOException | InvalidPathException ex) { return false; } return true;