Issue Details (XML | Word | Printable)

Key: VELOCITY-71
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Daniel Rall
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Velocity

False positive error condition parsing VM_global_library.vm

Created: 02/May/02 06:24 AM   Updated: 08/Mar/07 12:04 AM
Return to search
Component/s: Engine
Affects Version/s: 1.3-rc1
Fix Version/s: 1.5

Time Tracking:
Not Specified

Environment:
Operating System: Linux
Platform: Other
Issue Links:
Duplicate
 

Bugzilla Id: 8716
Resolution Date: 10/Oct/06 10:53 PM


 Description  « Hide
This bug is actually against 1.3 RC1, but there is no Version listing for that
in the Bugzilla config.

The initial parsing of the global Velocimacro library is incorrectly indicating
an error when context variables which are not passed in as arguments to a macro
are used when calling one macro within the body of another. Confusing, eh? I
assume that this could be worked around by putting double quotes around the
supposedly non-existent arguments to the invoked macro, but was wondering if
this was a bug. Included is a sample problem case and some log output.

From VM_global_library.vm:

#macro(linkedLoginName $acl $user)
 #linkIf($user.isEditableBy($acl) $currentDomain.getProjectPageURL("UserEdit",
"userID=$user.getID()") $user.getLoginName())
#end

#macro(linkIf $condition $link $text)
 #if ($condition) <a href="$link">$text</a> #else $text #end
#end

From velocity.log:

2002-05-01 15:04:28,496 - Velocimacro : added new VM : #enterHelp( filename
linktext ) : source = VM_global_library.vm
2002-05-01 15:04:28,843 - VM #linkIf: error : too few arguments to macro. Wanted
3 got 0
2002-05-01 15:04:28,847 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,848 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,849 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,857 - VM #displayProjectTreeAsOptions: error : too few
arguments to macro. Wanted 4 got 0
2002-05-01 15:04:28,907 - VM #selectYear: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,907 - VM #selectMonth: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:28,908 - VM #selectDay: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:29,109 - ResourceManager : found VM_global_library.vm with
loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
2002-05-01 15:04:29,113 - Velocimacro : VM library template macro registration
complete.
2002-05-01 15:04:29,113 - Velocimacro : allowInline = true : VMs can be defined
inline in templates

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Geir Magnusson Jr added a comment - 02/May/02 06:48 AM
ack. quite the description :)

Geir Magnusson Jr added a comment - 02/May/02 06:49 AM
ack.

Jeff Turner made changes - 13/Sep/05 12:42 PM
Field Original Value New Value
issue.field.bugzillaimportkey 8716 12314941
Will Glass-Husain added a comment - 19/Sep/05 06:01 AM
It'd be nice to fix this for 1.5 release

Will Glass-Husain made changes - 19/Sep/05 06:01 AM
Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
Description This bug is actually against 1.3 RC1, but there is no Version listing for that
in the Bugzilla config.

The initial parsing of the global Velocimacro library is incorrectly indicating
an error when context variables which are not passed in as arguments to a macro
are used when calling one macro within the body of another. Confusing, eh? I
assume that this could be worked around by putting double quotes around the
supposedly non-existent arguments to the invoked macro, but was wondering if
this was a bug. Included is a sample problem case and some log output.

From VM_global_library.vm:

#macro(linkedLoginName $acl $user)
 #linkIf($user.isEditableBy($acl) $currentDomain.getProjectPageURL("UserEdit",
"userID=$user.getID()") $user.getLoginName())
#end

#macro(linkIf $condition $link $text)
 #if ($condition) <a href="$link">$text</a> #else $text #end
#end

From velocity.log:

2002-05-01 15:04:28,496 - Velocimacro : added new VM : #enterHelp( filename
linktext ) : source = VM_global_library.vm
2002-05-01 15:04:28,843 - VM #linkIf: error : too few arguments to macro. Wanted
3 got 0
2002-05-01 15:04:28,847 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,848 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,849 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,857 - VM #displayProjectTreeAsOptions: error : too few
arguments to macro. Wanted 4 got 0
2002-05-01 15:04:28,907 - VM #selectYear: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,907 - VM #selectMonth: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:28,908 - VM #selectDay: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:29,109 - ResourceManager : found VM_global_library.vm with
loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
2002-05-01 15:04:29,113 - Velocimacro : VM library template macro registration
complete.
2002-05-01 15:04:29,113 - Velocimacro : allowInline = true : VMs can be defined
inline in templates
This bug is actually against 1.3 RC1, but there is no Version listing for that
in the Bugzilla config.

