[
https://issues.apache.org/jira/browse/VELOCITY-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henning Schmiedehausen closed VELOCITY-107.
-------------------------------------------
> Method call fails
> -----------------
>
> Key: VELOCITY-107
> URL: https://issues.apache.org/jira/browse/VELOCITY-107
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.3-rc1
> Environment: Operating System: Linux
> Platform: PC
> Reporter: Xinghai Chen
> Assigned To: Velocity-Dev List
> Priority: Blocker
>
> We are using Velocity as a part of TDK 2.1. The sample vm file below works
> fine with the bundled velocity library velocity-1.2-dev.jar but breaks when
> we
> upgrade to velocity-1.2, velocity-1.3, velocity-1.3.1-rc1, or velocity-1.3.1-
> rc2. The upgrade is necessary because we are passing objects of anonymous
> classes into the context, which 1.2-dev does not handle well and velocity-1.2
> upwards handles correctly.
> Below is a sample vm file that demonstrates this strange behavior. We are
> using menubar as tool to pull role-specific menubars, which is a miniversion
> of
> java.awt.MenuBar, implementing just enough methods to iterate through the
> menu
> and menuitem objects. It's import to use index to get the menu/menuitem
> within
> its container object because we are passing the menubar object to a macro
> which
> generates javascript-driven pull-down menus. The call $menu.getItem(j)
> throws
> a ReferenceException.
> ###########################################################
> #set ($bar = $menubar.getMenuBar("author"))
> menu bar name is $bar.Name<br/>
> menus are
> <ol>
> #set ($last = $bar.MenuCount - 1)
> #foreach ($i in [0..$last])
> #set ($menu = $bar.getMenu($i))
> <li>$menu.Label with items
> <ol>
> #set ($itemlast = $menu.ItemCount - 1)
> #foreach ($j in [0..$itemlast])
> #set ($item = $menu.getItem(j))
> <li>$item.Label has path $item.ActionCommand
> #end
> </ol>
> #end
> </ol>
> <hr/>
> <ol>
> #foreach ($menu in $bar.Menus)
> <li>$menu.Label with items
> <ol>
> #foreach ($item in $menu.Items)
> <li>$item.Label has path $item.ActionCommand
> #end
> </ol>
> #end
> </ol>
> ###########################################################
> This vm file is rendered into something like this:
> menu bar name is author
> menus are
> 1. Test with items
> 1. $item.Label has path $item.ActionCommand
> 2. $item.Label has path $item.ActionCommand
> 2. Classroom with items
> 1. $item.Label has path $item.ActionCommand
> 2. $item.Label has path $item.ActionCommand
> --------------------------------------------------------------------------------
> 1. Test with items
> 1. Create has path /author/test/create
> 2. View has path /author/test/view
> 2. Classroom with items
> 1. Create has path /author/classroom/create
> 2. View has path /author/classroom/view
--
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]