From e2ecc02a7c44ad41ca04f22c07b1a910a4ed9606 Mon Sep 17 00:00:00 2001 From: Khaled Yakdan Date: Wed, 19 Oct 2022 06:45:50 +0200 Subject: [PATCH] Convert the restricted classes into a Set --- .../java/org/apache/commons/jxpath/ri/JXPathFilter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java b/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java index 18b0a1f29..3192f85b8 100644 --- a/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java +++ b/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java @@ -16,8 +16,9 @@ */ package org.apache.commons.jxpath.ri; -import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; /** * A filter to be used by JXPath, to evaluate the xpath string values to impose any restrictions. @@ -29,7 +30,7 @@ * @version $Revision$ $Date$ */ public class JXPathFilter implements JXPathClassFilter { - ArrayList allowedClassesList = null; + Set allowedClassesList = null; public JXPathFilter() { init(); @@ -39,7 +40,7 @@ public void init() { String restrictedClasses = System.getProperty("jxpath.class.allow"); allowedClassesList = null; if ((restrictedClasses != null) && (restrictedClasses.trim().length() > 0)) { - allowedClassesList = new ArrayList<>(); + allowedClassesList = new HashSet<>(); allowedClassesList.addAll(Arrays.asList(restrictedClasses.split(","))); } }