dev@glassfish.java.net

[_at_GFv3] NPE in DefaultAccessLogFormatterImpl.setPattern

From: Sahoo <sahoo_at_sun.com>
Date: Fri, 14 Mar 2008 23:47:44 +0530

Kedar,

I don't know why nobody has seen this issue so far. Is the following
code returning null when it should not?

hk2/config/.../ConfigModel.java
        ...
        public Object get(Dom dom, Type rt) {
            Object value = super.get(dom, rt);
            if (value == null)
                return (dv);
            return ( null ); // Should it not return value?
        }

It seems to be causing the following NPE for me when I deploy a simple
web app:
Mar 14, 2008 11:30:46 PM
com.sun.enterprise.web.accesslog.DefaultAccessLogFormatterImpl parsePattern
SEVERE: WEB0348: Illegal access log pattern [null], is not a valid
nickname and does not contain any %
Mar 14, 2008 11:30:51 PM
com.sun.enterprise.v3.server.ApplicationLifecycle stopContainers
INFO: Cannot release container web
java.lang.NullPointerException
    at
com.sun.enterprise.web.accesslog.DefaultAccessLogFormatterImpl.parsePattern(DefaultAccessLogFormatterImpl.java:271)
    at
com.sun.enterprise.web.accesslog.DefaultAccessLogFormatterImpl.<init>(DefaultAccessLogFormatterImpl.java:143)
    at
com.sun.enterprise.web.PEAccessLogValve.setPattern(PEAccessLogValve.java:428)
    at
com.sun.enterprise.web.PEAccessLogValve.updateAccessLogAttributes(PEAccessLogValve.java:853)
    at
com.sun.enterprise.web.PEAccessLogValve.configure(PEAccessLogValve.java:727)
    at
com.sun.enterprise.web.WebContainer.createVirtualServer(WebContainer.java:1068)

When pattern is null, NPE is thrown by DefaultAccessLogFormatterImpl,
for the author seems to have forgot to return after logging the server
message.

Thanks,
Sahoo