Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0
-
None
-
Ubuntu 10.10, JDK 1.6.21, Tomcat 6.0.20
Description
Invoking the constructor ViewToolManager(servletContext) always fails with an NPE. The reason for this is, that it invokes super(true, true) before setting the member variable servletContext with the provided servletContext.
The parent class' constructor invokes autoConfigure(true) which invokes ServletUtils.getConfiguration(servletPath). At this moment servletPath can only be null as it is not set yet. And that finally leads to a NPE in the first line of the getConfiguration method:
Object obj = application.getAttribute(CONFIGURATION_KEY);
Workaround: Use a constructor without autoconfiguration and invoke autoConfigure(true) afterwards.
ViewToolManager vm = new ViewToolmanager(servletContext, false, false);
vm.autoConfigure(true);