Skip to content

Commit a049017

Browse files
committed
Remove deprecated doPrivileged blocks
1 parent a86ee88 commit a049017

File tree

2 files changed

+5
-95
lines changed

2 files changed

+5
-95
lines changed

src/io/sf/carte/doc/xml/dtd/DefaultEntityResolver.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.io.InputStream;
1616
import java.io.InputStreamReader;
1717
import java.io.Reader;
18-
import java.lang.reflect.Constructor;
1918
import java.net.HttpURLConnection;
2019
import java.net.URL;
2120
import java.net.URLConnection;
@@ -79,7 +78,7 @@ public class DefaultEntityResolver implements EntityResolver2 {
7978

8079
private final HashMap<String, String> systemIdToPublicId = new HashMap<>(14);
8180

82-
private static final DTDLoader dtdLoader = createDTDLoader();
81+
private static final DTDLoader dtdLoader = new SimpleDTDLoader();
8382

8483
private ClassLoader loader = null;
8584

@@ -743,35 +742,23 @@ public void setClassLoader(ClassLoader loader) {
743742
this.loader = loader;
744743
}
745744

746-
private static DTDLoader createDTDLoader() {
747-
DTDLoader loader;
748-
try {
749-
Class<?> cl = Class.forName("io.sf.carte.doc.xml.dtd.SMDTDLoader");
750-
Constructor<?> ctor = cl.getConstructor();
751-
loader = (DTDLoader) ctor.newInstance();
752-
} catch (Exception e) {
753-
loader = new SimpleDTDLoader();
754-
}
755-
return loader;
756-
}
757-
758-
abstract static class DTDLoader {
745+
interface DTDLoader {
759746
abstract void connect(URLConnection con) throws IOException;
760747
abstract Reader loadDTDfromClasspath(ClassLoader loader, String dtdFilename);
761748
}
762749

763750
/**
764751
* Load DTDs without a Security Manager.
765752
*/
766-
private static class SimpleDTDLoader extends DTDLoader {
753+
private static class SimpleDTDLoader implements DTDLoader {
767754

768755
@Override
769-
void connect(final URLConnection con) throws IOException {
756+
public void connect(final URLConnection con) throws IOException {
770757
con.connect();
771758
}
772759

773760
@Override
774-
Reader loadDTDfromClasspath(final ClassLoader loader, final String dtdFilename) {
761+
public Reader loadDTDfromClasspath(final ClassLoader loader, final String dtdFilename) {
775762
InputStream is;
776763
if (loader != null) {
777764
is = loader.getResourceAsStream(dtdFilename);

src/io/sf/carte/doc/xml/dtd/SMDTDLoader.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)