001    /*
002    * Licensed to the Apache Software Foundation (ASF) under one or more
003    * contributor license agreements.  See the NOTICE file distributed with
004    * this work for additional information regarding copyright ownership.
005    * The ASF licenses this file to You under the Apache License, Version 2.0
006    * (the "License"); you may not use this file except in compliance with
007    * the License.  You may obtain a copy of the License at
008    *
009    *     http://www.apache.org/licenses/LICENSE-2.0
010    *
011    * Unless required by applicable law or agreed to in writing, software
012    * distributed under the License is distributed on an "AS IS" BASIS,
013    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014    * See the License for the specific language governing permissions and
015    * limitations under the License.
016    */
017    package javax.servlet.jsp;
018    
019    /**
020     * Exception to be used by a Tag Handler to indicate some unrecoverable
021     * error.
022     * This error is to be caught by the top level of the JSP page and will result
023     * in an error page.
024     */
025    
026    public class JspTagException extends JspException {
027        /**
028         * Constructs a new JspTagException with the specified message.
029         * The message can be written to the server log and/or displayed
030         * for the user.
031         * 
032         * @param msg a <code>String</code> specifying the text of 
033         *     the exception message
034         */
035        public JspTagException(String msg) {
036            super( msg );
037        }
038    
039        /**
040         * Constructs a new JspTagException with no message.
041         */
042        public JspTagException() {
043            super();
044        }
045    
046        /**
047         * Constructs a new JspTagException when the JSP Tag
048         * needs to throw an exception and include a message 
049         * about the "root cause" exception that interfered with its 
050         * normal operation, including a description message.
051         *
052         *
053         * @param message           a <code>String</code> containing 
054         *                          the text of the exception message
055         *
056         * @param rootCause         the <code>Throwable</code> exception 
057         *                          that interfered with the JSP Tag's
058         *                          normal operation, making this JSP Tag
059         *                          exception necessary
060         *
061         * @since 2.0
062         */
063        public JspTagException(String message, Throwable rootCause) {
064            super( message, rootCause );
065        }
066    
067    
068        /**
069         * Constructs a new JSP Tag exception when the JSP Tag
070         * needs to throw an exception and include a message
071         * about the "root cause" exception that interfered with its
072         * normal operation.  The exception's message is based on the localized
073         * message of the underlying exception.
074         *
075         * <p>This method calls the <code>getLocalizedMessage</code> method
076         * on the <code>Throwable</code> exception to get a localized exception
077         * message. When subclassing <code>JspTagException</code>, 
078         * this method can be overridden to create an exception message 
079         * designed for a specific locale.
080         *
081         * @param rootCause         the <code>Throwable</code> exception
082         *                          that interfered with the JSP Tag's
083         *                          normal operation, making the JSP Tag 
084         *                          exception necessary
085         *
086         * @since 2.0
087         */
088    
089        public JspTagException(Throwable rootCause) {
090            super( rootCause );
091        }
092    
093    }