CAMEL-7037: Fixed the NPE when using the embedded or the run goal of guice-maven-plugin.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae1a9563 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae1a9563 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae1a9563 Branch: refs/heads/camel-gora Commit: ae1a956360cc863f8fc6d1b815c455163c2ed970 Parents: f5dafb1 Author: Babak Vahdat <bvah...@apache.org> Authored: Wed Dec 4 12:34:56 2013 +0100 Committer: Babak Vahdat <bvah...@apache.org> Committed: Wed Dec 4 12:34:56 2013 +0100 ---------------------------------------------------------------------- .../java/org/apache/camel/guice/maven/EmbeddedMojo.java | 4 ++-- .../main/java/org/apache/camel/guice/maven/RunMojo.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ae1a9563/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java index 36d743e..ced1a95 100644 --- a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java +++ b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java @@ -45,8 +45,8 @@ public class EmbeddedMojo extends AbstractExecMojo { * A value <= 0 will run forever. * Adding a s indicates seconds - eg "5s" means 5 seconds. * - * @parameter property="-1" - * @readonly + * @parameter property="camel.duration" + * default-value="-1" */ protected String duration; http://git-wip-us.apache.org/repos/asf/camel/blob/ae1a9563/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java index 82e60b7..2b3d83c 100644 --- a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java +++ b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java @@ -85,8 +85,8 @@ public class RunMojo extends AbstractExecMojo { * milliseconds. A value <= 0 will run forever. * Adding a s indicates seconds - eg "5s" means 5 seconds. * - * @parameter property="-1" - * + * @parameter property="camel.duration" + * default-value="-1" */ protected String duration; @@ -370,6 +370,11 @@ public class RunMojo extends AbstractExecMojo { .getMethod("main", String[].class); main.invoke(null, new Object[] {arguments}); } catch (Exception e) { // just pass it on + // let it be printed so end users can see the exception on the console + getLog().error("*************************************"); + getLog().error("Error occurred while running main from: " + mainClass); + getLog().error(e); + getLog().error("*************************************"); Thread.currentThread().getThreadGroup().uncaughtException(Thread.currentThread(), e); } } @@ -395,7 +400,7 @@ public class RunMojo extends AbstractExecMojo { try { threadGroup.destroy(); } catch (IllegalThreadStateException e) { - getLog().warn("Couldn't destroy threadgroup " + threadGroup, e); + getLog().warn("Couldn't destroy thread group " + threadGroup, e); } }