Skip to content

Commit

Permalink
Minor refactoring and clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
kyakdan committed Oct 19, 2022
1 parent 603a2cd commit d82787b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
* If this property is not set, it exposes no java classes
* Ex: jxpath.class.allow=java.lang.Runtime will allow exposing java.lang.Runtime class via xpath, while all other
* classes will be not exposed. You can use the wildcard (*) to allow all classes.
*
* @author bhmohanr-techie
* @version $Revision$ $Date$
* @since 1.4
*/
public interface JXPathClassFilter {

Expand Down
11 changes: 3 additions & 8 deletions src/main/java/org/apache/commons/jxpath/ri/JXPathFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
* This class implements specific filter interfaces, and implements methods in those.
* For instance, it JXPathClassFilter interface, which is used to check if any restricted java classes are passed via xpath
* JXPath uses this filter instance when an extension function instance is created.
*
* @author bhmohanr-techie
* @version $Revision$ $Date$
*/
public class JXPathFilter implements JXPathClassFilter {
private Set<String> allowedClassesList = null;
Expand All @@ -37,11 +34,10 @@ public JXPathFilter() {
}

public void init() {
String restrictedClasses = System.getProperty("jxpath.class.allow");
allowedClassesList = null;
if (restrictedClasses != null && restrictedClasses.trim().length() > 0) {
final String allowedClasses = System.getProperty("jxpath.class.allow");
if (allowedClasses != null && !allowedClasses.isEmpty()) {
allowedClassesList = new HashSet<>();
allowedClassesList.addAll(Arrays.asList(restrictedClasses.split(",")));
allowedClassesList.addAll(Arrays.asList(allowedClasses.split(",")));
}
}

Expand All @@ -61,4 +57,3 @@ public boolean exposeToXPath(String className) {
return allowedClassesList.contains(className) || allowedClassesList.contains("*");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@
*/
package org.apache.commons.jxpath.ri.compiler;

import org.apache.commons.jxpath.Functions;
import org.apache.commons.jxpath.JXPathContext;

import java.util.*;

/**
* A test class with few methods, with different argument list
*
* @author bhmohanr-techie
* @version $Revision$ $Date$
*/
public final class TestFunctions3 {

Expand All @@ -52,4 +44,4 @@ public String testFunction3Method3(String str1, String str2) {
return "testFunction3Method3:" + str1 + ":" + str2;
}

}
}

0 comments on commit d82787b

Please sign in to comment.