    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
    018
    019    package org.apache.commons.beanutils;
    020
    021
    022    /**
    023     * <p>A <strong>ConversionException</strong> indicates that a call to
    024     * <code>Converter.convert()</code> has failed to complete successfully.
    025     *
    026     * @author Craig McClanahan
    027     * @author Paulo Gaspar
    028     * @since 1.3
    029     */
    030
    031    public class ConversionException extends RuntimeException {
    032
    033
    034        // ----------------------------------------------------------- Constructors
    035
    036
    037        /**
    038         * Construct a new exception with the specified message.
    039         *
    040         * @param message The message describing this exception
    041         */
    042        public ConversionException(String message) {
    043
    044            super(message);
    045
    046        }
    047
    048
    049        /**
    050         * Construct a new exception with the specified message and root cause.
    051         *
    052         * @param message The message describing this exception
    053         * @param cause The root cause of this exception
    054         */
    055        public ConversionException(String message, Throwable cause) {
    056
    057            super(message);
    058            this.cause = cause;
    059
    060        }
    061
    062
    063        /**
    064         * Construct a new exception with the specified root cause.
    065         *
    066         * @param cause The root cause of this exception
    067         */
    068        public ConversionException(Throwable cause) {
    069
    070            super(cause.getMessage());
    071            this.cause = cause;
    072
    073        }
    074
    075
    076        // ------------------------------------------------------------- Properties
    077
    078
    079        /**
    080         * The root cause of this <code>ConversionException</code>, compatible with
    081         * JDK 1.4's extensions to <code>java.lang.Throwable</code>.
    082         */
    083        protected Throwable cause = null;
    084
    085        /**
    086         * Return the root cause of this conversion exception.
    087         * @return the root cause of this conversion exception
    088         */
    089        public Throwable getCause() {
    090            return (this.cause);
    091        }
    092
    093
    094    }