Try creating the List as an ArrayList and copying the elements into it
using a loop. I assume this will work as you say you are not having
problems with other List types.
Also does a #foreach using the List created by Arrays.asList work? I am
using this function and have not noticed a problem, but off the top of
my head i do not know that i ever call size() from a template on the
resulting list.
If the problem appears to be in the object created by Arrays.asList, I
would mention it on the velocity list. Not sure whether this would be a
problem with velocity, but it could save some other users the trouble of
getting the same error.
john mcnally
David Wynter wrote:
>
> Hello,
>
> I have posted 4 times previously to this list and only once got a response
> and that was a friend I was working on a project with. So I must be doing
> something completely off the wall to get no help from the people on the list
> who 'know'.
>
> After spending hours trying different methods of saving a User with a Role
> and Group I achieved that (my last post). Now I wish to update the Role in
> the same screen. I use a pull tool for all entitylist population on screen.
> One of the methods is
>
> /**
> * Get all role from the turbine table
> */
> public List getAllRoles() throws Exception
> {
> Role[] roles=TurbineSecurity.getAllRoles().getRolesArray();
> return Arrays.asList(roles);
> }
>
> I also tried
>
> /**
> * Get all role from the turbine table
> */
> public List getAllRoles() throws Exception
> {
> Criteria crit = new Criteria();
> Role[] roles=TurbineSecurity.getRoles(crit).getRolesArray();
> return Arrays.asList(roles);
> }
>
> In the template I have:
>
> ## Set up entries in the roleType drop-down
> #set ( $userRoles = $entitylist.getAllRoles() )
> #if (!$selectedRole && ($userRoles.size()>0))
> #set ( $selectedRole=$userRoles.get(0) )
> #end
>
> I note that I get this exception when ever I access this template.
>
> [java] ASTMethod.execute() : exception invoking method 'size' in class
> java
> .util.Arrays$ArrayList : java.lang.IllegalAccessException
>
> If I put $selectedRole.getName() in the BODY of the HTML it never has a
> value displayed. I also tried
> putting $userRoles.size() in the BODY of the HTML and it never displays
> either. These are the roles I expect to see
>
> +---------+---------------+------------+
> | ROLE_ID | ROLE_NAME | OBJECTDATA |
> +---------+---------------+------------+
> | 1 | turbine_root | NULL |
> | 100 | Administrator | NULL |
> | 101 | Message User | NULL |
> +---------+---------------+------------+
>
> I have no problems with non TurbineSecurity related entities. Any idea about
> what is going on here?
>
> Thanks
>
> David Wynter
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>