File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/io/serialization Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 */
3737public class ObjectStreamClassPredicate implements Predicate <ObjectStreamClass > {
3838
39- // This is not a Set for now to avoid ClassNameMatchers requiring proper implementations of hashCode() and equals().
39+ /**
40+ * This is not a Set for now to avoid ClassNameMatchers requiring proper implementations of hashCode() and equals().
41+ */
4042 private final List <ClassNameMatcher > acceptMatchers = new ArrayList <>();
4143
42- // This is not a Set for now to avoid ClassNameMatchers requiring proper implementations of hashCode() and equals().
44+ /**
45+ * This is not a Set for now to avoid ClassNameMatchers requiring proper implementations of hashCode() and equals().
46+ */
4347 private final List <ClassNameMatcher > rejectMatchers = new ArrayList <>();
4448
4549 /**
@@ -188,17 +192,8 @@ public boolean test(final ObjectStreamClass objectStreamClass) {
188192 */
189193 public boolean test (final String name ) {
190194 // The reject list takes precedence over the accept list.
191- for (final ClassNameMatcher m : rejectMatchers ) {
192- if (m .matches (name )) {
193- return false ;
194- }
195- }
196- for (final ClassNameMatcher m : acceptMatchers ) {
197- if (m .matches (name )) {
198- return true ;
199- }
200- }
201- return false ;
195+ final Predicate <ClassNameMatcher > p = m -> m .matches (name );
196+ return rejectMatchers .stream ().noneMatch (p ) && acceptMatchers .stream ().anyMatch (p );
202197 }
203198
204199}
You can’t perform that action at this time.
0 commit comments