EOL support for JRuby (#6209)

This commit is contained in:
Basil Crow authored and GitHub committed 2022-01-27 16:56:22 +00:00
1 parent 58cf6fc0df
commit adf23ab2e4
2 files changed
-31

No files matched your search

@@ -81,7 +81,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import jenkins.model.Jenkins;
import jenkins.util.xstream.SafeURLConverter;
@@ -570,18 +569,12 @@ public class XStream2 extends XStream {
throw new ConversionException("Refusing to unmarshal " + reader.getNodeName() + " for security reasons; see https://www.jenkins.io/redirect/class-filter/");
}
/** TODO see comment in {@code whitelisted-classes.txt} */
private static final Pattern JRUBY_PROXY = Pattern.compile("org[.]jruby[.]proxy[.].+[$]Proxy\\d+");
@Override
public boolean canConvert(Class type) {
if (type == null) {
return false;
}
String name = type.getName();
if (JRUBY_PROXY.matcher(name).matches()) {
return false;
}
// claim we can convert all the scary stuff so we can throw exceptions when attempting to do so
return ClassFilter.DEFAULT.isBlacklisted(name) || ClassFilter.DEFAULT.isBlacklisted(type);
}