You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/01/13 10:23:18 UTC

incubator-freemarker git commit: Rather don't cache the sibling nodes in NodeModel; they are usually only traversed once

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 6f1a92214 -> 18f786673


Rather don't cache the sibling nodes in NodeModel; they are usually only traversed once


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/18f78667
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/18f78667
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/18f78667

Branch: refs/heads/2.3-gae
Commit: 18f7866737919f1c458350672e10cd1fdacc3ac5
Parents: 6f1a922
Author: ddekany <dd...@apache.org>
Authored: Fri Jan 13 11:23:10 2017 +0100
Committer: ddekany <dd...@apache.org>
Committed: Fri Jan 13 11:23:10 2017 +0100

----------------------------------------------------------------------
 src/main/java/freemarker/ext/dom/NodeModel.java | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18f78667/src/main/java/freemarker/ext/dom/NodeModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/ext/dom/NodeModel.java b/src/main/java/freemarker/ext/dom/NodeModel.java
index 5e59a89..ea96bac 100644
--- a/src/main/java/freemarker/ext/dom/NodeModel.java
+++ b/src/main/java/freemarker/ext/dom/NodeModel.java
@@ -110,8 +110,6 @@ implements TemplateNodeModelEx, TemplateHashModel, TemplateSequenceModel,
     final Node node;
     private TemplateSequenceModel children;
     private NodeModel parent;
-    private NodeModel previousSibling;
-    private NodeModel nextSibling;
     
     /**
      * Sets the DOM Parser implementation to be used when building NodeModel
@@ -316,19 +314,11 @@ implements TemplateNodeModelEx, TemplateHashModel, TemplateSequenceModel,
     }
 
     public TemplateNodeModelEx getPreviousSibling() throws TemplateModelException {
-        if (previousSibling == null) {
-            Node previous = node.getPreviousSibling();
-            previousSibling = wrap(previous);
-        }
-        return previousSibling;
+        return wrap(node.getPreviousSibling());
     }
 
     public TemplateNodeModelEx getNextSibling() throws TemplateModelException {
-        if (nextSibling == null) {
-            Node next = node.getNextSibling();
-            nextSibling = wrap(next);
-        }
-        return nextSibling;
+        return wrap(node.getNextSibling());
     }
 
     public TemplateSequenceModel getChildNodes() {