AdGuard v4.4.135版本的 MD5 值为:95950267eaafbda3588f0934f48b2e36
以下内容为反编译后的 DOMDeserializer.java 源代码,内容仅作参考
package com.fasterxml.jackson.databind.ext;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.FromStringDeserializer;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
public abstract class DOMDeserializer<T> extends FromStringDeserializer<T> {
private static final DocumentBuilderFactory DEFAULT_PARSER_FACTORY;
private static final long serialVersionUID = 1;
public static class DocumentDeserializer extends DOMDeserializer<Document> {
private static final long serialVersionUID = 1;
public DocumentDeserializer() {
super(Document.class);
}
@Override
public Document _deserialize(String str, DeserializationContext deserializationContext) {
return parse(str);
}
}
public static class NodeDeserializer extends DOMDeserializer<Node> {
private static final long serialVersionUID = 1;
public NodeDeserializer() {
super(Node.class);
}
@Override
public Node _deserialize(String str, DeserializationContext deserializationContext) {
return parse(str);
}
}
static {
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
newInstance.setNamespaceAware(true);
newInstance.setExpandEntityReferences(false);
try {
newInstance.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true);
} catch (Error | ParserConfigurationException unused) {
}
try {
newInstance.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (Throwable unused2) {
}
try {
newInstance.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
} catch (Throwable unused3) {
}
DEFAULT_PARSER_FACTORY = newInstance;
}
public DOMDeserializer(Class<T> cls) {
super(cls);
}
@Override
public abstract T _deserialize(String str, DeserializationContext deserializationContext);
public DocumentBuilder documentBuilder() {
return DEFAULT_PARSER_FACTORY.newDocumentBuilder();
}
public final Document parse(String str) {
try {
return documentBuilder().parse(new InputSource(new StringReader(str)));
} catch (Exception e10) {
throw new IllegalArgumentException("Failed to parse JSON String as XML: " + e10.getMessage(), e10);
}
}
}