Constructors Summary |
---|
public XPathException(String message, ExpressionNode ex)Create an XPathException object that holds
an error message.
super(message);
this.setLocator(ex);
setStylesheetNode(getStylesheetNode(ex));
|
public XPathException(String message)Create an XPathException object that holds
an error message.
super(message);
|
public XPathException(String message, Object styleNode)Create an XPathException object that holds
an error message and the stylesheet node that
the error originated from.
super(message);
m_styleNode = styleNode;
|
public XPathException(String message, Node styleNode, Exception e)Create an XPathException object that holds
an error message, the stylesheet node that
the error originated from, and another exception
that caused this exception.
super(message);
m_styleNode = styleNode;
this.m_exception = e;
|
public XPathException(String message, Exception e)Create an XPathException object that holds
an error message, and another exception
that caused this exception.
super(message);
this.m_exception = e;
|
Methods Summary |
---|
public java.lang.Throwable | getException()Return the embedded exception, if any.
Overrides javax.xml.transform.TransformerException.getException().
return m_exception;
|
protected com.sun.org.apache.xpath.internal.ExpressionNode | getExpressionOwner(com.sun.org.apache.xpath.internal.ExpressionNode ex)Get the first non-Expression parent of this node.
ExpressionNode parent = ex.exprGetParent();
while((null != parent) && (parent instanceof Expression))
parent = parent.exprGetParent();
return parent;
|
public java.lang.String | getMessage()Find the most contained message.
String lastMessage = super.getMessage();
Throwable exception = m_exception;
while (null != exception)
{
String nextMessage = exception.getMessage();
if (null != nextMessage)
lastMessage = nextMessage;
if (exception instanceof TransformerException)
{
TransformerException se = (TransformerException) exception;
Throwable prev = exception;
exception = se.getException();
if (prev == exception)
break;
}
else
{
exception = null;
}
}
return (null != lastMessage) ? lastMessage : "";
|
public java.lang.Object | getStylesheetNode()Get the stylesheet node from where this error originated.
return m_styleNode;
|
public org.w3c.dom.Node | getStylesheetNode(com.sun.org.apache.xpath.internal.ExpressionNode ex)Get the XSLT ElemVariable that this sub-expression references. In order for
this to work, the SourceLocator must be the owning ElemTemplateElement.
ExpressionNode owner = getExpressionOwner(ex);
if (null != owner && owner instanceof org.w3c.dom.Node)
{
return ((org.w3c.dom.Node)owner);
}
return null;
|
public void | printStackTrace(java.io.PrintStream s)Print the the trace of methods from where the error
originated. This will trace all nested exception
objects, as well as this object.
if (s == null)
s = System.err;
try
{
super.printStackTrace(s);
}
catch (Exception e){}
Throwable exception = m_exception;
for (int i = 0; (i < 10) && (null != exception); i++)
{
s.println("---------");
exception.printStackTrace(s);
if (exception instanceof TransformerException)
{
TransformerException se = (TransformerException) exception;
Throwable prev = exception;
exception = se.getException();
if (prev == exception)
break;
}
else
{
exception = null;
}
}
|
public void | printStackTrace(java.io.PrintWriter s)Print the the trace of methods from where the error
originated. This will trace all nested exception
objects, as well as this object.
if (s == null)
s = new java.io.PrintWriter(System.err);
try
{
super.printStackTrace(s);
}
catch (Exception e){}
boolean isJdk14OrHigher = false;
try {
Throwable.class.getMethod("getCause", (Class[]) null);
isJdk14OrHigher = true;
} catch (NoSuchMethodException nsme) {
// do nothing
}
// The printStackTrace method of the Throwable class in jdk 1.4
// and higher will include the cause when printing the backtrace.
// The following code is only required when using jdk 1.3 or lower
if (!isJdk14OrHigher) {
Throwable exception = m_exception;
for (int i = 0; (i < 10) && (null != exception); i++)
{
s.println("---------");
try
{
exception.printStackTrace(s);
}
catch (Exception e)
{
s.println("Could not print stack trace...");
}
if (exception instanceof TransformerException)
{
TransformerException se = (TransformerException) exception;
Throwable prev = exception;
exception = se.getException();
if (prev == exception)
{
exception = null;
break;
}
}
else
{
exception = null;
}
}
}
|
public void | setStylesheetNode(java.lang.Object styleNode)Set the stylesheet node from where this error originated.
m_styleNode = styleNode;
|