Improved handling when errors are caught before the logger is initialized.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 10 Sep 2002 16:23:09 +0000 (16:23 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 10 Sep 2002 16:23:09 +0000 (16:23 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@288 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/utils/ExtKeyTool.java

index 89f6ba4..61cfc0f 100755 (executable)
@@ -611,9 +611,16 @@ public class ExtKeyTool {
        public static void main(String[] args) {
 
                try {
-                       Properties arguments = parseArguments(args);
-
                        ExtKeyTool tool = new ExtKeyTool();
+                       Properties arguments = null;
+                       try {
+                               arguments = parseArguments(args);
+                       } catch (IllegalArgumentException iae) {
+                               System.err.println(
+                                       "Illegal argument specified: " + iae.getMessage() + System.getProperty("line.separator"));
+                               printUsage(System.err);
+                               System.exit(1);
+                       }
                        tool.startLogger(arguments);
                        String providerName = tool.initProvider(arguments);
                        if (providerName != null) {
@@ -621,11 +628,6 @@ public class ExtKeyTool {
                        }
                        tool.run(arguments);
 
-               } catch (IllegalArgumentException iae) {
-                       log.fatal(
-                               "Illegal argument specified: " + iae.getMessage() + System.getProperty("line.separator"));
-                       LogManager.shutdown();
-                       printUsage(System.err);
                } catch (ExtKeyToolException ske) {
                        log.fatal("Cannot Perform Operation: " + ske.getMessage() + System.getProperty("line.separator"));
                        LogManager.shutdown();
@@ -808,7 +810,8 @@ public class ExtKeyTool {
                out.print("\t     [-keypass <keypass>] ");
                out.println("[-provider <provider_class_name>] ");
                out.print("\t     [-file <output_file>] ");
-               out.println();out.println();
+               out.println();
+               out.println();
 
                out.print("-importkey      [-v] [-alias <alias>] ");
                out.println("[-keyfile <key_file>]");