camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] git commit: CAMEL-7023: Polished code with thanks to Babak for suggestions.
Date Mon, 02 Dec 2013 08:00:23 GMT
Updated Branches:
  refs/heads/camel-2.12.x 5c85b0dcb -> e94ebcc7c
  refs/heads/master 42b463c42 -> b048537a5


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/b048537a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b048537a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b048537a

Branch: refs/heads/master
Commit: b048537a518c5ff8f5373813bb76b7813e5784a5
Parents: 42b463c
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:01:57 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/b048537a/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/b048537a/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 edf46fc..0474059 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