001: /*---------------------------------------------------------------------------*\
002: $Id: RSSParserException.java 7041 2007-09-09 01:04:47Z bmc $
003: ---------------------------------------------------------------------------
004: This software is released under a BSD-style license:
005:
006: Copyright (c) 2004-2007 Brian M. Clapper. All rights reserved.
007:
008: Redistribution and use in source and binary forms, with or without
009: modification, are permitted provided that the following conditions are
010: met:
011:
012: 1. Redistributions of source code must retain the above copyright notice,
013: this list of conditions and the following disclaimer.
014:
015: 2. The end-user documentation included with the redistribution, if any,
016: must include the following acknowlegement:
017:
018: "This product includes software developed by Brian M. Clapper
019: (bmc@clapper.org, http://www.clapper.org/bmc/). That software is
020: copyright (c) 2004-2007 Brian M. Clapper."
021:
022: Alternately, this acknowlegement may appear in the software itself,
023: if wherever such third-party acknowlegements normally appear.
024:
025: 3. Neither the names "clapper.org", "curn", nor any of the names of the
026: project contributors may be used to endorse or promote products
027: derived from this software without prior written permission. For
028: written permission, please contact bmc@clapper.org.
029:
030: 4. Products derived from this software may not be called "curn", nor may
031: "clapper.org" appear in their names without prior written permission
032: of Brian M. Clapper.
033:
034: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
036: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
037: NO EVENT SHALL BRIAN M. CLAPPER BE LIABLE FOR ANY DIRECT, INDIRECT,
038: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
039: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
040: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
041: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
042: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
043: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
044: \*---------------------------------------------------------------------------*/
045:
046: package org.clapper.curn.parser;
047:
048: import org.clapper.util.misc.NestedException;
049:
050: /**
051: * A <tt>RSSParserException</tt> is thrown by parser implementations
052: * to signify parser errors.
053: *
054: * @see org.clapper.util.misc.NestedException
055: *
056: * @version <tt>$Revision: 7041 $</tt>
057: */
058: public class RSSParserException extends NestedException {
059: /*----------------------------------------------------------------------*\
060: Private Static Variables
061: \*----------------------------------------------------------------------*/
062:
063: /**
064: * See JDK 1.5 version of java.io.Serializable
065: */
066: private static final long serialVersionUID = 1L;
067:
068: /*----------------------------------------------------------------------*\
069: Constructor
070: \*----------------------------------------------------------------------*/
071:
072: /**
073: * Default constructor, for an exception with no nested exception and
074: * no message.
075: */
076: public RSSParserException() {
077: super ();
078: }
079:
080: /**
081: * Constructs an exception containing another exception, but no message
082: * of its own.
083: *
084: * @param exception the exception to contain
085: */
086: public RSSParserException(Throwable exception) {
087: super (exception);
088: }
089:
090: /**
091: * Constructs an exception containing an error message, but no
092: * nested exception.
093: *
094: * @param message the message to associate with this exception
095: */
096: public RSSParserException(String message) {
097: super (message);
098: }
099:
100: /**
101: * Constructs an exception containing another exception and a message.
102: *
103: * @param message the message to associate with this exception
104: * @param exception the exception to contain
105: */
106: public RSSParserException(String message, Throwable exception) {
107: super (message, exception);
108: }
109:
110: /**
111: * Constructs an exception containing a resource bundle name, a message
112: * key, and a default message (in case the resource bundle can't be
113: * found). Using this constructor is equivalent to calling the
114: * {@link #RSSParserException(String,String,String,Object[])}
115: * constructor, with a null pointer for the <tt>Object[]</tt>
116: * parameter. Calls to
117: * {@link org.clapper.util.misc.NestedException#getMessage(java.util.Locale)}
118: * will attempt to retrieve the top-most message (i.e., the message
119: * from this exception, not from nested exceptions) by querying the
120: * named resource bundle. Calls to
121: * {@link org.clapper.util.misc.NestedException#printStackTrace(PrintWriter,java.util.Locale)}
122: * will do the same, where applicable. The message is not retrieved
123: * until one of those methods is called, because the desired locale is
124: * passed into <tt>getMessage()</tt> and <tt>printStackTrace()</tt>,
125: * not this 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: *
131: * @see #RSSParserException(String,String,String,Object[])
132: * @see org.clapper.util.misc.NestedException#getMessage(java.util.Locale)
133: */
134: public RSSParserException(String bundleName, String messageKey,
135: String defaultMsg) {
136: super (bundleName, messageKey, defaultMsg);
137: }
138:
139: /**
140: * Constructs an exception containing a resource bundle name, a message
141: * key, and a default message (in case the resource bundle can't be
142: * found). Using this constructor is equivalent to calling the
143: * {@link #RSSParserException(String,String,String,Object[],Throwable)}
144: * constructor, with a null pointer for the <tt>Throwable</tt>
145: * parameter. Calls to
146: * {@link org.clapper.util.misc.NestedException#getMessage(java.util.Locale)}
147: * will attempt to retrieve the top-most message (i.e., the message
148: * from this exception, not from nested exceptions) by querying the
149: * named resource bundle. Calls to
150: * {@link org.clapper.util.misc.NestedException#printStackTrace(PrintWriter,java.util.Locale)}
151: * will do the same, where applicable. The message is not retrieved
152: * until one of those methods is called, because the desired locale is
153: * passed into <tt>getMessage()</tt> and <tt>printStackTrace()</tt>,
154: * not this constructor.
155: *
156: * @param bundleName resource bundle name
157: * @param messageKey the key to the message to find in the bundle
158: * @param defaultMsg the default message
159: * @param msgParams parameters to the message, if any, or null
160: *
161: * @see #RSSParserException(String,String,String,Object[],Throwable)
162: * @see org.clapper.util.misc.NestedException#getMessage(java.util.Locale)
163: */
164: public RSSParserException(String bundleName, String messageKey,
165: String defaultMsg, Object[] msgParams) {
166: super (bundleName, messageKey, defaultMsg, msgParams);
167: }
168:
169: /**
170: * Constructs an exception containing a resource bundle name, a message
171: * key, a default message (in case the resource bundle can't be found), and
172: * another exception. Using this constructor is equivalent to calling then
173: * {@link #RSSParserException(String,String,String,Object[],Throwable)}
174: * constructor, with a null pointer for the <tt>Object[]</tt>
175: * parameter. Calls to
176: * {@link org.clapper.util.misc.NestedException#getMessage(java.util.Locale)}
177: * will attempt to retrieve the top-most message (i.e., the message
178: * from this exception, not from nested exceptions) by querying the
179: * named resource bundle. Calls to
180: * {@link org.clapper.util.misc.NestedException#printStackTrace(PrintWriter,java.util.Locale)}
181: * will do the same, where applicable. The message is not retrieved
182: * until one of those methods is called, because the desired locale is
183: * passed into <tt>getMessage()</tt> and <tt>printStackTrace()</tt>,
184: * not this constructor.
185: *
186: * @param bundleName resource bundle name
187: * @param messageKey the key to the message to find in the bundle
188: * @param defaultMsg the default message
189: * @param exception the exception to nest
190: *
191: * @see #RSSParserException(String,String,String,Object[],Throwable)
192: * @see org.clapper.util.misc.NestedException#getMessage(java.util.Locale)
193: */
194: public RSSParserException(String bundleName, String messageKey,
195: String defaultMsg, Throwable exception) {
196: this (bundleName, messageKey, defaultMsg, null, exception);
197: }
198:
199: /**
200: * Constructs an exception containing a resource bundle name, a message
201: * key, a default message format (in case the resource bundle can't be
202: * found), arguments to be incorporated in the message via
203: * <tt>java.text.MessageFormat</tt>, and another exception. Calls to
204: * {@link org.clapper.util.misc.NestedException#getMessage(java.util.Locale)}
205: * will attempt to retrieve the top-most message (i.e., the message
206: * from this exception, not from nested exceptions) by querying the
207: * named resource bundle. Calls to
208: * {@link org.clapper.util.misc.NestedException#printStackTrace(PrintWriter,java.util.Locale)}
209: * will do the same, where applicable. The message is not retrieved
210: * until one of those methods is called, because the desired locale is
211: * passed into <tt>getMessage()</tt> and <tt>printStackTrace()</tt>,
212: * not this constructor.
213: *
214: * @param bundleName resource bundle name
215: * @param messageKey the key to the message to find in the bundle
216: * @param defaultMsg the default message
217: * @param msgParams parameters to the message, if any, or null
218: * @param exception exception to be nested
219: *
220: * @see #RSSParserException(String,String,String,Object[])
221: * @see org.clapper.util.misc.NestedException#getMessage(java.util.Locale)
222: */
223: public RSSParserException(String bundleName, String messageKey,
224: String defaultMsg, Object[] msgParams, Throwable exception) {
225: super(bundleName, messageKey, defaultMsg, msgParams, exception);
226: }
227: }
|