diff --git a/src/main/java/org/apache/commons/jxpath/ri/JXPathClassFilter.java b/src/main/java/org/apache/commons/jxpath/ri/JXPathClassFilter.java index d5a37f3b1..1367bf40b 100644 --- a/src/main/java/org/apache/commons/jxpath/ri/JXPathClassFilter.java +++ b/src/main/java/org/apache/commons/jxpath/ri/JXPathClassFilter.java @@ -37,5 +37,5 @@ public interface JXPathClassFilter { * passed. * @return true if the java class can be exposed via xpath, false otherwise */ - public boolean exposeToXPath(String className); + boolean exposeToXPath(String className); } 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 3192f85b8..bba8d900e 100644 --- a/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java +++ b/src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java @@ -30,7 +30,7 @@ * @version $Revision$ $Date$ */ public class JXPathFilter implements JXPathClassFilter { - Set allowedClassesList = null; + private Set allowedClassesList = null; public JXPathFilter() { init(); @@ -39,7 +39,7 @@ public JXPathFilter() { public void init() { String restrictedClasses = System.getProperty("jxpath.class.allow"); allowedClassesList = null; - if ((restrictedClasses != null) && (restrictedClasses.trim().length() > 0)) { + if (restrictedClasses != null && restrictedClasses.trim().length() > 0) { allowedClassesList = new HashSet<>(); allowedClassesList.addAll(Arrays.asList(restrictedClasses.split(","))); } @@ -54,15 +54,11 @@ public void init() { */ @Override public boolean exposeToXPath(String className) { - if ((allowedClassesList == null) || (allowedClassesList.size() < 1)) { + if (allowedClassesList == null || allowedClassesList.size() < 1) { return false; } - if (allowedClassesList.contains(className) || allowedClassesList.contains("*")) { - return true; - } - - return false; + return allowedClassesList.contains(className) || allowedClassesList.contains("*"); } }