From 72fb6b7df1ee25d9e96586fce5d3936527e7fea4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 3 Apr 2018 20:35:13 +0200 Subject: [PATCH] exo3: trap the empty class name case properly. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- exo3/Main.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exo3/Main.java b/exo3/Main.java index f15a4ec..4909568 100644 --- a/exo3/Main.java +++ b/exo3/Main.java @@ -41,7 +41,12 @@ class Main { * @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 "); + System.exit(-1); + } String className = args[0]; + Class cl = null; try { cl = Class.forName(className); -- 2.34.1