[java-metadata-aggregator] branch master updated: Use type-safe XPath evaluation

Ian Young ian at iay.org.uk
Fri Mar 13 12:21:51 EDT 2020


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch master
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=abd15a49a2cd1b530dab7581cfe99bf956b50ddf

The following commit(s) were added to refs/heads/master by this push:
       new  abd15a4   Use type-safe XPath evaluation
abd15a4 is described below

commit abd15a49a2cd1b530dab7581cfe99bf956b50ddf
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Mar 13 16:21:48 2020 +0000

    Use type-safe XPath evaluation
---
 .../shibboleth/metadata/dom/XPathItemSelectionStrategy.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
index 56c53e4..ce3277a 100644
--- a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
+++ b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XPathItemSelectionStrategy.java
@@ -23,19 +23,18 @@ import javax.annotation.Nonnull;
 import javax.annotation.concurrent.ThreadSafe;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
-import net.shibboleth.metadata.Item;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.xml.SimpleNamespaceContext;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
 
+import net.shibboleth.metadata.Item;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.xml.SimpleNamespaceContext;
+
 /**
  * Item selection strategy which selects items on the basis of a boolean XPath expression.
  */
@@ -82,7 +81,7 @@ public class XPathItemSelectionStrategy implements Predicate<Item<Element>> {
     @Override
     public synchronized boolean test(@Nonnull final Item<Element> item) {
         try {
-            return (Boolean) compiledExpression.evaluate(item.unwrap(), XPathConstants.BOOLEAN);
+            return compiledExpression.evaluateExpression(item.unwrap(), Boolean.class);
         } catch (final XPathExpressionException e) {
             log.warn("Exception thrown during XPath evaluation: " + e);
             return false;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list