[Dive4elements-commits] [PATCH 1 of 2] Only create one FunctionResolver per BuildHelper. Creatin new ones over and over again is excessive

Wald Commits scm-commit at wald.intevation.org
Tue Mar 26 22:30:06 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1364331323 -3600
# Node ID 9575264f801da4a1d91545f8da18ee5aae1d15f9
# Parent  7c1dd9c3f6bd132d963111fe9acea017de511b2e
Only create one FunctionResolver per BuildHelper. Creatin new ones over and over again is excessive.

diff -r 7c1dd9c3f6bd -r 9575264f801d flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java
--- 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) {


More information about the Dive4elements-commits mailing list