[ 
https://issues.apache.org/jira/browse/FELIX-5387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15602106#comment-15602106
 ] 

Timothee Maret commented on FELIX-5387:
---------------------------------------

As an example, the following authenticated request throws a NPE
{code}
curl 'http://10.131.170.170:4504/system/console/bundles' -H 'Pragma: no-cache' 
-H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: 
en-US,en;q=0.8,fr;q=0.6' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: 
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/51.0.2704.79 Safari/537.36' -H 'Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 
'Cache-Control: no-cache' -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 
'Connection: keep-alive' --compressed
{code}

and the same request with added cookie succeeds
{code}
curl 'http://10.131.170.170:4504/system/console/bundles' -H 'Pragma: no-cache' 
-H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: 
en-US,en;q=0.8,fr;q=0.6' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: 
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/51.0.2704.79 Safari/537.36' -H 'Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 
'Cache-Control: no-cache' -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 
'Connection: keep-alive' -H 'Cookie: felix-webconsole-locale=en' --compressed
{code}

Debugging it, the NPE is thrown at

https://github.com/apache/felix/blob/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java#L498

with the method call

{code}
locale.toString()
{code}

indeed, the {{locale}} is {{null}} at that point.

> NPE for requests missing 'felix-webconsole-locale' cookie
> ---------------------------------------------------------
>
>                 Key: FELIX-5387
>                 URL: https://issues.apache.org/jira/browse/FELIX-5387
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>    Affects Versions: webconsole-4.2.16
>            Reporter: Timothee Maret
>            Priority: Critical
>             Fix For: webconsole-4.2.18
>
>
> Issuing a request without 'felix-webconsole-locale' cookies throws a NPE 
> similar to 
> {code}
> 24.10.2016 12:44:44.617 *ERROR* [qtp1226339741-3423] 
> org.apache.felix.http.jetty Exception while processing request to 
> /system/console/configMgr (java.lang.NullPointerException)
> java.lang.NullPointerException: null
>       at 
> org.apache.felix.webconsole.internal.servlet.OsgiManager.ensureLocaleCookieSet(OsgiManager.java:502)
>       at 
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:561)
>       at 
> org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461)
>       at 
> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
>       at 
> org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
>       at 
> com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
>       at 
> org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>       at 
> org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>       at 
> org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96)
>       at 
> org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>       at 
> org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>       at 
> org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:295)
>       at 
> org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>       at 
> org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>       at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:133)
>       at 
> org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
>       at 
> org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
>       at 
> org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:128)
>       at 
> org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>       at org.eclipse.jetty.server.Server.handle(Server.java:499)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
>       at 
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>       at java.lang.Thread.run(Thread.java:745)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to