diff --git a/adapter/pom.xml b/adapter/pom.xml index 1e83db9..e080945 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -6,7 +6,7 @@ nicer.djudger adapter - 1.0.0 + 1.0.1 8 diff --git a/adapter/release/adapter-1.0.0.jar b/adapter/release/adapter-1.0.1.jar similarity index 55% rename from adapter/release/adapter-1.0.0.jar rename to adapter/release/adapter-1.0.1.jar index cc969dc..de6923a 100644 Binary files a/adapter/release/adapter-1.0.0.jar and b/adapter/release/adapter-1.0.1.jar differ diff --git a/adapter/release/adapter-1.0.0.xml b/adapter/release/adapter-1.0.1.xml similarity index 98% rename from adapter/release/adapter-1.0.0.xml rename to adapter/release/adapter-1.0.1.xml index 1e83db9..e080945 100644 --- a/adapter/release/adapter-1.0.0.xml +++ b/adapter/release/adapter-1.0.1.xml @@ -6,7 +6,7 @@ nicer.djudger adapter - 1.0.0 + 1.0.1 8 diff --git a/adapter/src/main/java/djudger/allocator/Allocator.java b/adapter/src/main/java/djudger/allocator/Allocator.java index 9c71ec5..c15b888 100644 --- a/adapter/src/main/java/djudger/allocator/Allocator.java +++ b/adapter/src/main/java/djudger/allocator/Allocator.java @@ -41,7 +41,7 @@ public void run() { protected abstract void removeAllContainers(); - public final Task runCode(String language, List commands, Integer timeLimit, TimeUnit timeUnit, String codeIdentifier, String code) throws Throwable { + public final Task runCode(String language, List commands, Integer timeLimit, TimeUnit timeUnit, String codeIdentifier, String code) throws DJudgerException { if (stopped) throw new DJudgerException("DJudger has stopped"); LangConfig target = langConfigMap.get(language); @@ -64,7 +64,7 @@ public final Task runCode(String language, List commands, Integer timeLi return task; } - protected Task preProcess(String language, String fileName, List rawCommands, String codeIdentifier, String code, LangConfig target) throws Throwable { + protected Task preProcess(String language, String fileName, List rawCommands, String codeIdentifier, String code, LangConfig target) throws DJudgerException { if (language == null || rawCommands == null || codeIdentifier == null || code == null || rawCommands.size() == 0 || codeIdentifier.length() == 0 || code.length() == 0) { throw new IllegalArgumentException("No Args should be null"); } @@ -86,7 +86,7 @@ protected Task preProcess(String language, String fileName, List rawComm try { FileUtil.writeCode(hostDirectory, hostFilePath, code); } catch (IOException e) { - throw new DJudgerException("IO Error").initCause(e); + throw new DJudgerException("IO Error"); } task.setRemotePath("/code/" + language); task.setHostPath(hostDirectory); diff --git a/adapter/src/main/java/djudger/allocator/classic/ClassicAllocator.java b/adapter/src/main/java/djudger/allocator/classic/ClassicAllocator.java index 6cc5b66..aa94ab6 100644 --- a/adapter/src/main/java/djudger/allocator/classic/ClassicAllocator.java +++ b/adapter/src/main/java/djudger/allocator/classic/ClassicAllocator.java @@ -16,7 +16,10 @@ public class ClassicAllocator extends Allocator { public ClassicAllocator(Config config) { super(config); - classicAllocatorConfig = (ClassicAllocatorConfig) config.allocatorConfig; + if(!(config.allocatorConfig instanceof ClassicAllocatorConfig)){ + classicAllocatorConfig = new ClassicAllocatorConfig(); + } + else classicAllocatorConfig = (ClassicAllocatorConfig) config.allocatorConfig; for (LangConfig langConfig : langConfigMap.values()) { langMap.put(langConfig.languageName, new Lang()); } diff --git a/adapter/src/main/java/djudger/allocator/threadpool/ThreadPoolAllocator.java b/adapter/src/main/java/djudger/allocator/threadpool/ThreadPoolAllocator.java index d414ce7..3565e72 100644 --- a/adapter/src/main/java/djudger/allocator/threadpool/ThreadPoolAllocator.java +++ b/adapter/src/main/java/djudger/allocator/threadpool/ThreadPoolAllocator.java @@ -4,6 +4,7 @@ import djudger.LangConfig; import djudger.Task; import djudger.allocator.Allocator; +import djudger.allocator.classic.ClassicAllocator; import java.util.HashMap; import java.util.Map; @@ -20,7 +21,10 @@ public class ThreadPoolAllocator extends Allocator { public ThreadPoolAllocator(Config config) { super(config); - threadPoolAllocatorConfig = (ThreadPoolAllocatorConfig) config.allocatorConfig; + if(!(config.allocatorConfig instanceof ThreadPoolAllocatorConfig)){ + threadPoolAllocatorConfig = new ThreadPoolAllocatorConfig(); + } + else threadPoolAllocatorConfig = (ThreadPoolAllocatorConfig) config.allocatorConfig; for (LangConfig lang : langConfigMap.values()) { executorMap.put(lang.languageName, new ThreadPoolExecutor(threadPoolAllocatorConfig.corePoolSize, threadPoolAllocatorConfig.maximumPoolSize, threadPoolAllocatorConfig.keepAliveTime,