001: /*---------------------------------------------------------------------------*\
002: $Id: CurnUsageException.java 6400 2006-09-06 18:29:58Z bmc $
003: \*---------------------------------------------------------------------------*/
004:
005: package org.clapper.curn;
006:
007: /**
008: * Thrown to indicate a <i>curn</i> usage exception (usually, something
009: * under the user's control), rather than a system problem.
010: *
011: * @version <tt>$Revision: 6400 $</tt>
012: */
013: public class CurnUsageException extends CurnException {
014: /*----------------------------------------------------------------------*\
015: Constructor
016: \*----------------------------------------------------------------------*/
017:
018: /**
019: * Default constructor, for an exception with no nested exception and
020: * no message.
021: */
022: public CurnUsageException() {
023: super ();
024: }
025:
026: /**
027: * Constructs an exception containing another exception, but no message
028: * of its own.
029: *
030: * @param exception the exception to contain
031: */
032: public CurnUsageException(Throwable exception) {
033: super (exception);
034: }
035:
036: /**
037: * Constructs an exception containing an error message, but no
038: * nested exception.
039: *
040: * @param message the message to associate with this exception
041: */
042: public CurnUsageException(String message) {
043: super (message);
044: }
045:
046: /**
047: * Constructs an exception containing another exception and a message.
048: *
049: * @param message the message to associate with this exception
050: * @param exception the exception to contain
051: */
052: public CurnUsageException(String message, Throwable exception) {
053: super (message, exception);
054: }
055:
056: /**
057: * Constructs an exception containing a resource bundle name, a message
058: * key, and a default message (in case the resource bundle can't be
059: * found). Using this constructor is equivalent to calling the
060: * {@link #CurnUsageException(String,String,String,Object[])} constructor,
061: * with a null pointer for the <tt>Object[]</tt> parameter.
062: *
063: * @param bundleName resource bundle name
064: * @param messageKey the key to the message to find in the bundle
065: * @param defaultMsg the default message
066: *
067: * @see #CurnUsageException(String,String,String,Object[])
068: */
069: public CurnUsageException(String bundleName, String messageKey,
070: String defaultMsg) {
071: super (bundleName, messageKey, defaultMsg);
072: }
073:
074: /**
075: * Constructs an exception containing a resource bundle name, a message
076: * key, and a default message (in case the resource bundle can't be
077: * found). Using this constructor is equivalent to calling the
078: * {@link #CurnUsageException(String,String,String,Object[],Throwable)}
079: * constructor, with a null pointer for the <tt>Object[]</tt> parameter.
080: *
081: * @param bundleName resource bundle name
082: * @param messageKey the key to the message to find in the bundle
083: * @param defaultMsg the default message
084: * @param msgParams parameters to the message, if any, or null
085: *
086: * @see #CurnUsageException(String,String,String,Object[],Throwable)
087: */
088: public CurnUsageException(String bundleName, String messageKey,
089: String defaultMsg, Object[] msgParams) {
090: super (bundleName, messageKey, defaultMsg, msgParams);
091: }
092:
093: /**
094: * Constructs an exception containing a resource bundle name, a message
095: * key, a default message (in case the resource bundle can't be found), and
096: * another exception. Using this constructor is equivalent to calling the
097: * {@link #CurnUsageException(String,String,String,Object[],Throwable)}
098: * constructor, with a null pointer for the <tt>Object[]</tt>
099: * parameter.
100: *
101: * @param bundleName resource bundle name
102: * @param messageKey the key to the message to find in the bundle
103: * @param defaultMsg the default message
104: * @param exception the exception to nest
105: *
106: * @see #CurnUsageException(String,String,String,Object[],Throwable)
107: */
108: public CurnUsageException(String bundleName, String messageKey,
109: String defaultMsg, Throwable exception) {
110: this (bundleName, messageKey, defaultMsg, null, exception);
111: }
112:
113: /**
114: * Constructs an exception containing a resource bundle name, a message
115: * key, a default message format (in case the resource bundle can't be
116: * found), arguments to be incorporated in the message via
117: * <tt>java.text.MessageFormat</tt>, and another exception.
118: * Calls to {@link #getMessage(Locale)} will attempt to retrieve the
119: * top-most message (i.e., the message from this exception, not from
120: * nested exceptions) by querying the named resource bundle. Calls to
121: * {@link #printStackTrace(PrintWriter,Locale)} will do the same, where
122: * applicable. The message is not retrieved until one of those methods
123: * is called, because the desired locale is passed into
124: * <tt>getMessage()</tt> and <tt>printStackTrace()</tt>, not this
125: * constructor.
126: *
127: * @param bundleName resource bundle name
128: * @param messageKey the key to the message to find in the bundle
129: * @param defaultMsg the default message
130: * @param msgParams parameters to the message, if any, or null
131: * @param exception exception to be nested
132: *
133: * @see #CurnUsageException(String,String,String,Object[])
134: */
135: public CurnUsageException(String bundleName, String messageKey,
136: String defaultMsg, Object[] msgParams, Throwable exception) {
137: super(bundleName, messageKey, defaultMsg, msgParams, exception);
138: }
139: }
|