325N/A/**
325N/A * Copyright (c) 2001, Thai Open Source Software Center Ltd
325N/A * All rights reserved.
325N/A *
325N/A * Redistribution and use in source and binary forms, with or without
325N/A * modification, are permitted provided that the following conditions are
325N/A * met:
325N/A *
325N/A * Redistributions of source code must retain the above copyright
325N/A * notice, this list of conditions and the following disclaimer.
325N/A *
325N/A * Redistributions in binary form must reproduce the above copyright
325N/A * notice, this list of conditions and the following disclaimer in
325N/A * the documentation and/or other materials provided with the
325N/A * distribution.
325N/A *
325N/A * Neither the name of the Thai Open Source Software Center Ltd nor
325N/A * the names of its contributors may be used to endorse or promote
325N/A * products derived from this software without specific prior written
325N/A * permission.
325N/A *
325N/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
325N/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
325N/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
325N/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
325N/A * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
325N/A * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
325N/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
325N/A * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
325N/A * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
325N/A * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
325N/A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
325N/A */
325N/Apackage org.relaxng.datatype;
325N/A
325N/A/**
325N/A * Signals Datatype related exceptions.
325N/A *
325N/A * @author <a href="mailto:jjc@jclark.com">James Clark</a>
325N/A * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
325N/A */
325N/Apublic class DatatypeException extends Exception {
325N/A
325N/A public DatatypeException( int index, String msg ) {
325N/A super(msg);
325N/A this.index = index;
325N/A }
325N/A public DatatypeException( String msg ) {
325N/A this(UNKNOWN,msg);
325N/A }
325N/A /**
325N/A * A constructor for those datatype libraries which don't support any
325N/A * diagnostic information at all.
325N/A */
325N/A public DatatypeException() {
325N/A this(UNKNOWN,null);
325N/A }
325N/A
325N/A
325N/A private final int index;
325N/A
325N/A public static final int UNKNOWN = -1;
325N/A
325N/A /**
325N/A * Gets the index of the content where the error occured.
325N/A * UNKNOWN can be returned to indicate that no index information
325N/A * is available.
325N/A */
325N/A public int getIndex() {
325N/A return index;
325N/A }
325N/A}