Actions
Bug #6091
closedNPE in ContextStackIterator.getMajorCaller with Saxon 12
Start date:
2023-06-23
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java
Description
We have some code like this:
protected void attachXSLTStackTrace(TransformerException e, XSLTransformerValidationDPI errorDpi) {
if (e instanceof XPathException) {
XPathException xPathException = (XPathException) e;
XPathContext context = xPathException.getXPathContext();
if (context != null) {
Iterator<ContextStackFrame> iterator = new ContextStackIterator(context);
final StringWriter sw = new StringWriter();
while (iterator.hasNext()) {
ContextStackFrame frame = iterator.next();
frame.print(new net.sf.saxon.lib.Logger() {
@Override
public void println(String message, int severity) {
sw.write(message + "\n");
}
@Override
public StreamResult asStreamResult() {
return new StreamResult(sw);
}
});
}
String entireStackTrace = sw.toString();
if(entireStackTrace.length() > 0){
errorDpi.setDetailedExceptionInfo(new DetailedExceptionInfo("XSLT Stack Trace:\n" + entireStackTrace, null, e.getMessage()));
}
}
}
}
called when we get a falal error from Saxon and now we have a nullpointerexception here with Saxon 12:
java.lang.NullPointerException: null
at net.sf.saxon.trace.ContextStackIterator.getMajorCaller(ContextStackIterator.java:147)
at net.sf.saxon.trace.ContextStackIterator.next(ContextStackIterator.java:79)
at net.sf.saxon.trace.ContextStackIterator.next(ContextStackIterator.java:24)
at ro.sync.xml.transformer.DPIErrorListener.attachXSLTStackTrace(DPIErrorListener.java:438)
at ro.sync.xml.transformer.DPIErrorListener.addError(DPIErrorListener.java:399)
at ro.sync.dxsl.debugger.TrAXErrorListener.addError(TrAXErrorListener.java:78)
at ro.sync.xml.transformer.DPIErrorListener.fatalError(DPIErrorListener.java:358)
at net.sf.saxon.lib.ErrorReporterToListener.report(ErrorReporterToListener.java:68)
at net.sf.saxon.Controller.reportFatalError(Controller.java:444)
at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:700)
Can we prohibit this in some way?
Please register to edit this issue
Actions