156 lines
4.6 KiB
Java
156 lines
4.6 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (the "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Communities System.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.util.xml;
|
|
|
|
import org.w3c.dom.*;
|
|
|
|
/**
|
|
* An exception type thrown by the {@link com.silverwrist.util.xml.XMLLoader XMLLoader} when it encounters
|
|
* a parse error, value error, or other erroneous condition. It contains a reference to the node in the DOM
|
|
* tree where the error occured, if such is possible to determine.
|
|
*
|
|
* @author Eric J. Bowersox <erbo@silcom.com>
|
|
* @version X
|
|
*/
|
|
public class XMLLoadException extends Exception
|
|
{
|
|
/*--------------------------------------------------------------------------------
|
|
* Attributes
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
private Node m_locus = null; // locus of the error
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Constructors
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*/
|
|
public XMLLoadException()
|
|
{
|
|
super();
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param msg The error message to be thrown.
|
|
*/
|
|
public XMLLoadException(String msg)
|
|
{
|
|
super(msg);
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param inner The exception wrapped by this <CODE>XMLLoadException</CODE>.
|
|
*/
|
|
public XMLLoadException(Throwable inner)
|
|
{
|
|
super(inner);
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param msg The error message to be thrown.
|
|
* @param inner The exception wrapped by this <CODE>XMLLoadException</CODE>.
|
|
*/
|
|
public XMLLoadException(String msg, Throwable inner)
|
|
{
|
|
super(msg,inner);
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param locus The <CODE>Node</CODE> in the DOM tree where the error occurred.
|
|
*/
|
|
public XMLLoadException(Node locus)
|
|
{
|
|
super("Error in <" + locus.getNodeName() + "/> section of input");
|
|
m_locus = locus;
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param msg The error message to be thrown.
|
|
* @param locus The <CODE>Node</CODE> in the DOM tree where the error occurred.
|
|
*/
|
|
public XMLLoadException(String msg, Node locus)
|
|
{
|
|
super("Error in <" + locus.getNodeName() + "/> section of input - " + msg);
|
|
m_locus = locus;
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param inner The exception wrapped by this <CODE>XMLLoadException</CODE>.
|
|
* @param locus The <CODE>Node</CODE> in the DOM tree where the error occurred.
|
|
*/
|
|
public XMLLoadException(Throwable inner, Node locus)
|
|
{
|
|
super("Error in <" + locus.getNodeName() + "/> section of input - " + inner.getMessage(),inner);
|
|
m_locus = locus;
|
|
|
|
} // end constructor
|
|
|
|
/**
|
|
* Constructs a new <CODE>XMLLoadException</CODE>.
|
|
*
|
|
* @param msg The error message to be thrown.
|
|
* @param inner The exception wrapped by this <CODE>XMLLoadException</CODE>.
|
|
* @param locus The <CODE>Node</CODE> in the DOM tree where the error occurred.
|
|
*/
|
|
public XMLLoadException(String msg, Throwable inner, Node locus)
|
|
{
|
|
super("Error in <" + locus.getNodeName() + "/> section of input - " + msg,inner);
|
|
m_locus = locus;
|
|
|
|
} // end constructor
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* External operations
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
/**
|
|
* Returns the locus of the error contained in this exception.
|
|
*
|
|
* @return The <CODE>Node</CODE> that indicates wherre in the DOM tree the error occurred.
|
|
*/
|
|
public Node getLocus()
|
|
{
|
|
return m_locus;
|
|
|
|
} // end getLocus
|
|
|
|
} // end class XMLLoadException
|