Skip to content

Commit 5ecf4c2

Browse files
authored
Merge pull request #588 from chadlwilson/fix-cleanup-for-war
fix: Fix spurious NullPointerExceptions during executable war shutdown
2 parents 96bcfca + ce45eab commit 5ecf4c2

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

History.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
== Unreleased
22

3+
- fix: NullPointerException during shutdown with executable war files
4+
35
== 2.1.0
46

57
Requires JRuby >= 9.4 due to needing Ruby 3.0+ compatibility.

ext/JarMain.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ protected boolean isSymlink(File file) throws IOException {
222222
public void run() {
223223
// If the URLClassLoader isn't closed, on Windows, temp JARs won't be cleaned up
224224
try {
225-
invokeMethod(classLoader, "close");
225+
if (classLoader != null) {
226+
invokeMethod(classLoader, "close");
227+
}
226228
}
227229
catch (NoSuchMethodException e) { } // We're not being run on Java >= 7
228230
catch (Exception e) { error(e); }

0 commit comments

Comments
 (0)