changeset 5442:9575264f801d

Only create one FunctionResolver per BuildHelper. Creatin new ones over and over again is excessive.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 26 Mar 2013 21:55:23 +0100
parents 7c1dd9c3f6bd
children 3d7e552cc396
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Tue Mar 26 19:29:39 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Tue Mar 26 21:55:23 2013 +0100
@@ -94,6 +94,7 @@
         protected Map<String, CompiledStatement.Instance>  statements;
         protected Deque<Pair<NamedConnection, ResultData>> connectionsStack;
         protected Deque<NodeList>                          macroBodies;
+        protected FunctionResolver                         functionResolver;
 
         public BuildHelper(
             Node                  output,
@@ -113,6 +114,7 @@
             statements =
                 new HashMap<String, CompiledStatement.Instance>();
             macroBodies = new ArrayDeque<NodeList>();
+            functionResolver = new FunctionResolver(this);
         }
 
         public void build() throws SQLException {
@@ -547,7 +549,7 @@
             try {
                 XPath xpath = XPATH_FACTORY.newXPath();
                 xpath.setXPathVariableResolver(frames);
-                xpath.setXPathFunctionResolver(new FunctionResolver(this));
+                xpath.setXPathFunctionResolver(functionResolver);
                 return xpath.evaluate(expr, EVAL_DOCUMENT, returnType);
             }
             catch (XPathExpressionException xpee) {

http://dive4elements.wald.intevation.org