Skip to content

Commit fe851dc

Browse files
authored
Fix #1892 (TestChooser does not show classes list when run with java 8) (#1893)
* TestChooser:fix class list not showing when run with java 8. * Update copyright date.
1 parent 00a8597 commit fe851dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

jme3-examples/src/main/java/jme3test/TestChooser.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -217,7 +217,13 @@ private void addAllFilesInDirectory(final Path directory,
217217
// we are only interested in .class files
218218
if (Files.isDirectory(file)) {
219219
if (recursive) {
220-
addAllFilesInDirectory(file, allClasses, packageName + file.getFileName() + ".", true);
220+
String dirName = String.valueOf(file.getFileName());
221+
if (dirName.endsWith("/")) {
222+
// Seems java 8 adds "/" at the end of directory name when
223+
// reading from jar filesystem. We need to remove it. - Ali-RS 2023-1-5
224+
dirName = dirName.substring(0, dirName.length() - 1);
225+
}
226+
addAllFilesInDirectory(file, allClasses, packageName + dirName + ".", true);
221227
}
222228
} else {
223229
Class<?> result = load(packageName + file.getFileName());

0 commit comments

Comments
 (0)