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 019package 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 * @since 1.3 027 * @version $Id$ 028 */ 029 030public class ConversionException extends RuntimeException { 031 032 033 // ----------------------------------------------------------- Constructors 034 035 036 /** 037 * Construct a new exception with the specified message. 038 * 039 * @param message The message describing this exception 040 */ 041 public ConversionException(final String message) { 042 043 super(message); 044 045 } 046 047 048 /** 049 * Construct a new exception with the specified message and root cause. 050 * 051 * @param message The message describing this exception 052 * @param cause The root cause of this exception 053 */ 054 public ConversionException(final String message, final Throwable cause) { 055 056 super(message); 057 this.cause = cause; 058 059 } 060 061 062 /** 063 * Construct a new exception with the specified root cause. 064 * 065 * @param cause The root cause of this exception 066 */ 067 public ConversionException(final Throwable cause) { 068 069 super(cause.getMessage()); 070 this.cause = cause; 071 072 } 073 074 075 // ------------------------------------------------------------- Properties 076 077 078 /** 079 * The root cause of this <code>ConversionException</code>, compatible with 080 * JDK 1.4's extensions to <code>java.lang.Throwable</code>. 081 */ 082 protected Throwable cause = null; 083 084 /** 085 * Return the root cause of this conversion exception. 086 * @return the root cause of this conversion exception 087 */ 088 @Override 089 public Throwable getCause() { 090 return (this.cause); 091 } 092 093 094}