Skip to content

Commit d749096

Browse files
committed
Update DTDEncoder.
1 parent fdffa03 commit d749096

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

sierra-tools/dtd-encoder/src/main/java/org/httprpc/sierra/tools/dtd/DTDEncoder.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ public static void main(String[] args) throws Exception {
256256
var workingPath = Path.of(System.getProperty("user.dir"));
257257

258258
if (args.length > 0) {
259-
ClassLoader classLoader;
259+
var classLoader = ClassLoader.getSystemClassLoader();
260+
260261
if (args.length > 1) {
261262
try (var paths = Files.walk(workingPath.resolve(args[1]))) {
262263
classLoader = new URLClassLoader(paths.map(path -> {
@@ -265,10 +266,8 @@ public static void main(String[] args) throws Exception {
265266
} catch (IOException exception) {
266267
throw new RuntimeException(exception);
267268
}
268-
}).toArray(URL[]::new));
269+
}).toArray(URL[]::new), classLoader);
269270
}
270-
} else {
271-
classLoader = ClassLoader.getSystemClassLoader();
272271
}
273272

274273
applyBindings(workingPath.resolve(args[0]), classLoader);

sierra-tools/dtd-encoder/src/test/java/org/httprpc/sierra/tools/dtd/DTDEncoderTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.httprpc.kilo.io.TextDecoder;
1818
import org.junit.jupiter.api.Test;
1919

20+
import javax.swing.JDesktopPane;
2021
import java.nio.file.Files;
2122
import java.nio.file.Path;
2223
import java.nio.file.StandardCopyOption;
@@ -33,6 +34,7 @@ public void testDTDEncoder() throws Exception {
3334

3435
var properties = new Properties();
3536

37+
properties.put("desktop-pane", JDesktopPane.class.getName());
3638
properties.put("chart-panel", "org.jfree.chart.ChartPanel");
3739

3840
var libraryPath = workingPath.resolve("lib");
@@ -66,6 +68,7 @@ public void testDTDEncoder() throws Exception {
6668
text = textDecoder.read(inputStream);
6769
}
6870

71+
assertTrue(text.contains("desktop-pane"));
6972
assertTrue(text.contains("chart-panel"));
7073
} finally {
7174
Files.deleteIfExists(bindingsPath);

0 commit comments

Comments
 (0)