https://issues.apache.org/bugzilla/show_bug.cgi?id=48616

--- Comment #20 from Konstantin Kolinko <knst.koli...@gmail.com> 2010-02-16 
03:23:00 UTC ---
Created an attachment (id=24991)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24991)
2010-02-16_tc7_bug42390_bug48616.patch

Patch for trunk that
- reverts r905145,
- provides an alternative fix for bug 48616 and bug 42390,
- replaces Vector -> List, Hashtable -> HashMap in the affected API.

The essence of this fix is that all those java variable declarations are not
needed when we are inside a JspFragment, because it is scriptless.

That simplifies a lot and fixes bug 42390 and bug 48616 along the way.

ScriptingVariabler provides a list of Java variables to be declared,
filtering out those names that are already declared in the parent scopes
(because those are still visible). That logic does not work when we enter a
JspFragment, because a fragment is implemented in the generated servlet as a
method, and does not see those variables in the calling scope.

Instead of trying to fix ScriptingVariabler to detect being in those fragments
and provide better lists, I make observation that in those fragments the Java
variables can be not used at all.  Thus, we can ignore ScriptingVariabler
exactly in those cases when it is wrong.


Future optimization might be to change
ScriptingVariabler#ScriptingVariableVisitor and
Generator#declareTemporaryScriptingVars#ScriptingVarVisitor to do not descend
into fragments, as what they do will be ignored, but that will require to
reimplement all code paths how Generator#GenerateVisitor#generateJspFragment()
is called. I see 3 such code paths, and while they are not too complicated,
they are not too trivial either, and I am afraid to introduce bugs when
implementing them.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to