001/* Exception thrown on an attempt to perform an action that would result in an 002 inconsistent or contradictory data structure if it were allowed to 003 complete. 004 005 Copyright (c) 1997-2014 The Regents of the University of California. 006 All rights reserved. 007 Permission is hereby granted, without written agreement and without 008 license or royalty fees, to use, copy, modify, and distribute this 009 software and its documentation for any purpose, provided that the above 010 copyright notice and the following two paragraphs appear in all copies 011 of this software. 012 013 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 014 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 015 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 016 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 017 SUCH DAMAGE. 018 019 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 020 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 022 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 023 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 024 ENHANCEMENTS, OR MODIFICATIONS. 025 026 PT_COPYRIGHT_VERSION_2 027 COPYRIGHTENDKEY 028 029 */ 030package ptolemy.kernel.util; 031 032////////////////////////////////////////////////////////////////////////// 033//// IllegalActionException 034 035/** 036 Thrown on an attempt to perform an action that would result in an 037 inconsistent or contradictory data structure if it were allowed to 038 complete. 039 <p>Examples include: 040 <menu> 041 <li> An attempt to remove a port from an entity when the 042 port does not belong to the entity. 043 <li> An attempt to add an item with no name to a named list. 044 </menu> 045 046 @author Edward A. Lee, Christopher Hylands 047 @version $Id$ 048 @since Ptolemy II 0.2 049 @Pt.ProposedRating Green (cxh) 050 @Pt.AcceptedRating Green (cxh) 051 */ 052@SuppressWarnings("serial") 053public class IllegalActionException extends KernelException { 054 /** Construct an exception with a detail message. 055 * @param detail The message. 056 */ 057 public IllegalActionException(String detail) { 058 this(null, null, null, detail); 059 } 060 061 /** Construct an exception with a detail message that is only the 062 * name of the argument. 063 * @param object The object. 064 */ 065 public IllegalActionException(Nameable object) { 066 this(null, object, null, null); 067 } 068 069 /** Construct an exception with a detail message that includes the 070 * name of the first argument. 071 * @param object The object. 072 * @param detail The message. 073 */ 074 public IllegalActionException(Nameable object, String detail) { 075 this(object, null, null, detail); 076 } 077 078 /** Construct an exception with a detail message that includes the 079 * name of the first argument. 080 * @param object The object. 081 * @param cause The cause of this exception, or null if the cause 082 * is not known or nonexistent. 083 * @param detail The message. 084 */ 085 public IllegalActionException(Nameable object, Throwable cause, 086 String detail) { 087 this(object, null, cause, detail); 088 } 089 090 /** Construct an exception with a detail message that consists of 091 * only the names of the object1 and object2 arguments. If one 092 * or more of the parameters are null, then the message of the 093 * exception is adjusted accordingly. 094 * @param object1 The first object. 095 * @param object2 The second object. 096 */ 097 public IllegalActionException(Nameable object1, Nameable object2) { 098 this(object1, object2, null, null); 099 } 100 101 /** Construct an exception with a detail message that includes the 102 * names of the first two arguments plus the third argument 103 * string. If one or more of the parameters are null, then the 104 * message of the exception is adjusted accordingly. 105 * @param object1 The first object. 106 * @param object2 The second object. 107 * @param detail The message. 108 */ 109 public IllegalActionException(Nameable object1, Nameable object2, 110 String detail) { 111 this(object1, object2, null, detail); 112 } 113 114 /** Construct an exception with a detail message that includes the 115 * names of the first two arguments plus the third argument 116 * string. If the cause argument is non-null, then the message 117 * of this exception will include the message of the cause 118 * argument. The stack trace of the cause argument is used when 119 * we print the stack trace of this exception. If one or more of 120 * the parameters are null, then the message of the exception is 121 * adjusted accordingly. 122 * 123 * @param object1 The first object. 124 * @param object2 The second object. 125 * @param cause The cause of this exception, or null if the cause 126 * is not known or nonexistent. 127 * @param detail The message. 128 */ 129 public IllegalActionException(Nameable object1, Nameable object2, 130 Throwable cause, String detail) { 131 super(object1, object2, cause, detail); 132 } 133}