From b144e56e562e902afa5f35604fa52574aeebb2b4 Mon Sep 17 00:00:00 2001 From: meltsufin Date: Fri, 8 Jul 2016 12:48:59 -0400 Subject: [PATCH] Enable FindBugs plugin and fix violations (#80) --- appengine-plugins-core/findbugs-exclude.xml | 23 +++++++++++++++++++ appengine-plugins-core/pom.xml | 17 ++++++++++++++ .../cloudsdk/CloudSdkAppEngineDeployment.java | 2 +- .../cloudsdk/CloudSdkAppEngineGenConfig.java | 4 ++-- .../process/DefaultProcessRunner.java | 6 +++-- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 appengine-plugins-core/findbugs-exclude.xml diff --git a/appengine-plugins-core/findbugs-exclude.xml b/appengine-plugins-core/findbugs-exclude.xml new file mode 100644 index 000000000..2deeb557b --- /dev/null +++ b/appengine-plugins-core/findbugs-exclude.xml @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/appengine-plugins-core/pom.xml b/appengine-plugins-core/pom.xml index 631fe0915..4676b8172 100644 --- a/appengine-plugins-core/pom.xml +++ b/appengine-plugins-core/pom.xml @@ -148,6 +148,23 @@ + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.3 + + findbugs-exclude.xml + + + + verify + + check + + + + + org.apache.felix maven-bundle-plugin diff --git a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineDeployment.java b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineDeployment.java index d6f423c8c..e402ab90a 100644 --- a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineDeployment.java +++ b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineDeployment.java @@ -51,7 +51,7 @@ public void deploy(DeployConfiguration config) throws AppEngineException { for (File deployable : config.getDeployables()) { if (!deployable.exists()) { throw new IllegalArgumentException( - "Deployable " + deployable.toPath().toString() + " does not exist."); + "Deployable " + deployable.toPath() + " does not exist."); } arguments.add(deployable.toPath().toString()); } diff --git a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineGenConfig.java b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineGenConfig.java index 94932c78d..bef1c2e58 100644 --- a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineGenConfig.java +++ b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkAppEngineGenConfig.java @@ -48,11 +48,11 @@ public void genConfig(GenConfigParams config) throws AppEngineException { if (!config.getSourceDirectory().exists()) { throw new AppEngineException("Source directory does not exist. Location: " - + config.getSourceDirectory().toPath().toString()); + + config.getSourceDirectory().toPath()); } if (!config.getSourceDirectory().isDirectory()) { throw new AppEngineException("Source location is not a directory. Location: " - + config.getSourceDirectory().toPath().toString()); + + config.getSourceDirectory().toPath()); } List arguments = new ArrayList<>(); diff --git a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/internal/process/DefaultProcessRunner.java b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/internal/process/DefaultProcessRunner.java index 8fc27f29e..51d5124ee 100644 --- a/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/internal/process/DefaultProcessRunner.java +++ b/appengine-plugins-core/src/main/java/com/google/cloud/tools/appengine/cloudsdk/internal/process/DefaultProcessRunner.java @@ -20,6 +20,8 @@ import com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener; import com.google.cloud.tools.appengine.cloudsdk.process.ProcessStartListener; +import com.google.common.base.Charsets; + import java.io.IOException; import java.util.List; import java.util.Map; @@ -112,7 +114,7 @@ public void setEnvironment(Map environment) { } private void handleStdOut(final Process process) { - final Scanner stdOut = new Scanner(process.getInputStream()); + final Scanner stdOut = new Scanner(process.getInputStream(), Charsets.UTF_8.name()); Thread stdOutThread = new Thread("standard-out") { public void run() { while (stdOut.hasNextLine() && !Thread.interrupted()) { @@ -128,7 +130,7 @@ public void run() { } private void handleErrOut(final Process process) { - final Scanner stdErr = new Scanner(process.getErrorStream()); + final Scanner stdErr = new Scanner(process.getErrorStream(), Charsets.UTF_8.name()); Thread stdErrThread = new Thread("standard-err") { public void run() { while (stdErr.hasNextLine() && !Thread.interrupted()) {