Skip to content

Commit

Permalink
Adapted ExpressionUtils code back to JDK 6
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfernandez committed Jan 25, 2022
1 parent 0685b3d commit 7c6a3d5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/org/thymeleaf/util/ExpressionUtils.java
Expand Up @@ -20,12 +20,12 @@

package org.thymeleaf.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public final class ExpressionUtils {

Expand Down Expand Up @@ -75,13 +75,19 @@ public static boolean isTypeAllowed(final String typeName) {


public static List<String> getBlacklist() {
return BLACKLISTED_CLASS_NAME_PREFIXES.stream()
.sorted().map(p -> String.format("%s.*", p)).collect(Collectors.toList());
final List<String> blacklist = new ArrayList<String>();
for (final String prefix : BLACKLISTED_CLASS_NAME_PREFIXES) {
blacklist.add(String.format("%s.*", prefix));
}
return blacklist;
}

public static List<String> getWhitelist() {
return Stream.concat(WHITELISTED_JAVA_CLASS_NAMES.stream(), Stream.of("java.time.*"))
.sorted().collect(Collectors.toList());
final List<String> whitelist = new ArrayList<String>();
whitelist.addAll(WHITELISTED_JAVA_CLASS_NAMES);
whitelist.add("java.time.*");
Collections.sort(whitelist);
return whitelist;
}


Expand Down

0 comments on commit 7c6a3d5

Please sign in to comment.