You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/12/10 17:49:39 UTC

[GitHub] [hadoop] goiri commented on a change in pull request #1751: MAPREDUCE-7251: Present friendlier error for non-static main

goiri commented on a change in pull request #1751: MAPREDUCE-7251: Present friendlier error for non-static main
URL: https://github.com/apache/hadoop/pull/1751#discussion_r356185943
 
 

 ##########
 File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/RunJar.java
 ##########
 @@ -315,6 +316,11 @@ public void run() {
     Thread.currentThread().setContextClassLoader(loader);
     Class<?> mainClass = Class.forName(mainClassName, true, loader);
     Method main = mainClass.getMethod("main", String[].class);
+    
+    if (!Modifier.isStatic(main.getModifiers())) {
+      throw new IOException("Method main must be static: " + mainClassName);
 
 Review comment:
   Can we add a unit test to make sure we trigger this instead of NPE?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org