You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/08/05 14:44:58 UTC

DO NOT REPLY [Bug 22133] New: - Scoping conflict for generated fragment helpers

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=22133>.
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=22133

Scoping conflict for generated fragment helpers

           Summary: Scoping conflict for generated fragment helpers
           Product: Tomcat 5
           Version: 5.0.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: matthias.ernst@coremedia.com


A JSP Fragment in a tag file that does EL may lead to problematic Java code.

JSP Fragments of tag files are compiled into inner classes:

  public final class com_coremedia_jsp_NewsTicker_body_tag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
  {
    ...

    private class com_coremedia_jsp_NewsTicker_body_tagHelper
      extends org.apache.jasper.runtime.JspFragmentHelper
    {
      ...
      public void invoke0( java.io.Writer out ) 
        throws Throwable
      {
         ...
        
out.write((java.lang.String)org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${rows}",
java.lang.String.class, (PageContext)getJspContext(), null, false)); <<<<<<
         ...
      }
    }

Both javac 1.3 and Eclipse's JDT compiler flag the call to #getJspContext as
invalid as this method is both inherited and defined in the enclosing class: 

  com_coremedia_jsp_NewsTicker_body_tag.java:206: getJspContext() is inherited  
  from org.apache.jasper.runtime.JspFragmentHelper and hides method in outer  
  class org.apache.jsp.tag.web.com_coremedia_jsp_NewsTicker_body_tag.  An  
  explicit 'this' qualifier must be used to select the desired instance.

Javac 1.4.2 accepts this code and calls the inherited method.