001/* IllegalStateException.java -- thrown when invoking a method at 002 an illegal or inappropriate time 003 Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. 004 005This file is part of GNU Classpath. 006 007GNU Classpath is free software; you can redistribute it and/or modify 008it under the terms of the GNU General Public License as published by 009the Free Software Foundation; either version 2, or (at your option) 010any later version. 011 012GNU Classpath is distributed in the hope that it will be useful, but 013WITHOUT ANY WARRANTY; without even the implied warranty of 014MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015General Public License for more details. 016 017You should have received a copy of the GNU General Public License 018along with GNU Classpath; see the file COPYING. If not, write to the 019Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02002110-1301 USA. 021 022Linking this library statically or dynamically with other modules is 023making a combined work based on this library. Thus, the terms and 024conditions of the GNU General Public License cover the whole 025combination. 026 027As a special exception, the copyright holders of this library give you 028permission to link this library with independent modules to produce an 029executable, regardless of the license terms of these independent 030modules, and to copy and distribute the resulting executable under 031terms of your choice, provided that you also meet, for each linked 032independent module, the terms and conditions of the license of that 033module. An independent module is a module which is not derived from 034or based on this library. If you modify this library, you may extend 035this exception to your version of the library, but you are not 036obligated to do so. If you do not wish to do so, delete this 037exception statement from your version. */ 038 039 040package java.lang; 041 042/** 043 * Thrown when a method is invoked at an illegal or inappropriate time. For 044 * example:<br> 045 * <pre> 046 * void m(Collecion c) 047 * { 048 * c.iterator().remove(); 049 * } 050 * </pre> 051 * 052 * @author Brian Jones 053 * @author Warren Levy (warrenl@cygnus.com) 054 * @author Andrew John Hughes (gnu_andrew@member.fsf.org) 055 * @since 1.1 056 * @status updated to 1.5 057 */ 058public class IllegalStateException extends RuntimeException 059{ 060 /** 061 * Compatible with JDK 1.1+. 062 */ 063 private static final long serialVersionUID = -1848914673093119416L; 064 065 /** 066 * Create an exception without a message. 067 */ 068 public IllegalStateException() 069 { 070 } 071 072 /** 073 * Create an exception with a message. 074 * 075 * @param s the message 076 */ 077 public IllegalStateException(String s) 078 { 079 super(s); 080 } 081 082 /** 083 * <p> 084 * Constructs a <code>IllegalStateException</code> using 085 * the specified error message, which should give further details 086 * as to the reason for this exception. The specified cause 087 * <code>Throwable</code> may be used to provide additional history, 088 * with regards to the root of the problem. It is perfectly valid 089 * for this to be null, if the cause of the problem is unknown. 090 * </p> 091 * <p> 092 * <strong>Note</strong>: the detail message from the cause is not 093 * automatically incorporated into the resulting detail message of 094 * this exception. 095 * </p> 096 * 097 * @param message the detail message, which should give the reason for 098 * this exception being thrown. 099 * @param cause the cause of this exception, or null if the cause 100 * is unknown. 101 * @since 1.5 102 */ 103 public IllegalStateException(String message, Throwable cause) 104 { 105 super(message, cause); 106 } 107 108 /** 109 * <p> 110 * Constructs a <code>IllegalStateException</code> using 111 * the specified cause <code>Throwable</code>, which may be used 112 * to provide additional history, with regards to the root of the 113 * problem. It is perfectly valid for this to be null, if the 114 * cause of the problem is unknown. 115 * </p> 116 * <p> 117 * The detail message is automatically constructed from the detail 118 * message of the supplied causal exception. If the cause is null, 119 * then the detail message will also be null. Otherwise, the detail 120 * message of this exception will be that of the causal exception. 121 * This makes this constructor very useful for simply wrapping another 122 * exception. 123 * </p> 124 * 125 * @param cause the cause of this exception, or null if the cause 126 * is unknown. 127 * @since 1.5 128 */ 129 public IllegalStateException(Throwable cause) 130 { 131 super(cause); 132 } 133 134}