You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/11/14 09:38:29 UTC

[Bug 54144] New: Processing of java.io.Reader in "Out" tagplugin

https://issues.apache.org/bugzilla/show_bug.cgi?id=54144

          Priority: P2
            Bug ID: 54144
          Assignee: dev@tomcat.apache.org
           Summary: Processing of java.io.Reader in "Out" tagplugin
          Severity: minor
    Classification: Unclassified
                OS: Windows XP
          Reporter: knst.kolinko@gmail.com
          Hardware: PC
            Status: NEW
           Version: 7.0.32
         Component: Jasper
           Product: Tomcat 7

Reviewing r1401816 I see two issues in tagplugin
o.a.jasper.tagplugins.jstl.core.Out:

The code that the plugin generates calls value.toString(), default.toString()
and passes these String values to the static method Out.output(...). This new
method was added in r1401816.

I think the output() method should accept Objects instead of Strings, because
the following is wrong:

1. The evaluation of default.toString() is not needed at all if the default is
not used.

2. The JSTL spec (1.1, 1.2) says that there is special processing if value is
java.io.Reader. There is no such processing in the current code. (It seems that
this feature was added in JSTL 1.1).

[quote]
If the result of the evaluation is not a java.io.Reader object, then it is
coerced to
a String and is subsequently emitted into the current JspWriter object.

If the result of the evaluation is a java.io.Reader object, data is first read
from the
Reader object and then written into the current JspWriter object.
[/quote]

These two issues are not new - they existed before the recent changes.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 54144] Processing of java.io.Reader in "Out" tagplugin

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54144

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
3. JSTL spec says (under "Null & Error Handling"):
"If no default value is specified, it itself defaults to an empty string."

In the current code:
a) A null is used instead of "" as the value of strDefName.
b) I suspect that the following check for "no default value specified" is
incorrect:
            ctxt.generateJavaSource("if(");
            ctxt.generateAttribute("default");
            ctxt.generateJavaSource(" != null){");

One has to check whether the attribute is present, instead of checking whether
its value is null.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 54144] Processing of java.io.Reader in "Out" tagplugin

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54144

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
I've fixed using body as the default issue in trunk and 7.0.x.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 54144] Processing of java.io.Reader in "Out" tagplugin

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54144

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Fixed in trunk and 7.0.x and will be included in 7.0.33 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 54144] Processing of java.io.Reader in "Out" tagplugin

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54144

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
(In reply to comment #1)
> One has to check whether the attribute is present, instead of checking
> whether its value is null.

Actually checking for null should be OK here. Apache implementation of JSTL
tests for null there. "if (def != null)" on line 100 in
http://svn.apache.org/viewvc/tomcat/taglibs/standard/tags/standard-112/src/org/apache/taglibs/standard/tag/common/core/OutSupport.java?view=markup


4. If default is not specified, the body of the tag has to be used as the
default value. This feature was completely broken by r1401816 as the following
lines were removed:

-        ctxt.generateJavaSource("    }else{");
-        ctxt.generateBody();
-        ctxt.generateJavaSource("    }");

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org