DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12517>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

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

JSP compilation error with nested scripting variable

           Summary: JSP compilation error with nested scripting variable
           Product: Tomcat 4
           Version: 4.1.9
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Jasper 2
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hello

The actual version of Tomcat is 4.1.10, but there's no choice for it.

I've a JSP page extending TagSupport with a custom tag that defines a scripting 
variable with a NESTED scope. Here's the extra info class:

public class WizardExtraInfo extends TagExtraInfo {

    public VariableInfo[] getVariableInfo(TagData data) {
        return new VariableInfo[] {
            new VariableInfo("profiles",
                             "browser.client.jsp.Profiles",
                             true,
                             VariableInfo.NESTED)
        };
    }
}

When referencing the scripting variable inside the tag body a 
NullPointerException is thrown. Looking at the generated java code I see that 
the variable is declared immediately after doStartTag() but synchronized only 
after doAfterBody().

      /* ----  cb:wizard ---- */
      browser.client.jsp.tag.Wizard _jspx_th_cb_wizard_0 = 
browser.client.jsp.tag.Wizard) 
_jspx_tagPool_cb_wizard_undoAction_nextPage_nextAction_cancelAction.get
(browser.client.jsp.tag.Wizard.class);
      _jspx_th_cb_wizard_0.setPageContext(pageContext);
      _jspx_th_cb_wizard_0.setParent(null);
      _jspx_th_cb_wizard_0.setXXX;
      int _jspx_eval_cb_wizard_0 = _jspx_th_cb_wizard_0.doStartTag();
      if (_jspx_eval_cb_wizard_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        browser.client.jsp.Profiles profiles = null;
        do {

          /* body */
          ...
          profiles.get(...); // throws NullPointerException
          ...
          /* end body */

          int evalDoAfterBody = _jspx_th_cb_wizard_0.doAfterBody();
          profiles = (browser.client.jsp.Profiles) pageContext.findAttribute
("profiles");
          if (evalDoAfterBody != 
javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
      }
      if (_jspx_th_cb_wizard_0.doEndTag() == 
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
        return;
      _jspx_tagPool_cb_wizard_undoAction_nextPage_nextAction_cancelAction.reuse
(_jspx_th_cb_wizard_0);

The same page compiled with Tomcat 3.3.1 correctly translates to

int _jspx_eval_cb_wizard_0 = _jspx_th_cb_wizard_0.doStartTag();
if (_jspx_eval_cb_wizard_0 == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_TAG)
    throw new JspTagException("Since tag handler...");
if (_jspx_eval_cb_wizard_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
    do {
        browser.client.jsp.Profiles profiles = null;
        profiles = (browser.client.jsp.Profiles) pageContext.findAttribute
("profiles");
    ....

Thanks in advance.

Daniele Gaffuri

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to