diff --git a/java/src/org/broadinstitute/sting/gatk/CommandLineExecutable.java b/java/src/org/broadinstitute/sting/gatk/CommandLineExecutable.java index d7fac7217..f7225a9bf 100644 --- a/java/src/org/broadinstitute/sting/gatk/CommandLineExecutable.java +++ b/java/src/org/broadinstitute/sting/gatk/CommandLineExecutable.java @@ -77,18 +77,8 @@ public abstract class CommandLineExecutable extends CommandLineProgram { // set the analysis name in the argument collection this.argCollection.analysisName = this.analysisName; - try { - GATKEngine.execute(argCollection, mWalker); - } - catch (ArgumentException ex) { - // Rethrow argument exceptions. Let the command-line argument do what it's designed to do. - throw ex; - } - catch (StingException exp) { - System.err.println("Caught StingException. It's message is " + exp.getMessage()); - exp.printStackTrace(); - return -1; - } + GATKEngine.execute(argCollection, mWalker); + return 0; } diff --git a/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java b/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java index d5efd6a72..fae633467 100755 --- a/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java +++ b/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java @@ -76,21 +76,25 @@ public class CommandLineGATK extends CommandLineProgram { processArguments(argCollection); this.argCollection.analysisName = this.analysisName; - try { - GATKEngine.execute(argCollection, mWalker); - } - catch (ArgumentException ex) { - // Rethrow argument exceptions. Let the command-line argument do what it's designed to do. - throw ex; - } - catch (StingException exp) { - System.err.println("Caught StingException. It's message is " + exp.getMessage()); - exp.printStackTrace(); - return -1; - } + GATKEngine.execute(argCollection, mWalker); return 0; } + /** + * Get pleasing info about the GATK. + * @return + */ + @Override + protected List getApplicationHeader() { + List header = new ArrayList(); + header.add("The Genome Analysis Toolkit (GATK)"); + header.add("Copyright (c) 2009 The Broad Institute"); + header.add("Please view our documentation at http://www.broadinstitute.org/gsa/wiki"); + header.add("For support, email gsadevelopers@broadinstitute.org"); + header.add(""); + return header; + } + /** * GATK can add arguments dynamically based on analysis type. * @@ -144,7 +148,6 @@ public class CommandLineGATK extends CommandLineProgram { }; } - /** * Preprocess the arguments before submitting them to the GATK engine. * @param argCollection Collection of arguments to preprocess. diff --git a/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java b/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java index 34f16ed05..7a1eaf448 100644 --- a/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java +++ b/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java @@ -9,6 +9,8 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.EnumSet; import java.util.Enumeration; +import java.util.Collections; +import java.util.List; /** * User: aaron @@ -113,6 +115,14 @@ public abstract class CommandLineProgram { return runningInstructions; } + /** + * Allows a given application to return a few lines of text describing the application. + * @return A few lines of text describing the application. Should not be null. + */ + protected List getApplicationHeader() { + return Collections.singletonList("Program Name: " + getClass().getName()); + } + /** * Will this application want to vary its argument list dynamically? * If so, parse the command-line options and then prompt the subclass to return @@ -303,8 +313,8 @@ public abstract class CommandLineProgram { java.util.Date date = new java.util.Date(); logger.info("-------------------------------------------------------"); - logger.info("Program Name: " + clp.getClass().getName()); - + for( String headerLine: clp.getApplicationHeader() ) + logger.info(headerLine); String output = ""; for (String str : args) { output = output + str + " "; @@ -354,11 +364,8 @@ public abstract class CommandLineProgram { */ private static void printExitSystemMsg(final String msg) { System.out.printf("------------------------------------------------------------------------------------------%n"); - System.out.printf("An error has occurred%n"); - System.out.printf("Check your command line arguments for any typos or inconsistencies.%n"); - System.out.printf("If you think it's because of a bug or a feature in GATK that should work, please report this to gsadevelopers@broad.mit.edu%n"); - System.out.printf("%n"); - System.out.printf("%s%n", msg); + System.out.printf("An error has occurred. Please check your command line arguments for any typos or inconsistencies.%n%n"); + System.out.printf("For assistance, please email us at gsadevelopers@broad.mit.edu, or review our documentation at http://www.broadinstitute.org/gsa/wiki.%n"); } /**