knopflerfish / knopflerfish.org

Knopflerfish OSGi Service Platform. OSGi run-time container and SDK source code repo
http://www.knopflerfish.org
BSD 3-Clause "New" or "Revised" License
33 stars 11 forks source link

NPE in http service with felix web console #10

Closed benson-basis closed 7 years ago

benson-basis commented 7 years ago

I loaded:

and was rewarded with:

 [ERROR] 2016-11-18 05:42:54.142 [HttpServer-WorkerThread-6] org.knopflerfish.bundle.http.5.2.0 - [Unknown]Internal error: java.lang.NullPointerException
java.lang.NullPointerException: null
    at org.knopflerfish.bundle.http.ResponseImpl.setContentType(ResponseImpl.java:736) ~[?:?]
    at javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:130) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
    at org.apache.felix.webconsole.AbstractWebConsolePlugin.spoolResource0(AbstractWebConsolePlugin.java:594) ~[?:?]
    at org.apache.felix.webconsole.AbstractWebConsolePlugin$1.run(AbstractWebConsolePlugin.java:526) ~[?:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
    at org.apache.felix.webconsole.AbstractWebConsolePlugin.spoolResource(AbstractWebConsolePlugin.java:521) ~[?:?]
    at org.apache.felix.webconsole.AbstractWebConsolePlugin.doGet(AbstractWebConsolePlugin.java:181) ~[?:?]
    at org.apache.felix.webconsole.plugins.ds.internal.WebConsolePlugin.doGet(WebConsolePlugin.java:194) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:691) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:804) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
    at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:567) ~[?:?]
    at org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465) ~[?:?]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
    at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461) ~[?:?]
    at org.knopflerfish.bundle.http.RequestDispatcherImpl.service(RequestDispatcherImpl.java:162) ~[org.knopflerfish.bundle-http-5.2.0.jar:?]
    at org.knopflerfish.bundle.http.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:461) ~[org.knopflerfish.bundle-http-5.2.0.jar:?]
    at org.knopflerfish.bundle.http.Transaction.run(Transaction.java:177) [org.knopflerfish.bundle-http-5.2.0.jar:?]
    at org.knopflerfish.bundle.http.TransactionManager$WorkerThread.run(TransactionManager.java:288) [org.knopflerfish.bundle-http-5.2.0.jar:?]
chlarsson commented 7 years ago

The NPE happens because ServletResponse.setContentType(null) is called by the webconsole

It is not clear in the Servlet API javadoc what the result should be in this case, or if it allowed.

One interpretation could be to unset any previous settings, i.e. fallback to a default type.