exo3: trap the empty class name case properly.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 3 Apr 2018 18:35:13 +0000 (20:35 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 3 Apr 2018 18:35:13 +0000 (20:35 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
exo3/Main.java

index f15a4ec26d6e428ff3022eb4b74b7cf9ff3b33f5..4909568f8527f54341b7ea5963925373310971b3 100644 (file)
@@ -41,7 +41,12 @@ class Main {
      * @param String[] args main() function arguments array
      */
     public static void main(String[] args) {
      * @param String[] args main() function arguments array
      */
     public static void main(String[] args) {
+        if (args.length == 0) {
+            System.out.println("Please run with java Main <Class Name to inspect>");
+            System.exit(-1);
+        }
         String className = args[0];
         String className = args[0];
+
         Class cl = null;
         try {
             cl = Class.forName(className);
         Class cl = null;
         try {
             cl = Class.forName(className);