Bug 51403

Summary: Avoid NullPointerException in JULI FileHandler if formatter is misconfigured
Product: Tomcat 7 Reporter: Konstantin Kolinko <knst.kolinko>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 7.0.16   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Konstantin Kolinko 2011-06-21 13:13:00 UTC
If formatter assigned to org.apache.juli.FileHandler in logging.properties is misconfigured and fails to load,
the FileHandler starts without formatter and fails with an NPE later.

To reproduce: assign some bogus value to
1catalina.org.apache.juli.FileHandler.formatter

When Tomcat starts, the following will be printed at the console:

java.util.logging.ErrorManager: 4
java.lang.NullPointerException
        at org.apache.juli.FileHandler.openWriter(FileHandler.java:377)
        at org.apache.juli.FileHandler.<init>(FileHandler.java:99)
        at org.apache.juli.FileHandler.<init>(FileHandler.java:90)


I think we can be more tolerant to this configuration error and fall back to the default formatter. I will commit a fix shortly.
Comment 1 Konstantin Kolinko 2011-06-21 13:27:56 UTC
Fixed in 7.0 with r1137996, will be in 7.0.17.
Proposed for 6.0 and 5.5.
Comment 2 Konstantin Kolinko 2011-07-11 14:20:59 UTC
Fixed in 6.0 in r1145188 and will be in 6.0.33