CustomExternalEntityResolver.java
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.fd.forms.internal.utils;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class CustomExternalEntityResolver
implements EntityResolver {
private boolean resolveExternalEntitiesFlag;
private boolean isExternalEntityPresent;
private CustomExternalEntityResolver(boolean resolveExternalEntitiesFlag) {
this.resolveExternalEntitiesFlag = resolveExternalEntitiesFlag;
}
public static CustomExternalEntityResolver valueOf(boolean b) {
return b ? new CustomExternalEntityResolver(true) : new CustomExternalEntityResolver(false);
}
public boolean isExternalEntityPresent() {
return this.isExternalEntityPresent;
}
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
this.isExternalEntityPresent = true;
if (this.resolveExternalEntitiesFlag) {
return null;
}
return new InputSource(new StringReader(""));
}
}