mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-03-31 13:38:06 +03:00
[FIX] Человекочитаемая ошибка при обнаружении мусора в modules
This commit is contained in:
parent
ffadb6abff
commit
e7f6b6f3f5
1 changed files with 7 additions and 1 deletions
|
@ -28,7 +28,13 @@ private ModulesVisitor() {
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||||
if (file.toFile().getName().endsWith(".jar"))
|
if (file.toFile().getName().endsWith(".jar"))
|
||||||
try (JarFile f = new JarFile(file.toFile())) {
|
try (JarFile f = new JarFile(file.toFile())) {
|
||||||
loadModule(file.toUri().toURL(), f.getManifest().getMainAttributes().getValue("Main-Class"));
|
String mainclass = f.getManifest().getMainAttributes().getValue("Main-Class");
|
||||||
|
if(mainclass == null)
|
||||||
|
{
|
||||||
|
LogHelper.error("In module %s Main-Class not found", file.toString());
|
||||||
|
return super.visitFile(file, attrs);
|
||||||
|
}
|
||||||
|
loadModule(file.toUri().toURL(), mainclass);
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue