View Javadoc

1   /*
2    * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3    * 
4    * This software is open source. 
5    * See the bottom of this file for the licence.
6    * 
7    * $Id: IllegalAddException.java,v 1.4 2004/06/25 08:03:33 maartenc Exp $
8    */
9   
10  package org.dom4j;
11  
12  /*** <p><code>IllegalAddException</code> is thrown when a node
13    * is added incorrectly to an <code>{@link Element}</code></p>
14    *
15    * @version $Revision: 1.4 $
16    */
17  public class IllegalAddException extends IllegalArgumentException {
18  
19      public IllegalAddException(String reason) {
20          super(reason);
21      }
22      
23      public IllegalAddException(Element parent,Node node,String reason) {
24          super( "The node \"" + node.toString() 
25              + "\" could not be added to the element \"" 
26              + parent.getQualifiedName() + "\" because: " + reason 
27          );
28      }
29      
30      public IllegalAddException(Branch parent,Node node,String reason) {
31          super( "The node \"" + node.toString() 
32              + "\" could not be added to the branch \"" 
33              + parent.getName() + "\" because: " + reason 
34          );
35      }
36  }
37  
38  
39  
40  
41  /*
42   * Redistribution and use of this software and associated documentation
43   * ("Software"), with or without modification, are permitted provided
44   * that the following conditions are met:
45   *
46   * 1. Redistributions of source code must retain copyright
47   *    statements and notices.  Redistributions must also contain a
48   *    copy of this document.
49   *
50   * 2. Redistributions in binary form must reproduce the
51   *    above copyright notice, this list of conditions and the
52   *    following disclaimer in the documentation and/or other
53   *    materials provided with the distribution.
54   *
55   * 3. The name "DOM4J" must not be used to endorse or promote
56   *    products derived from this Software without prior written
57   *    permission of MetaStuff, Ltd.  For written permission,
58   *    please contact dom4j-info@metastuff.com.
59   *
60   * 4. Products derived from this Software may not be called "DOM4J"
61   *    nor may "DOM4J" appear in their names without prior written
62   *    permission of MetaStuff, Ltd. DOM4J is a registered
63   *    trademark of MetaStuff, Ltd.
64   *
65   * 5. Due credit should be given to the DOM4J Project - 
66   *    http://www.dom4j.org
67   *
68   * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
69   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
70   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
71   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
72   * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
73   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
74   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
75   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
76   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
77   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
78   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
79   * OF THE POSSIBILITY OF SUCH DAMAGE.
80   *
81   * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
82   *
83   * $Id: IllegalAddException.java,v 1.4 2004/06/25 08:03:33 maartenc Exp $
84   */