Skip to content

Fix #1892 (TestChooser does not show classes list when run with java 8) #1893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions jme3-examples/src/main/java/jme3test/TestChooser.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -217,7 +217,13 @@ private void addAllFilesInDirectory(final Path directory,
// we are only interested in .class files
if (Files.isDirectory(file)) {
if (recursive) {
addAllFilesInDirectory(file, allClasses, packageName + file.getFileName() + ".", true);
String dirName = String.valueOf(file.getFileName());
if (dirName.endsWith("/")) {
// Seems java 8 adds "/" at the end of directory name when
// reading from jar filesystem. We need to remove it. - Ali-RS 2023-1-5
dirName = dirName.substring(0, dirName.length() - 1);
}
addAllFilesInDirectory(file, allClasses, packageName + dirName + ".", true);
}
} else {
Class<?> result = load(packageName + file.getFileName());
Expand Down