Skip to content

Commit

Permalink
Remove unneeded check for Java 1.3+ in ShutdownHooks
Browse files Browse the repository at this point in the history
It's unlikely anyone will be able to run JLine 3 on Java 1.2 or
lower.
  • Loading branch information
stephan-gh committed Jun 21, 2017
1 parent 6962db9 commit bb87c2b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions terminal/src/main/java/org/jline/utils/ShutdownHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ private static synchronized void runTasks() {

private static Thread addHook(final Thread thread) {
Log.debug("Registering shutdown-hook: ", thread);
try {
Runtime.getRuntime().addShutdownHook(thread);
}
catch (AbstractMethodError e) {
// JDK 1.3+ only method. Bummer.
Log.debug("Failed to register shutdown-hook", e);
}
Runtime.getRuntime().addShutdownHook(thread);
return thread;
}

Expand Down Expand Up @@ -98,10 +92,6 @@ private static void removeHook(final Thread thread) {
try {
Runtime.getRuntime().removeShutdownHook(thread);
}
catch (AbstractMethodError e) {
// JDK 1.3+ only method. Bummer.
Log.debug("Failed to remove shutdown-hook", e);
}
catch (IllegalStateException e) {
// The VM is shutting down, not a big deal; ignore
}
Expand All @@ -114,4 +104,4 @@ public interface Task
{
void run() throws Exception;
}
}
}

0 comments on commit bb87c2b

Please sign in to comment.