001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    
021    package org.apache.directory.shared.ldap.codec.util;
022    
023    
024    /**
025     * The URI parsing and escape encoding exception.
026     * 
027     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
028     * @version $Revision: 664290 $ $Date: 2002/03/14 15:14:01
029     */
030    public class URIException extends Exception
031    {
032        private static final long serialVersionUID = 1L;
033    
034    
035        // ----------------------------------------------------------- constructors
036        /**
037         * The constructor with a reason string argument.
038         * 
039         * @param reason
040         *            the reason
041         */
042        public URIException(String reason)
043        {
044            super( reason ); // for backward compatibility of Throwable
045            this.reason = reason;
046            this.reasonCode = UNKNOWN;
047        }
048    
049        // -------------------------------------------------------------- constants
050    
051        /**
052         * No specified reason code.
053         */
054        public static final int UNKNOWN = 0;
055    
056        /**
057         * The URI parsing error.
058         */
059        // public static final int PARSING = 1;
060    
061        /**
062         * The unsupported character encoding.
063         */
064        // public static final int UNSUPPORTED_ENCODING = 2;
065    
066        /**
067         * The URI escape encoding and decoding error.
068         */
069        // public static final int ESCAPING = 3;
070    
071        /**
072         * The DNS punycode encoding or decoding error.
073         */
074        // public static final int PUNYCODE = 4;
075        // ------------------------------------------------------------- properties
076        /**
077         * The reason code.
078         */
079        protected int reasonCode;
080    
081        /**
082         * The reason message.
083         */
084        protected String reason;
085    
086    
087        // ---------------------------------------------------------------- methods
088    
089        /**
090         * Get the reason code.
091         * 
092         * @return the reason code
093         */
094        public int getReasonCode()
095        {
096            return reasonCode;
097        }
098    }