[FIX] Человекочитаемая ошибка при обнаружении мусора в modules

This commit is contained in:
Gravit 2019-08-10 18:37:05 +07:00
parent ffadb6abff
commit e7f6b6f3f5
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -28,7 +28,13 @@ private ModulesVisitor() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.toFile().getName().endsWith(".jar"))
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) {
LogHelper.error(e);
}