You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Samuel Niles Peretz <sn...@commercetone.com> on 2001/04/05 16:21:42 UTC

jasper bug

org/apache/jasper/runtime/JspRuntimeLibrary.java
in the method: introspecthelper
This is a fix for the bug in handling jsp:setProperty for text fields (as posted in
previous bug reports such as http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1207)
where set method of property is not invoked for blank text fields.

The fix is simply to add another condition in the if statement that checks for a
null or blank value.  The method should only return on a blank value if the type of
the property is something other than java.lang.String.  That is, for a property of
type java.lang.String, the method should invoke the set method for that property
even if the value is blank.

Here is the unified diff, with the original version first:

diff -ubB /tmp/saved/JspRuntimeLibrary.java
/dev/main/jetty/src/org/apache/jasper/runtime/JspRuntimeLibrary.java
--- /tmp/saved/JspRuntimeLibrary.java   Thu Apr 05 10:12:32 2001
+++ /dev/main/jetty/src/org/apache/jasper/runtime/JspRuntimeLibrary.java        Thu
Apr 05 10:17:18 2001
@@ -194,7 +194,7 @@
                         createTypedArray (bean, method, values, t);
                     }
                 } else {
-                   if(value == null || (param != null && value.equals(""))) return;
+                   if(value == null || (param != null && value.equals("") &&
!type.getName().equals( "java.lang.String" ))) return;

                     Object oval = convert(value, type);
                     if ( oval != null )
                         method.invoke(bean, new Object[] { oval });