Author: markt Date: Wed Jan 2 15:11:24 2013 New Revision: 1427821 URL: http://svn.apache.org/viewvc?rev=1427821&view=rev Log: Revert the fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=35410 as it is not specification compliant Remove the remainder of the write(String) method as well as it serves no purpose since it is identical to the method it overrides. Add some test cases to confirm the expected/correct behaviour Note: BZ 35410 claims there is no requirement for Object.toString() to be non-null. Many have argued (and I agree) that null is not a String representation and therefore not a valid return value for Object.toString().
Added: tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestJspWriterImpl.java - copied unchanged from r1427804, tomcat/trunk/test/org/apache/jasper/runtime/TestJspWriterImpl.java tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug54241a.jsp - copied unchanged from r1427804, tomcat/trunk/test/webapp-3.0/bug5nnnn/bug54241a.jsp tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug54241b.jsp - copied unchanged from r1427804, tomcat/trunk/test/webapp-3.0/bug5nnnn/bug54241b.jsp Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1427804 Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java?rev=1427821&r1=1427820&r2=1427821&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/JspWriterImpl.java Wed Jan 2 15:11:24 2013 @@ -339,21 +339,6 @@ public class JspWriterImpl extends JspWr } } - /** - * Write a string. This method cannot be inherited from the Writer class - * because it must suppress I/O exceptions. - */ - @Override - public void write(String s) throws IOException { - // Simple fix for Bugzilla 35410 - // Calling the other write function so as to init the buffer anyways - if(s == null) { - write(s, 0, 0); - } else { - write(s, 0, s.length()); - } - } - static String lineSeparator = System.getProperty("line.separator"); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1427821&r1=1427820&r2=1427821&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jan 2 15:11:24 2013 @@ -54,6 +54,19 @@ issues to not "pop up" wrt. others). --> <section name="Tomcat 7.0.35 (markt)"> + <subsection name="Jasper"> + <changelog> + <fix> + <bug>54241</bug>: Revert the fix for <bug>35410</bug> as it was not + compliant with the JSP specification, specifically that + <code><%= obj %></code> must be translated to + <code>out.write(String.valueOf(obj))</code> which will trigger a + <code>NullPointerException</code> if <code>obj.toString()</code> returns + <code>null</code>. The fix for <bug>35410</bug> incorrectly suppressed + the <code>NullPointerException</code> in this case. + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 7.0.34 (markt)" rtext="2012-12-12"> <subsection name="Catalina"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org