001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003 *
004 * This code is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU General Public License version 2 only, as
006 * published by the Free Software Foundation. Sun designates this
007 * particular file as subject to the "Classpath" exception as provided
008 * by Sun in the LICENSE file that accompanied this code.
009 *
010 * This code is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013 * version 2 for more details (a copy is included in the LICENSE file that
014 * accompanied this code).
015 *
016 * You should have received a copy of the GNU General Public License version
017 * 2 along with this work; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019 *
020 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021 * CA 95054 USA or visit www.sun.com if you need additional information or
022 * have any questions.
023 */
024
025 /*
026 * This file is available under and governed by the GNU General Public
027 * License version 2 only, as published by the Free Software Foundation.
028 * However, the following notice accompanied the original version of this
029 * file and, per its terms, should not be removed:
030 *
031 * Copyright (c) 2004 World Wide Web Consortium,
032 *
033 * (Massachusetts Institute of Technology, European Research Consortium for
034 * Informatics and Mathematics, Keio University). All Rights Reserved. This
035 * work is distributed under the W3C(r) Software License [1] in the hope that
036 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038 *
039 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040 */
041
042 package org.w3c.dom;
043
044 /**
045 * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
046 * when an operation is impossible to perform (either for logical reasons,
047 * because data is lost, or because the implementation has become unstable).
048 * In general, DOM methods return specific error values in ordinary
049 * processing situations, such as out-of-bound errors when using
050 * <code>NodeList</code>.
051 * <p>Implementations should raise other exceptions under other circumstances.
052 * For example, implementations should raise an implementation-dependent
053 * exception if a <code>null</code> argument is passed when <code>null</code>
054 * was not expected.
055 * <p>Some languages and object systems do not support the concept of
056 * exceptions. For such systems, error conditions may be indicated using
057 * native error reporting mechanisms. For some bindings, for example,
058 * methods may return error codes similar to those listed in the
059 * corresponding method descriptions.
060 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
061 */
062 public class DOMException extends RuntimeException {
063 public DOMException(short code, String message) {
064 super (message);
065 this .code = code;
066 }
067
068 public short code;
069 // ExceptionCode
070 /**
071 * If index or size is negative, or greater than the allowed value.
072 */
073 public static final short INDEX_SIZE_ERR = 1;
074 /**
075 * If the specified range of text does not fit into a
076 * <code>DOMString</code>.
077 */
078 public static final short DOMSTRING_SIZE_ERR = 2;
079 /**
080 * If any <code>Node</code> is inserted somewhere it doesn't belong.
081 */
082 public static final short HIERARCHY_REQUEST_ERR = 3;
083 /**
084 * If a <code>Node</code> is used in a different document than the one
085 * that created it (that doesn't support it).
086 */
087 public static final short WRONG_DOCUMENT_ERR = 4;
088 /**
089 * If an invalid or illegal character is specified, such as in an XML name.
090 */
091 public static final short INVALID_CHARACTER_ERR = 5;
092 /**
093 * If data is specified for a <code>Node</code> which does not support
094 * data.
095 */
096 public static final short NO_DATA_ALLOWED_ERR = 6;
097 /**
098 * If an attempt is made to modify an object where modifications are not
099 * allowed.
100 */
101 public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
102 /**
103 * If an attempt is made to reference a <code>Node</code> in a context
104 * where it does not exist.
105 */
106 public static final short NOT_FOUND_ERR = 8;
107 /**
108 * If the implementation does not support the requested type of object or
109 * operation.
110 */
111 public static final short NOT_SUPPORTED_ERR = 9;
112 /**
113 * If an attempt is made to add an attribute that is already in use
114 * elsewhere.
115 */
116 public static final short INUSE_ATTRIBUTE_ERR = 10;
117 /**
118 * If an attempt is made to use an object that is not, or is no longer,
119 * usable.
120 * @since DOM Level 2
121 */
122 public static final short INVALID_STATE_ERR = 11;
123 /**
124 * If an invalid or illegal string is specified.
125 * @since DOM Level 2
126 */
127 public static final short SYNTAX_ERR = 12;
128 /**
129 * If an attempt is made to modify the type of the underlying object.
130 * @since DOM Level 2
131 */
132 public static final short INVALID_MODIFICATION_ERR = 13;
133 /**
134 * If an attempt is made to create or change an object in a way which is
135 * incorrect with regard to namespaces.
136 * @since DOM Level 2
137 */
138 public static final short NAMESPACE_ERR = 14;
139 /**
140 * If a parameter or an operation is not supported by the underlying
141 * object.
142 * @since DOM Level 2
143 */
144 public static final short INVALID_ACCESS_ERR = 15;
145 /**
146 * If a call to a method such as <code>insertBefore</code> or
147 * <code>removeChild</code> would make the <code>Node</code> invalid
148 * with respect to "partial validity", this exception would be raised
149 * and the operation would not be done. This code is used in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Val-20040127/'>DOM Level 3 Validation</a>]
150 * . Refer to this specification for further information.
151 * @since DOM Level 3
152 */
153 public static final short VALIDATION_ERR = 16;
154 /**
155 * If the type of an object is incompatible with the expected type of the
156 * parameter associated to the object.
157 * @since DOM Level 3
158 */
159 public static final short TYPE_MISMATCH_ERR = 17;
160
161 // Added serialVersionUID to preserve binary compatibility
162 static final long serialVersionUID = 6627732366795969916L;
163 }
|