From fa3be2209fdb004aa0241f94e8ec63483e18eb9c Mon Sep 17 00:00:00 2001 From: depristo Date: Mon, 13 Sep 2010 18:36:45 +0000 Subject: [PATCH] Improvements to the error display code to print out the SVN number in all messages. Fixes to CallableLoci and tests to check for that case git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4270 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/commandline/CommandLineProgram.java | 14 ++++++++--- .../walkers/coverage/CallableLociWalker.java | 24 +++++++++---------- .../CallableLociWalkerIntegrationTest.java | 14 +++++++++-- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java b/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java index 4c320582a..5de6eb71b 100644 --- a/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java +++ b/java/src/org/broadinstitute/sting/commandline/CommandLineProgram.java @@ -26,6 +26,8 @@ package org.broadinstitute.sting.commandline; import org.apache.log4j.*; +import org.broadinstitute.sting.gatk.CommandLineGATK; +import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.help.ApplicationDetails; import org.broadinstitute.sting.utils.help.HelpFormatter; @@ -350,17 +352,19 @@ public abstract class CommandLineProgram { * @param msg the message * @param e the error */ - public static void exitSystemWithError(final String msg, Exception e) { + public static void exitSystemWithError(String msg, final Exception e) { errorPrintf("------------------------------------------------------------------------------------------%n"); errorPrintf("stack trace %n"); e.printStackTrace(); errorPrintf("------------------------------------------------------------------------------------------%n"); - errorPrintf("A GATK RUNTIME ERROR has occurred:%n"); + errorPrintf("A GATK RUNTIME ERROR has occurred (version %s):%n", CommandLineGATK.getVersionNumber()); errorPrintf("%n"); errorPrintf("Please visit to wiki to see if this is a known problem%n"); errorPrintf("If not, please post the error, with stack trace, to the GATK forum%n"); printDocumentationReference(); + if ( msg == null ) // some exceptions don't have detailed messages + msg = "Code exception (see stack trace for error itself)"; errorPrintf("%n"); errorPrintf("MESSAGE: %s%n", msg.trim()); errorPrintf("------------------------------------------------------------------------------------------%n"); @@ -368,8 +372,12 @@ public abstract class CommandLineProgram { } public static void exitSystemWithUserError(UserException e) { + if ( e.getMessage() == null ) + throw new ReviewedStingException("UserException found with no message!", e); + errorPrintf("------------------------------------------------------------------------------------------%n"); - errorPrintf("A USER ERROR has occurred. The invalid arguments or inputs must be corrected before the GATK can proceed%n"); + errorPrintf("A USER ERROR has occurred (version %s): %n", CommandLineGATK.getVersionNumber()); + errorPrintf("The invalid arguments or inputs must be corrected before the GATK can proceed%n"); errorPrintf("%n"); errorPrintf("See the documentation (rerun with -h) for this tool to view allowable command-line argument.%n"); printDocumentationReference(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/coverage/CallableLociWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/coverage/CallableLociWalker.java index 8f31eab30..21a0f4241 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/coverage/CallableLociWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/coverage/CallableLociWalker.java @@ -183,17 +183,17 @@ public class CallableLociWalker extends LocusWalker