The initial parsing of the global Velocimacro library is incorrectly indicating
an error when context variables which are not passed in as arguments to a macro
are used when calling one macro within the body of another. Confusing, eh? I
assume that this could be worked around by putting double quotes around the
supposedly non-existent arguments to the invoked macro, but was wondering if
this was a bug. Included is a sample problem case and some log output.

From VM_global_library.vm:

#macro(linkedLoginName $acl $user)
 #linkIf($user.isEditableBy($acl) $currentDomain.getProjectPageURL("UserEdit",
"userID=$user.getID()") $user.getLoginName())
#end

#macro(linkIf $condition $link $text)
 #if ($condition) <a href="$link">$text</a> #else $text #end
#end

From velocity.log:

2002-05-01 15:04:28,496 - Velocimacro : added new VM : #enterHelp( filename
linktext ) : source = VM_global_library.vm
2002-05-01 15:04:28,843 - VM #linkIf: error : too few arguments to macro. Wanted
3 got 0
2002-05-01 15:04:28,847 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,848 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,849 - VM #servletLink: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,857 - VM #displayProjectTreeAsOptions: error : too few
arguments to macro. Wanted 4 got 0
2002-05-01 15:04:28,907 - VM #selectYear: error : too few arguments to macro.
Wanted 2 got 0
2002-05-01 15:04:28,907 - VM #selectMonth: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:28,908 - VM #selectDay: error : too few arguments to macro.
Wanted 1 got 0
2002-05-01 15:04:29,109 - ResourceManager : found VM_global_library.vm with
loader org.apache.velocity.runtime.resource.loader.FileResourceLoader
2002-05-01 15:04:29,113 - Velocimacro : VM library template macro registration
complete.
2002-05-01 15:04:29,113 - Velocimacro : allowInline = true : VMs can be defined
inline in templates
Bugzilla Id 8716
Fix Version/s 1.5 [ 12310253 ]
Environment Operating System: Linux
Platform: Other
Operating System: Linux
Platform: Other
Will Glass-Husain made changes - 19/Sep/05 06:01 AM
Priority Major [ 3 ] Minor [ 4 ]
Bugzilla Id 8716
Will Glass-Husain made changes - 19/Sep/05 06:01 AM
Affects Version/s 1.0-Release [ 12310243 ]
Affects Version/s 1.3-rc1 [ 12310248 ]
Bugzilla Id 8716
Nathan Bubna made changes - 29/Sep/05 09:05 AM
Link This issue is duplicated by VELOCITY-108 [ VELOCITY-108 ]
Daniel Rall added a comment - 29/Sep/05 09:53 AM
This issue still existed in the HEAD of trunk after 1.4 was released.

Repository Revision Date User Message
ASF #462537 Tue Oct 10 20:03:29 UTC 2006 henning Factor out the logging and prefixing, cleaning up the code for the
Factory. Starting to work on VELOCITY-71...
Files Changed
MODIFY /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroFactory.java

Repository Revision Date User Message
ASF #462627 Tue Oct 10 22:53:30 UTC 2006 henning Check whether the current macro test is not actually a macro invocation
but a reference inside another macro definition. If yes, do not report
an error about the size of the argument list but fail silently.
Fixes VELOCITY-71.
Files Changed
MODIFY /jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java

Henning Schmiedehausen added a comment - 10/Oct/06 10:53 PM
This is more of a reporting issue than an actual but. Fixed in 1.5.

Henning Schmiedehausen made changes - 10/Oct/06 10:53 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Repository Revision Date User Message
ASF #462993 Wed Oct 11 22:07:24 UTC 2006 henning Add a test case for the bug fixed in VELOCITY-71.
Files Changed
ADD /jakarta/velocity/engine/trunk/test/macroforwarddefine/velocity.properties
ADD /jakarta/velocity/engine/trunk/test/macroforwarddefine/compare/velocity.log.cmp
ADD /jakarta/velocity/engine/trunk/test/macroforwarddefine/compare
ADD /jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MacroForwardDefineTestCase.java
ADD /jakarta/velocity/engine/trunk/test/macroforwarddefine/macros.vm
ADD /jakarta/velocity/engine/trunk/test/macroforwarddefine

Henning Schmiedehausen added a comment - 08/Mar/07 12:04 AM
Close all resolved issues for Engine 1.5 release.

Henning Schmiedehausen made changes - 08/Mar/07 12:04 AM
Status Resolved [ 5 ] Closed [ 6 ]
Repository Revision Date User Message
ASF #733439 Sun Jan 11 09:47:48 UTC 2009 byron VELOCITY-71 can't happen anymore with Velocity 1.6 since macro arg checking is done during render, so remove the check
Files Changed
MODIFY /velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java