You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by bu...@apache.org on 2001/08/13 18:39:28 UTC

[DO NOT REPLY: Bug 2443] -

$data.session.id in a velocity  template causes IllegalAccessException

PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2443

*** shadow/2443	Sat Aug  4 22:22:01 2001
--- shadow/2443.tmp.27973	Mon Aug 13 09:39:28 2001
***************
*** 47,49 ****
--- 47,159 ----
  other apache products. It's just a configuration issue.
  
  If I ever figure out the policy file to use I'll post again.
+ 
+ ------- Additional Comments From peterlynch@mail.com  2001-08-13 09:39 -------
+ Ok, another twist. Seems this was more a velocity introspection issue. below is 
+ an email from Geir on the Velocity list regarding this issue after it was 
+ raised.
+ 
+ -----------------------8<----------------------
+ 
+ 
+ -----Original Message-----
+ From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
+ Sent: Saturday, August 11, 2001 12:30 PM
+ To: velocity-user@jakarta.apache.org
+ Subject: Re: IllegalAccessException thrown when calling a public method
+ !?
+ 
+ 
+ This is now fixed, thanks to a patch from Attila Szegedi
+ <sz...@freemail.hu>.
+ 
+ All introspection is now going through the central Introspector -
+ Reference and PropExec were doing it on their own, and that wasn't cool.
+ 
+ I tested with a few things, such as accessing HttpSession from a
+ template in Tomcat :
+ 
+ #set($sess = $req.getSession() )
+ 
+ Creation time : $sess.getCreationTime()
+ 
+ <br>
+ Attributes :
+ #foreach($a in $sess.getAttributeNames() )
+   $a <br>
+ #end
+ 
+ $sess.setAttribute("sessatt", [1..10])
+ 
+ #foreach($b in $sess.getAttribute("sessatt"))
+   $b<br>
+ #end
+ 
+ and all is peachy, as well as the simple test
+ 
+ #set($array = [1..10])
+ #set($it = $array.iterator())
+ 
+ #foreach($num in [21..30])
+    $num $it.next()
+ #end
+ 
+ which tests the inner classes of Collection.
+ 
+ I think I can do a bit of boiling (and there was another speed thing
+ that Attila noted) as well as the realization that Introspector is still
+ a singleton, so will work on that tomorrow, I hope :)
+ 
+ The long and the short - give it a try if you have been experiencing
+ problems re this, and report back with examples of any difficulties.
+ 
+ This should solve the problems in discussion threads :
+ 
+ How do I access a session using HttpSession in a Velocity template
+ IllegalAccessException thrown when calling a public method 
+ dynamic casting to avoid IllegalAccessExceptions
+ [PATCH] ASTMethod / IllegalAccessException
+ Re: Following up on key / value loops and Map.Entry
+ et al 
+ 
+ (yep - I keep track :)
+ 
+ geir
+ 
+ 
+ Mike Williams wrote:
+ > 
+ > I'm trying to write a Javadoc doclet that uses Velocity, like this
+ > 
+ >     com.sun.javadoc.RootDoc root = getRoot();
+ >     VelocityContext context = new VelocityContext();
+ >     context.put( "root", root );
+ >     context.put( "rootName", root.name() );  // test
+ >     template.merge( context, writer );
+ > 
+ > But I'm having troubles calling methods on the Javadoc objects.  I've got a
+ > simple template like this:
+ > 
+ >     root: $root
+ >     rootName: ${rootName}
+ >     root.name(): ${root.name()}
+ > 
+ > When I run my doclet under Javadoc, it throws an IllegalAccessException!
+ > 
+ >     ASTMethod.execute() : exception invoking method 'name' in class
+ >         com.sun.tools.javadoc.RootDocImpl : java.lang.IllegalAccessException
+ > 
+ > And the output is as follows:
+ > 
+ >     root: *RootDoc*
+ >     rootName: *RootDoc*
+ >     root.name(): ${root.name()}
+ > 
+ > Why would "root.name()" be accessible to my doclet class, but not to
+ > Velocity??
+ 
+ -- 
+ Geir Magnusson Jr.                           geirm@optonline.net
+ System and Software Consulting
+ Developing for the web?  See http://jakarta.apache.org/velocity/
+ Well done is better than well said - New England Proverb

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org