From 955cf958de5336fb3ef04dfc564d284cf2348b45 Mon Sep 17 00:00:00 2001 From: James Perkins Date: Mon, 8 Jun 2020 08:58:01 -0700 Subject: [PATCH] [LOGMGR-276] Ensure the file is not null before attempting to rotate it. https://issues.redhat.com/browse/LOGMGR-276 --- .../logmanager/handlers/PeriodicRotatingFileHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java b/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java index 068eadcf..cf310d27 100644 --- a/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java +++ b/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java @@ -196,6 +196,10 @@ SuffixRotator getSuffixRotator() { private void rollOver() { try { final File file = getFile(); + if (file == null) { + // no file is set; a direct output stream or writer was specified + return; + } // first, close the original file (some OSes won't let you move/rename a file that is open) setFileInternal(null); // next, rotate it