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 package org.apache.tika.io; 18 19 import java.io.IOException; 20 21 /** 22 * Subclasses IOException with the {@link Throwable} constructors missing before Java 6. If you are using Java 6, 23 * consider this class deprecated and use {@link IOException}. 24 * 25 * @author <a href="http://commons.apache.org/io/">Apache Commons IO</a> 26 * @since Apache Tika 0.4, copied from Commons IO 1.4 27 */ 28 public class IOExceptionWithCause extends IOException { 29 30 /** 31 * Defines the serial version UID. 32 */ 33 private static final long serialVersionUID = 1L; 34 35 /** 36 * Constructs a new instance with the given message and cause. 37 * <p> 38 * As specified in {@link Throwable}, the message in the given <code>cause</code> is not used in this instance's 39 * message. 40 * </p> 41 * 42 * @param message 43 * the message (see {@link #getMessage()}) 44 * @param cause 45 * the cause (see {@link #getCause()}). A <code>null</code> value is allowed. 46 */ 47 public IOExceptionWithCause(String message, Throwable cause) { 48 super(message); 49 this.initCause(cause); 50 } 51 52 /** 53 * Constructs a new instance with the given cause. 54 * <p> 55 * The message is set to <code>cause==null ? null : cause.toString()</code>, which by default contains the class 56 * and message of <code>cause</code>. This constructor is useful for call sites that just wrap another throwable. 57 * </p> 58 * 59 * @param cause 60 * the cause (see {@link #getCause()}). A <code>null</code> value is allowed. 61 */ 62 public IOExceptionWithCause(Throwable cause) { 63 super(cause == null ? null : cause.toString()); 64 this.initCause(cause); 65 } 66 67 }