Skip to content

Commit

Permalink
Part of fix for Jira issue XALANJ-2375.
Browse files Browse the repository at this point in the history
Added a new constructor and corresponding reset method that allow the caller
to specify the initial size for the arrays contained in a VariableStack.  This
is important for XPath expression evaluation, where additional stack entries
are never needed.  Previously, the arrays were always allocated based on the
maximum recursion depth permitted by the XSLT processor, which was caused
unnecessary initialization overhead using the various XPath APIs.

Also added two new XPathContext constructors which accept a boolean argument
that indicates whether the context for variables needs to be push/popable.
When it's false, the XPathContext will create a minimally-sized VariableStack.

Reviewed by Christine Li (jycli () ca ! ibm ! com).


git-svn-id: https://svn.apache.org/repos/asf/xalan/java/trunk@524814 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Henry Zongaro committed Apr 2, 2007
1 parent 118e732 commit 8ff1ceb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/apache/xpath/jaxp/XPathImpl.java
Expand Up @@ -195,12 +195,16 @@ private XObject eval(String expression, Object contextItem)
org.apache.xpath.XPath xpath = new org.apache.xpath.XPath( expression,
null, prefixResolver, org.apache.xpath.XPath.SELECT );
org.apache.xpath.XPathContext xpathSupport = null;

// Create an XPathContext that doesn't support pushing and popping of
// variable resolution scopes. Sufficient for simple XPath 1.0
// expressions.
if ( functionResolver != null ) {
JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
functionResolver, featureSecureProcessing );
xpathSupport = new org.apache.xpath.XPathContext( jep );
xpathSupport = new org.apache.xpath.XPathContext(jep, false);
} else {
xpathSupport = new org.apache.xpath.XPathContext();
xpathSupport = new org.apache.xpath.XPathContext(false);
}

XObject xobj = null;
Expand Down

0 comments on commit 8ff1ceb

Please sign in to comment.