Bug 47786 - 100<4 in arithmetic evaluation - when 2 variables are used
Summary: 100<4 in arithmetic evaluation - when 2 variables are used
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-04 06:54 UTC by Vasili
Modified: 2009-10-08 01:25 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasili 2009-09-04 06:54:30 UTC
Hi,

I'm getting 100<4==true - when using 2 variables while using of constant on any position - works correctly. I had to change the code (to take one variable from a bean and that works as well - to fix the problem in my code. But this seems to be weird...
Tried both jakarta-taglibs-standard-1.1.2.zip and jakarta-taglibs-20060829.zip -  behave the same.

test.jsp demonstrating the bug:
------8<------
<% 
	long x=4;
	pageContext.setAttribute("x", Long.toString(x));

	long y=100;
	pageContext.setAttribute("y", Long.toString(y));
%>
y=${y},x=${x}, ${y}&lt;${x} is ${y<x}
<br>
However if we'll change any of variables to a constant - no problem: <br>
y=100,x=${x}, 100&lt;${x} is ${100<x}<br>
y=${y},x=4, ${y}&lt;4 is ${y<4}<br>
y=100,x=4, 100&lt;4 is ${100<4}<br>
------8<------

what I'm getting in the browser:

------8<------
y=100,x=4, 100<4 is true
However if we'll change any of variables to a constant - no problem:
y=100,x=4, 100<4 is false
y=100,x=4, 100<4 is false
y=100,x=4, 100<4 is false
------8<------

thanks
Vasili
Comment 1 Henri Yandell 2009-10-08 00:35:22 UTC
Thanks for the report Vasili. I'll get this into the unit tests for 1.2 to see if that confirms and can then start debugging. Presumably the 100<4 is because it's treating it alphabetically.
Comment 2 Konstantin Kolinko 2009-10-08 01:25:40 UTC
"100"<"4" is, indeed, true

Note, that you use Long.toString() and thus are comparing Strings.
If you replace those calls with Long.valueOf(), you will get all those four "false"s that you are expecting.

Also, you are reporting this to a wrong product. EL expressions an a page are evaluated by JSP engine that is part of the web server that you are using, and not by any Taglib.