freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject freemarker git commit: Forward ported from 2.3-gae: FREEMARKER-104: In log and error messages due to no XPath implementation available, recommend adding Apache Xalan or Jaxen as dependency.
Date Wed, 26 Sep 2018 22:16:25 GMT
Repository: freemarker
Updated Branches:
  refs/heads/3 87e9359af -> a48b939f6


Forward ported from 2.3-gae: FREEMARKER-104: In log and error messages due to no XPath implementation
available, recommend adding Apache Xalan or Jaxen as dependency.


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

Branch: refs/heads/3
Commit: a48b939f6bf1faa48bb09be2dfb1ee486550a464
Parents: 87e9359
Author: ddekany <ddekany@apache.org>
Authored: Thu Sep 27 00:16:20 2018 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Thu Sep 27 00:16:20 2018 +0200

----------------------------------------------------------------------
 .../java/org/apache/freemarker/dom/NodeListModel.java    |  4 ++--
 .../main/java/org/apache/freemarker/dom/NodeModel.java   | 11 +++++------
 2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/freemarker/blob/a48b939f/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
index 35c5bc1..b3a59c4 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeListModel.java
@@ -158,8 +158,8 @@ class NodeListModel extends SimpleSequence implements TemplateHashModel,
_Unexpe
         XPathSupport xps = getXPathSupport();
         if (xps == null) {
             throw new TemplateException(
-                    "Can't try to resolve the XML query key, because no XPath support is
available. "
-                    + "This is either malformed or an XPath expression: " + key);
+                    "No XPath support is available (add Apache Xalan or Jaxen as dependency).
"
+                    + "This is either malformed, or an XPath expression: " + key);
         }
         Object context = (size == 0) ? null : rawNodeList();
         return xps.executeQuery(context, key);

http://git-wip-us.apache.org/repos/asf/freemarker/blob/a48b939f/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
----------------------------------------------------------------------
diff --git a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
index 356a852..3a92f7f 100644
--- a/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
+++ b/freemarker-dom/src/main/java/org/apache/freemarker/dom/NodeModel.java
@@ -88,7 +88,7 @@ abstract public class NodeModel implements TemplateNodeModelEx, TemplateHashMode
             // do nothing
         }
         if (xpathSupportClass == null && LOG.isWarnEnabled()) {
-            LOG.warn("No XPath support is available.");
+            LOG.warn("No XPath support is available. If you need it, add Apache Xalan or
Jaxen as dependency.");
         }
     }
     
@@ -149,13 +149,12 @@ abstract public class NodeModel implements TemplateNodeModelEx, TemplateHashMode
             }
         } else {
             XPathSupport xps = getXPathSupport();
-            if (xps != null) {
-                return xps.executeQuery(node, key);
-            } else {
+            if (xps == null) {
                 throw new TemplateException(
-                        "Can't try to resolve the XML query key, because no XPath support
is available. "
-                        + "This is either malformed or an XPath expression: " + key);
+                        "No XPath support is available (add Apache Xalan or Jaxen as dependency).
"
+                        + "This is either malformed, or an XPath expression: " + key);
             }
+            return xps.executeQuery(node, key);
         }
     }
     


Mime
View raw message