Issue Details (XML | Word | Printable)

Key: MCHANGES-97
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Dennis Lundberg
Reporter: Benjamin Bentmann
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Changes Plugin

Fix VTL errors

Created: 22/Jan/08 05:26 PM   Updated: 05/Feb/08 05:32 PM   Resolved: 05/Feb/08 05:32 PM
Component/s: announcement
Affects Version/s: 2.0-beta-3
Fix Version/s: 2.0

Time Tracking:
Not Specified

File Attachments: 1. XML File changes.xml (0.8 kB)
2. Zip Archive MCHANGES-97.zip (5 kB)
3. Text File vtl-errors.patch (3 kB)


Patch Submitted: Yes


 Description  « Hide

When calling mvn changes:announcement-generate for the attached changes.xml VTL errors are logged due to the various null fields in the Action bean:

[INFO] [changes:announcement-generate]
[INFO] Creating announcement file from changes.xml...
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 30, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 31, column 1]
[ERROR] Left side ($!issue) of '!=' operation has null value. Operation not possible. org/apache/maven/plugin/announcement/announcement.vm [line 32, column 27]
[ERROR] Left side ($!dueto) of '!=' operation has null value. Operation not possible. org/apache/maven/plugin/announcement/announcement.vm [line 32, column 65]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 43, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 44, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 56, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 57, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 69, column 1]
[ERROR] RHS of #set statement is null. Context will not be modified. org/apache/maven/plugin/announcement/announcement.vm [line 70, column 1]
[INFO] File created...

The attached patch goes the hard way and improves the VTL template to check for nulls. Easier would be to establish an invariant for the bean properties stating that they are never null but maybe empty, i.e. change all the setters to convert null into an empty string.



Dennis Lundberg added a comment - 02/Feb/08 11:35 AM

I am unable to reproduce this error. Could you provide a minimal project that exploits this bug?


Benjamin Bentmann added a comment - 02/Feb/08 01:29 PM

Well, I put a tiny POM aside to the already attached changes.xml. Also included is a debug log of my

mvn changes:announcement-generate -X

This was run against a SNAPSHOT build of r617867.

Technical background from the Velocity User Guide:

If the RHS is a property or method reference that evaluates to null, it will not be assigned to the LHS.


Dennis Lundberg added a comment - 05/Feb/08 05:32 PM

When I moved the configuration of the plugin to the <build> element I managed to reproduce the errors.

I have applied the patch. Thanks!