You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/06/10 19:43:28 UTC

svn commit: r666232 - /tomcat/trunk/java/org/apache/juli/FileHandler.java

Author: fhanik
Date: Tue Jun 10 10:43:28 2008
New Revision: 666232

URL: http://svn.apache.org/viewvc?rev=666232&view=rev
Log:
prevent NPE during shutdown where the logger has been shutdown and delayed resources still trying to log
java.lang.NullPointerException
	at org.apache.juli.FileHandler.publish(FileHandler.java:136)


Modified:
    tomcat/trunk/java/org/apache/juli/FileHandler.java

Modified: tomcat/trunk/java/org/apache/juli/FileHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/FileHandler.java?rev=666232&r1=666231&r2=666232&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/FileHandler.java (original)
+++ tomcat/trunk/java/org/apache/juli/FileHandler.java Tue Jun 10 10:43:28 2008
@@ -133,8 +133,12 @@
         }
         
         try {
-            writer.write(result);
-            writer.flush();
+            if (writer!=null) {
+                writer.write(result);
+                writer.flush();
+            } else {
+                reportError("FileHandler is closed or not yet initialized, unable to log ["+result+"]", null, ErrorManager.WRITE_FAILURE);
+            }
         } catch (Exception e) {
             reportError(null, e, ErrorManager.WRITE_FAILURE);
             return;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org