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

http://issues.apache.org/bugzilla/show_bug.cgi?id=35410

           Summary: NullPointerException when using out scriptlet (<%= obj
                    %>) on object with toString() returning null
           Product: Tomcat 5
           Version: 5.0.30
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Here is a simple test case to reproduce the bug:

        <%!
         class MyTestClass {
           public String toString() {
             return null;
           }
         }
        %>
        <%
          String nullString = null;
          MyTestClass test = new MyTestClass();
        %>
        <%= (Object) null %><%-- works well --%>
        <%= nullString %><%-- works well --%>
        <%= test %> <%-- crash --%>

this leads to:
java.lang.NullPointerException
        org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:337)
        org.apache.jasper.runtime.JspWriterImpl.print(JspWriterImpl.java:475)
        org.apache.jsp.test_jsp._jspService(test_jsp.java:65)

I consider this to be a bug cause nowhere in the behaviour of toString it is
specified it should not return null. Therefore, it should not crash like that.

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

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

Reply via email to