[
https://issues.apache.org/jira/browse/FELIX-2012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805502#action_12805502
]
Felix Meschberger commented on FELIX-2012:
------------------------------------------
Seems like a bug in the AdminPlugin.getResource() method; seems to have
multiple issues ...
path = path.substring(NAME.length() + 1);
URL url = this.classLoader.getResource(path); --> why use
classLoader instead of Bundle.getEntry ?
try {
InputStream ins = url.openStream(); --> url may be null, which is
not checked here
if (ins == null) {
this.log.error("failed to open " + url);
}
} catch (IOException e) {
this.log.error(e.getMessage(), e);
}
return url; --> shouldn't
url be set to null if IOException was thrown or ins is null ?
Proposed patch:
Index: AdminPlugin.java
===================================================================
--- AdminPlugin.java (revision 903631)
+++ AdminPlugin.java (working copy)
@@ -184,13 +184,17 @@
}
URL url = this.classLoader.getResource(path);
- try {
- InputStream ins = url.openStream();
- if (ins == null) {
- this.log.error("failed to open " + url);
+ if (url != null) {
+ try {
+ InputStream ins = url.openStream();
+ if (ins == null) {
+ this.log.error("failed to open " + url);
+ url = null;
+ }
+ } catch (IOException e) {
+ this.log.error(e.getMessage(), e);
+ url = null;
}
- } catch (IOException e) {
- this.log.error(e.getMessage(), e);
}
return url;
}
> NullPointerException when some links clicked if karaf.framework=equinox
> -----------------------------------------------------------------------
>
> Key: FELIX-2012
> URL: https://issues.apache.org/jira/browse/FELIX-2012
> Project: Felix
> Issue Type: Bug
> Components: Web Console
> Affects Versions: karaf-1.2.0
> Environment: Windows XP, Ubuntu 9.10
> Reporter: David Porter
>
> To reproduce:
> In the /etc/config.properties file, set karaf.framework=equinox
> Start Karaf.
> Install the webconsole feature.
> In your web browser, go to http://localhost:8181/system/console
> Log in as admin/admin
> Click the Admin, Features, or Gogo links in the nav bar at the top.
> Result:
> java.lang.NullPointerException
> at
> org.apache.felix.webconsole.AbstractWebConsolePlugin.spoolResource(AbstractWebConsolePlugin.java:355)
> at
> org.apache.felix.webconsole.AbstractWebConsolePlugin.doGet(AbstractWebConsolePlugin.java:103)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> at
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:314)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
> at
> org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
> at
> org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> at
> org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.