tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Luehe <Jan.Lu...@Sun.COM>
Subject [PATCH] Simplified scripting-variable declaration/synchronization in Generator.java
Date Fri, 24 May 2002 22:25:44 GMT
According to JSP.7.4 ("The Tag Library Descriptor Format"), it is
illegal for a tag to define scripting variables in both its TLD and
TagExtraInfo class.

Jasper already enforces this, but its code generator makes separate
method calls for declaring/synchronizing scripting variables from a
TLD and those from the TagExtraInfo class, like this:

  // Update AT_BEGIN variables
  updateVariableInfos(varInfos, VariableInfo.AT_BEGIN, false);
  updateTagVariableInfos(tagVarInfos, n.getTagData(),

This can be simplified, since if "varInfos" is non-null, "tagVarInfos"
must be null, and vice-versa.

The proposed patch collapses the above method calls into one.

Also, the code generator makes separate method calls to declare
AT_BEGIN scripting variables outside the try-finally block, and then
synchronizing them inside the try-finally block.

Now that try-finally has been flattened, no separate declaration of
AT_BEGIN variables is required, that is, AT_BEGIN variables can be
declared when they are first synchronized (after a call to
doStartTag()), just as NESTED and AT_END variables. This makes
declareVariableInfos() and declareTagVariableInfos() redundant

As a summary, the attached patch replaces

  declareVariableInfos(),
  declareTagVariableInfos(),
  updateVariableInfos(), and
  updateTagVariableInfos()

with a single

  syncScriptingVariables().


Jan



Mime
View raw message