From 8efcb6a3b48a595a9847df0ea37488c6a5aafcb7 Mon Sep 17 00:00:00 2001 From: aaron Date: Mon, 23 Mar 2009 19:03:59 +0000 Subject: [PATCH] We now just warn about extra parameters, and provide more information if we fail to convert a command line parameter to the specified type from a string. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@153 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/cmdLine/ArgumentParser.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/java/src/org/broadinstitute/sting/utils/cmdLine/ArgumentParser.java b/core/java/src/org/broadinstitute/sting/utils/cmdLine/ArgumentParser.java index d33de32e0..a1c411691 100644 --- a/core/java/src/org/broadinstitute/sting/utils/cmdLine/ArgumentParser.java +++ b/core/java/src/org/broadinstitute/sting/utils/cmdLine/ArgumentParser.java @@ -268,9 +268,13 @@ public class ArgumentParser { } } } + }catch (UnrecognizedOptionException e) { + // we don't care about unknown exceptions right now + logger.warn(e.getMessage()); } catch (ParseException e) { // we didn't get all the required arguments, // print out the help + e.printStackTrace(); this.printHelp(); System.exit(1); } @@ -299,17 +303,17 @@ public class ArgumentParser { ctor = f.getType().getConstructor(String.class); return ctor.newInstance(str); } catch (NoSuchMethodException e) { - logger.fatal("constructFromString: cannot convert field " + f.toString()); - throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage()); + logger.fatal("constructFromString:NoSuchMethodException: cannot convert field " + f.toString()); + throw new RuntimeException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage()); } catch (IllegalAccessException e) { - logger.fatal("constructFromString: cannot convert field " + f.toString()); - throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage()); + logger.fatal("constructFromString:IllegalAccessException: cannot convert field " + f.toString()); + throw new RuntimeException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage()); } catch (InvocationTargetException e) { - logger.fatal("constructFromString: cannot convert field " + f.toString()); - throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage()); + logger.fatal("constructFromString:InvocationTargetException: cannot convert field " + f.toString()); + throw new RuntimeException("constructFromString:InvocationTargetException: Failed conversion " + e.getMessage()); } catch (InstantiationException e) { - logger.fatal("constructFromString: cannot convert field " + f.toString()); - throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage()); + logger.fatal("constructFromString:InstantiationException: cannot convert field " + f.toString()); + throw new RuntimeException("constructFromString:InstantiationException: Failed conversion " + e.getMessage()); } }