tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 3759] New: - Conversion from String to Object doesn't work.
Date Fri, 21 Sep 2001 10:57:36 GMT
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=3759>.
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=3759

Conversion from String to Object doesn't work.

           Summary: Conversion from String to Object doesn't work.
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: pduffin@volantis.com


If I have an attribute of a custom tag whose type is Object with a setter method
which looks like
   public void setObject (Object object);
and I set the attribute in the JSP page to a literal string
   ...object="hello world"...
it gets compiled into the following
   ....setObject (new String (hello world));
Notice that the string is unquoted so it fails to build.

The fix is to change line 304 of TagBeginGenerator.java from
            return "new String(" + s + ")";
to
            return "new String(" + writer.quoteString (s) + ")";

Additionally why does the specification require that this
conversion be implemented this way, what is wrong with
treating it just like the conversion to String and doing
            return writer.quoteString(s);
instead which will eliminate the need for creating a new
String object.

Mime
View raw message