summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorhibo98 <hibo98.niklas@gmail.com>2016-10-24 18:47:47 +1100
committermd_5 <git@md-5.net>2016-10-24 18:49:06 +1100
commit251a5b6382c0d6997c0347e2320885993c2357cd (patch)
treeefbf69df043c3f06eb7d1203916348d5e384e78f /src/main
parent2e39de698d0998d4d5a2283686d192614505b7fa (diff)
downloadcraftbukkit-251a5b6382c0d6997c0347e2320885993c2357cd.tar
craftbukkit-251a5b6382c0d6997c0347e2320885993c2357cd.tar.gz
craftbukkit-251a5b6382c0d6997c0347e2320885993c2357cd.tar.lz
craftbukkit-251a5b6382c0d6997c0347e2320885993c2357cd.tar.xz
craftbukkit-251a5b6382c0d6997c0347e2320885993c2357cd.zip
Explicitly log exception from asynchronous tasks.
Previously an UnhandledException would be thrown and the stack trace / message would be printed to System.err in the default UncaughtExceptionHandler for ThreadGroup. This was undesirable as it meant that logging frameworks / exception monitors such as Sentry were unable to get the exception. Additionally it would cause the death of the thread in the ExecutorService. This change mimics the behaviour of exceptions occuring during synchronous tasks.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
index f3da84a9..336519c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
@@ -3,12 +3,11 @@ package org.bukkit.craftbukkit.scheduler;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
+import java.util.logging.Level;
-import org.apache.commons.lang.UnhandledException;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitWorker;
-
class CraftAsyncTask extends CraftTask {
private final LinkedList<BukkitWorker> workers = new LinkedList<BukkitWorker>();
@@ -53,7 +52,8 @@ class CraftAsyncTask extends CraftTask {
super.run();
} catch (final Throwable t) {
thrown = t;
- throw new UnhandledException(
+ getOwner().getLogger().log(
+ Level.WARNING,
String.format(
"Plugin %s generated an exception while executing task %s",
getOwner().getDescription().getFullName(),