From 94ea83b49a134df94f992fbb33915d2f1c954651 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 27 Apr 2017 08:58:24 -0700 Subject: [PATCH] Issue #1507 - adding state information to ISE if it occurs --- .../jetty/util/RolloverFileOutputStream.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java index 63e20d17cda..0f030cbe274 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java @@ -214,8 +214,20 @@ public class RolloverFileOutputStream extends FilterOutputStream _rollTask = new RollTask(); // Get tomorrow's midnight based on Configured TimeZone midnight = nextMidnight(midnight); - // Schedule next rollover event to occur, based on local machine's Unix Epoch milliseconds - __rollover.schedule(_rollTask,midnight.toInstant().toEpochMilli() - System.currentTimeMillis()); + + long now = System.currentTimeMillis(); + long delay = midnight.toInstant().toEpochMilli() - System.currentTimeMillis(); + try + { + // Schedule next rollover event to occur, based on local machine's Unix Epoch milliseconds + __rollover.schedule(_rollTask, delay); + } + catch (IllegalArgumentException e) + { + System.err.printf("[ERROR] midnight=%s, midnight-epoch=%d, now=%d, delay=%d - ", + midnight, midnight.toInstant().toEpochMilli(), now, delay); + e.printStackTrace(System.err); + } } /* ------------------------------------------------------------ */