You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2005/03/09 09:22:09 UTC
DO NOT REPLY [Bug 33924] New: -
Anakia throws NullPointerException if run under Maven with Custom Contexts
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33924>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33924
Summary: Anakia throws NullPointerException if run under Maven
with Custom Contexts
Product: Velocity
Version: 1.5
Platform: All
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: Anakia
AssignedTo: velocity-dev@jakarta.apache.org
ReportedBy: hps@intermeta.de
The AnakiaTask has the feature to use a custom context object. This is tested in
the AnakiaTestCase. However, when running this test (and the AnakiaTask) under
Maven, it fails with a NullPointerException. The reason is that maven uses a
different sequence to initialize the AnakiaTask and Context objects and set
their properties. When running under ant, the setFile() method in the Context
object is called after setBaseDir() in the AnakiaTask, which allows setFile() to
resolve the baseDir member. When running under maven, setBasedir() is called
after the Context object has been initialized thus using a null baseDir element
when creating the contextFile element in Context.
When using an element outside the current working directory, this leads to
subContext.getContextDocument() returning null in line 378, thus resulting in a
NullPointerException.
The attached patch adds checks for this condition and throws a BuildExeption. It
also defers the creation of the contextDoc member of the context until it is
actually referenced.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org