camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: CAMEL-7023: Polished code with thanks to Babak for suggestions.
Date Mon, 02 Dec 2013 08:00:24 GMT
CAMEL-7023: Polished code with thanks to Babak for suggestions.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e94ebcc7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e94ebcc7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e94ebcc7

Branch: refs/heads/camel-2.12.x
Commit: e94ebcc7c3f5fa3cc448656c3ce7dd9162aae7e6
Parents: 5c85b0d
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Dec 2 09:01:57 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Dec 2 09:02:25 2013 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/maven/HawtioMojo.java  | 10 +++-------
 .../src/main/java/org/apache/camel/maven/RunMojo.java     | 10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e94ebcc7/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java
b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java
index b7b6159..57e509e 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/HawtioMojo.java
@@ -45,14 +45,10 @@ public class HawtioMojo extends RunMojo {
     @Override
     protected void beforeBootstrapCamel() throws Exception {
         getLog().info("Starting hawtio ...");
-        Method hawtioMain = Thread.currentThread().getContextClassLoader().loadClass("io.hawt.app.App")
-                .getMethod("main", new Class[] {String[].class});
-        if (!hawtioMain.isAccessible()) {
-            getLog().debug("Setting accessibility to true in order to invoke main().");
-            hawtioMain.setAccessible(true);
-        }
+        Method hawtioMain = Thread.currentThread().getContextClassLoader()
+                .loadClass("io.hawt.app.App").getMethod("main", String[].class);
         String[] args = new String[]{"--port", "" + port, "--join", "false"};
-        hawtioMain.invoke(hawtioMain, new Object[]{args});
+        hawtioMain.invoke(null, new Object[]{args});
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/e94ebcc7/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
index 26f540b..032459d 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
@@ -481,13 +481,9 @@ public class RunMojo extends AbstractExecMojo {
                     beforeBootstrapCamel();
 
                     getLog().info("Starting Camel ...");
-                    Method main = Thread.currentThread().getContextClassLoader().loadClass(mainClass)
-                        .getMethod("main", new Class[] {String[].class});
-                    if (!main.isAccessible()) {
-                        getLog().debug("Setting accessibility to true in order to invoke
main().");
-                        main.setAccessible(true);
-                    }
-                    main.invoke(main, new Object[] {arguments});
+                    Method main = Thread.currentThread().getContextClassLoader()
+                            .loadClass(mainClass).getMethod("main", String[].class);
+                    main.invoke(null, new Object[]{arguments});
 
                     afterBootstrapCamel();
                 } catch (Exception e) { // just pass it on


Mime
View raw message