View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17
    18
    19  package org.apache.commons.beanutils;
    20
    21
    22  /***
    23   * <p>A <strong>ConversionException</strong> indicates that a call to
    24   * <code>Converter.convert()</code> has failed to complete successfully.
    25   *
    26   * @author Craig McClanahan
    27   * @author Paulo Gaspar
    28   * @since 1.3
    29   */
    30
    31  public class ConversionException extends RuntimeException {
    32
    33
    34      // ----------------------------------------------------------- Constructors
    35
    36
    37      /***
    38       * Construct a new exception with the specified message.
    39       *
    40       * @param message The message describing this exception
    41       */
    42      public ConversionException(String message) {
    43
    44          super(message);
    45
    46      }
    47
    48
    49      /***
    50       * Construct a new exception with the specified message and root cause.
    51       *
    52       * @param message The message describing this exception
    53       * @param cause The root cause of this exception
    54       */
    55      public ConversionException(String message, Throwable cause) {
    56
    57          super(message);
    58          this.cause = cause;
    59
    60      }
    61
    62
    63      /***
    64       * Construct a new exception with the specified root cause.
    65       *
    66       * @param cause The root cause of this exception
    67       */
    68      public ConversionException(Throwable cause) {
    69
    70          super(cause.getMessage());
    71          this.cause = cause;
    72
    73      }
    74
    75
    76      // ------------------------------------------------------------- Properties
    77
    78
    79      /***
    80       * The root cause of this <code>ConversionException</code>, compatible with
    81       * JDK 1.4's extensions to <code>java.lang.Throwable</code>.
    82       */
    83      protected Throwable cause = null;
    84
    85      /***
    86       * Return the root cause of this conversion exception.
    87       * @return the root cause of this conversion exception
    88       */
    89      public Throwable getCause() {
    90          return (this.cause);
    91      }
    92
    93
    94  }