001 /* 002 * Copyright 2003-2004 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.apache.commons.convert1; 017 018 019 /** 020 * <p>A <strong>ConversionException</strong> indicates that a call to 021 * <code>Converter.convert()</code> has failed to complete successfully. 022 * 023 * @author Craig McClanahan 024 * @author Paulo Gaspar 025 * @since 0.1 026 */ 027 028 public class ConversionException extends RuntimeException { 029 030 031 // ----------------------------------------------------------- Constructors 032 033 034 /** 035 * Construct a new exception with the specified message. 036 * 037 * @param message The message describing this exception 038 */ 039 public ConversionException(String message) { 040 041 super(message); 042 043 } 044 045 046 /** 047 * Construct a new exception with the specified message and root cause. 048 * 049 * @param message The message describing this exception 050 * @param cause The root cause of this exception 051 */ 052 public ConversionException(String message, Throwable cause) { 053 054 super(message); 055 this.cause = cause; 056 057 } 058 059 060 /** 061 * Construct a new exception with the specified root cause. 062 * 063 * @param cause The root cause of this exception 064 */ 065 public ConversionException(Throwable cause) { 066 067 super(cause.getMessage()); 068 this.cause = cause; 069 070 } 071 072 073 // ------------------------------------------------------------- Properties 074 075 076 /** 077 * The root cause of this <code>ConversionException</code>, compatible with 078 * JDK 1.4's extensions to <code>java.lang.Throwable</code>. 079 */ 080 protected Throwable cause = null; 081 082 public Throwable getCause() { 083 return (this.cause); 084 } 085 086 087 }