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

NPE when using custom extends class

           Summary: NPE when using custom extends class
           Product: Tomcat 5
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper2
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Jasper currently relies on the non-standard methods "_jspInit" 
and "_jspDestroy".  Since these methods are found nowhere in either the Servlet 
or Jsp specs, there is no reason that a custom "extends" class should either 
implement them or call them.  The result is that all of the tag-pools remain un-
initialized, so the first access to a tag causes an NPE.

Initialization is easy to solve (i.e. it could be moved to the constructor, you 
could have a flag that is checked in _jspService, etc.).  Releasing is the hard 
part.  About all that I can see (without majorly changing the current 
implementation) is to add a finalize method, which is just too ugly for 
words :).

The other solution I can see would be to add code to the JSP page like:

  private Tag getTag(org.apache.jasper.runtime.TagHandlerPool pool, Class tagC){
    Tag result = null;
    if(pool == null) {
      try {
        result = tagC.newInstance();
      } catch(Exception ex) {
      }
    } else {
      result = pool.get(tagC);
    }
    return result;
   }
   private void putTag(org.apache.jasper.runtime.TagHandlerPool pool, Tag tag) {
    if( pool == null ) {
      tag.release();
    } else {
      pool.reuse(tag);
    }
   }

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

Reply via email to