diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java b/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java index c1f07859..30ab1870 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.asm; +import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -17,7 +18,7 @@ * Позволяет искать методы внутри незагруженных классов и общие суперклассы для * чего угодно. Работает через поиск class-файлов в classpath. */ -public class ClassMetadataReader { +public class ClassMetadataReader implements Closeable { private class CheckSuperClassVisitor extends ClassVisitor { String superClassName; @@ -96,4 +97,9 @@ public ArrayList getSuperClasses(String type) { return superclasses; } + @Override + public void close() throws IOException { + cp.stream().forEach(IOHelper::close); + } + } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java index ecae496b..a0caa387 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java @@ -47,7 +47,7 @@ public void build() throws IOException { long time_task_end = System.currentTimeMillis(); long time_task = time_task_end - time_this; time_this = time_task_end; - if(isNeedDelete) Files.delete(oldPath); + if (isNeedDelete) Files.delete(oldPath); isNeedDelete = task.allowDelete(); LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java index d89e4052..27d7f654 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -195,6 +195,7 @@ public Path process(Path cleanJar) throws IOException { } catch (CannotCompileException | NotFoundException e) { LogHelper.error(e); } + reader.close(); return binaryFile; } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/StripLineNumbersTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/StripLineNumbersTask.java index b14d36a6..f6b9be68 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/StripLineNumbersTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/StripLineNumbersTask.java @@ -53,6 +53,7 @@ public Path process(Path inputFile) throws IOException { e = input.getNextEntry(); } } + reader.close(); return out; }