Skip to content

Commit

Permalink
Convert the restricted classes into a Set
Browse files Browse the repository at this point in the history
  • Loading branch information
kyakdan committed Oct 19, 2022
1 parent a50b979 commit e2ecc02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -29,7 +30,7 @@
* @version $Revision$ $Date$
*/
public class JXPathFilter implements JXPathClassFilter {
ArrayList<String> allowedClassesList = null;
Set<String> allowedClassesList = null;

public JXPathFilter() {
init();
Expand All @@ -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(",")));
}
}
Expand Down

0 comments on commit e2ecc02

Please sign in to comment.