Skip to content

Commit

Permalink
Avoid NPE with getConfiguration().getProcessor()
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Jun 18, 2024
1 parent 2c5a54a commit 411cb2e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

package org.expath.tools.saxon.model;

import net.sf.saxon.Configuration;
import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.s9api.BuildingStreamWriter;
Expand All @@ -28,13 +29,17 @@
public class SaxonTreeBuilder
implements TreeBuilder
{
public SaxonTreeBuilder(XPathContext ctxt, String prefix, String ns)
public SaxonTreeBuilder(XPathContext context, String prefix, String ns)
throws ToolsException
{
myNs = ns;
myPrefix = prefix;
try {
Processor processor = (Processor) ctxt.getConfiguration().getProcessor();
final Configuration configuration = context.getConfiguration();
Processor processor = (Processor) configuration.getProcessor();
if (processor == null) {
processor = new Processor(configuration);
}
DocumentBuilder builder = processor.newDocumentBuilder();
writer = builder.newBuildingStreamWriter();
writer.writeStartDocument();
Expand Down

0 comments on commit 411cb2e

Please sign in to comment.