edu.internet2.middleware.grouper.ui.util
Class NavExceptionHelper

java.lang.Object
  extended by edu.internet2.middleware.grouper.ui.util.NavExceptionHelper
All Implemented Interfaces:
Serializable

public class NavExceptionHelper
extends Object
implements Serializable

Helper class centralise some Exception handling

Version:
$Id: NavExceptionHelper.java,v 1.3 2009-08-12 04:52:14 mchyzer Exp $
Author:
Gary Brown.
See Also:
Serialized Form

Constructor Summary
NavExceptionHelper()
           
 
Method Summary
static Exception fillInStacktrace(Exception e)
          Allows code which constructs an Exception to add a stack trace
 String getMessage(UnrecoverableErrorException cause)
          UnrecoverableErrorException can have its own message key and one associated with any 'cause'.
 String key(Throwable t)
          Takes class short name for Throwable and builds a key based on that.
 String missingAlternativeParameters(String... params)
          Helper method takes alternate parameter / parameter name pairs and constructs a message, if any are empty, indicating what is missing
 String missingParameters(String... params)
          Helper method takes alternate parameter / parameter name pairs and constructs a message, if any are empty, indicating what is missing
static String toLog(Throwable t)
          Captures the stack trace for an Exception so it can be logged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavExceptionHelper

public NavExceptionHelper()
Method Detail

key

public String key(Throwable t)
Takes class short name for Throwable and builds a key based on that. If the key is not present a default catch all is used.

Parameters:
t -
Returns:
key

getMessage

public String getMessage(UnrecoverableErrorException cause)
UnrecoverableErrorException can have its own message key and one associated with any 'cause'. This method takes care of building a message based on the available keys.

Parameters:
cause -
Returns:
message

missingParameters

public String missingParameters(String... params)
Helper method takes alternate parameter / parameter name pairs and constructs a message, if any are empty, indicating what is missing

Parameters:
params -
Returns:
missing parameters

missingAlternativeParameters

public String missingAlternativeParameters(String... params)
Helper method takes alternate parameter / parameter name pairs and constructs a message, if any are empty, indicating what is missing

Parameters:
params -
Returns:
missing parameters

fillInStacktrace

public static Exception fillInStacktrace(Exception e)
Allows code which constructs an Exception to add a stack trace

Parameters:
e -
Returns:
the input Exception

toLog

public static String toLog(Throwable t)
Captures the stack trace for an Exception so it can be logged

Parameters:
t -
Returns:
the stack trace as a String