ViewToolManager constructor ViewToolManager(servletContext) throws NPE always
-----------------------------------------------------------------------------
Key: VELTOOLS-130
URL: https://issues.apache.org/jira/browse/VELTOOLS-130
Project: Velocity Tools
Issue Type: Bug
Components: VelocityView
Affects Versions: 2.0
Environment: Ubuntu 10.10, JDK 1.6.21, Tomcat 6.0.20
Reporter: Robert Brandner
Priority: Minor
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);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]