jaxp/src/org/w3c/dom/DOMException.java
changeset 12457 c348e06f0e82
parent 12005 a754d69d5e60
child 25262 1fe892ba017a
equal deleted inserted replaced
12324:1d7e6da6adc8 12457:c348e06f0e82
       
     1 /*
       
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.  Oracle designates this
       
     7  * particular file as subject to the "Classpath" exception as provided
       
     8  * by Oracle in the LICENSE file that accompanied this code.
       
     9  *
       
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13  * version 2 for more details (a copy is included in the LICENSE file that
       
    14  * accompanied this code).
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License version
       
    17  * 2 along with this work; if not, write to the Free Software Foundation,
       
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19  *
       
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21  * or visit www.oracle.com if you need additional information or have any
       
    22  * questions.
       
    23  */
       
    24 
       
    25 /*
       
    26  * This file is available under and governed by the GNU General Public
       
    27  * License version 2 only, as published by the Free Software Foundation.
       
    28  * However, the following notice accompanied the original version of this
       
    29  * file and, per its terms, should not be removed:
       
    30  *
       
    31  * Copyright (c) 2004 World Wide Web Consortium,
       
    32  *
       
    33  * (Massachusetts Institute of Technology, European Research Consortium for
       
    34  * Informatics and Mathematics, Keio University). All Rights Reserved. This
       
    35  * work is distributed under the W3C(r) Software License [1] in the hope that
       
    36  * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
    37  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       
    38  *
       
    39  * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
       
    40  */
       
    41 
       
    42 package org.w3c.dom;
       
    43 
       
    44 /**
       
    45  * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
       
    46  * when an operation is impossible to perform (either for logical reasons,
       
    47  * because data is lost, or because the implementation has become unstable).
       
    48  * In general, DOM methods return specific error values in ordinary
       
    49  * processing situations, such as out-of-bound errors when using
       
    50  * <code>NodeList</code>.
       
    51  * <p>Implementations should raise other exceptions under other circumstances.
       
    52  * For example, implementations should raise an implementation-dependent
       
    53  * exception if a <code>null</code> argument is passed when <code>null</code>
       
    54  *  was not expected.
       
    55  * <p>Some languages and object systems do not support the concept of
       
    56  * exceptions. For such systems, error conditions may be indicated using
       
    57  * native error reporting mechanisms. For some bindings, for example,
       
    58  * methods may return error codes similar to those listed in the
       
    59  * corresponding method descriptions.
       
    60  * <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>.
       
    61  */
       
    62 public class DOMException extends RuntimeException {
       
    63     public DOMException(short code, String message) {
       
    64        super(message);
       
    65        this.code = code;
       
    66     }
       
    67     public short   code;
       
    68     // ExceptionCode
       
    69     /**
       
    70      * If index or size is negative, or greater than the allowed value.
       
    71      */
       
    72     public static final short INDEX_SIZE_ERR            = 1;
       
    73     /**
       
    74      * If the specified range of text does not fit into a
       
    75      * <code>DOMString</code>.
       
    76      */
       
    77     public static final short DOMSTRING_SIZE_ERR        = 2;
       
    78     /**
       
    79      * If any <code>Node</code> is inserted somewhere it doesn't belong.
       
    80      */
       
    81     public static final short HIERARCHY_REQUEST_ERR     = 3;
       
    82     /**
       
    83      * If a <code>Node</code> is used in a different document than the one
       
    84      * that created it (that doesn't support it).
       
    85      */
       
    86     public static final short WRONG_DOCUMENT_ERR        = 4;
       
    87     /**
       
    88      * If an invalid or illegal character is specified, such as in an XML name.
       
    89      */
       
    90     public static final short INVALID_CHARACTER_ERR     = 5;
       
    91     /**
       
    92      * If data is specified for a <code>Node</code> which does not support
       
    93      * data.
       
    94      */
       
    95     public static final short NO_DATA_ALLOWED_ERR       = 6;
       
    96     /**
       
    97      * If an attempt is made to modify an object where modifications are not
       
    98      * allowed.
       
    99      */
       
   100     public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
       
   101     /**
       
   102      * If an attempt is made to reference a <code>Node</code> in a context
       
   103      * where it does not exist.
       
   104      */
       
   105     public static final short NOT_FOUND_ERR             = 8;
       
   106     /**
       
   107      * If the implementation does not support the requested type of object or
       
   108      * operation.
       
   109      */
       
   110     public static final short NOT_SUPPORTED_ERR         = 9;
       
   111     /**
       
   112      * If an attempt is made to add an attribute that is already in use
       
   113      * elsewhere.
       
   114      */
       
   115     public static final short INUSE_ATTRIBUTE_ERR       = 10;
       
   116     /**
       
   117      * If an attempt is made to use an object that is not, or is no longer,
       
   118      * usable.
       
   119      * @since DOM Level 2
       
   120      */
       
   121     public static final short INVALID_STATE_ERR         = 11;
       
   122     /**
       
   123      * If an invalid or illegal string is specified.
       
   124      * @since DOM Level 2
       
   125      */
       
   126     public static final short SYNTAX_ERR                = 12;
       
   127     /**
       
   128      * If an attempt is made to modify the type of the underlying object.
       
   129      * @since DOM Level 2
       
   130      */
       
   131     public static final short INVALID_MODIFICATION_ERR  = 13;
       
   132     /**
       
   133      * If an attempt is made to create or change an object in a way which is
       
   134      * incorrect with regard to namespaces.
       
   135      * @since DOM Level 2
       
   136      */
       
   137     public static final short NAMESPACE_ERR             = 14;
       
   138     /**
       
   139      * If a parameter or an operation is not supported by the underlying
       
   140      * object.
       
   141      * @since DOM Level 2
       
   142      */
       
   143     public static final short INVALID_ACCESS_ERR        = 15;
       
   144     /**
       
   145      * If a call to a method such as <code>insertBefore</code> or
       
   146      * <code>removeChild</code> would make the <code>Node</code> invalid
       
   147      * with respect to "partial validity", this exception would be raised
       
   148      * 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>]
       
   149      * . Refer to this specification for further information.
       
   150      * @since DOM Level 3
       
   151      */
       
   152     public static final short VALIDATION_ERR            = 16;
       
   153     /**
       
   154      *  If the type of an object is incompatible with the expected type of the
       
   155      * parameter associated to the object.
       
   156      * @since DOM Level 3
       
   157      */
       
   158     public static final short TYPE_MISMATCH_ERR         = 17;
       
   159 
       
   160     // Added serialVersionUID to preserve binary compatibility
       
   161     static final long serialVersionUID = 6627732366795969916L;
       
   162 }