From be93e5eb1266e087a963aa29f2403a14b1fcc72a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 24 Jan 2005 07:59:31 +0000 Subject: [PATCH] Make sure to catch any error while processing our events, not just when actually dispatching the event to subscribers. We can't trust anyone. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3308 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/PresentsDObjectMgr.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java index 3034a9108..9ee41a67b 100644 --- a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -202,25 +202,26 @@ public class PresentsDObjectMgr start = _timer.highResCounter(); } - // if this is a runnable, it's just an executable unit that - // should be invoked - if (unit instanceof Runnable) { - try { + try { + if (unit instanceof Runnable) { + // if this is a runnable, it's just an executable unit + // that should be invoked ((Runnable)unit).run(); - } catch (Exception e) { - Log.warning("Execution unit failed [unit=" + unit + "]."); - Log.logStackTrace(e); - } catch (OutOfMemoryError oome) { - handleFatalError(unit, oome); - } catch (StackOverflowError soe) { - handleFatalError(unit, soe); + + } else if (unit instanceof CompoundEvent) { + processCompoundEvent((CompoundEvent)unit); + + } else { + processEvent((DEvent)unit); } - } else if (unit instanceof CompoundEvent) { - processCompoundEvent((CompoundEvent)unit); - - } else { - processEvent((DEvent)unit); + } catch (Exception e) { + Log.warning("Execution unit failed [unit=" + unit + "]."); + Log.logStackTrace(e); + } catch (OutOfMemoryError oome) { + handleFatalError(unit, oome); + } catch (StackOverflowError soe) { + handleFatalError(unit, soe); } if (start != 0L) {