DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38382>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38382

           Summary: equal tag bug : wrong string compare
           Product: Struts
           Version: 1.1 Final
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Taglibs
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Hi,
I found something strange using tag <logic:equal>. I didn't find anything about 
this problem, so I write a request here .

It seems logic:Equal tag can not compare properly a string like "35F" or "35D".
If you compare "35F" and "35", it says true, instead of false. I tried to debug 
and found this :

1st) Tag tries to compare in DOUBLE_COMPARE
2nd) When comparing in "DOUBLE_COMPARE" mode , we do this :
if (type == DOUBLE_COMPARE) {
            try {
                double doubleVariable =
                    Double.parseDouble(variable.toString());
                if (doubleVariable < doubleValue)
                    result = -1;
                else if (doubleVariable > doubleValue)
                    result = +1;
            } catch (NumberFormatException e) {
                result = variable.toString().compareTo(value);
            }
        } 
or, Double.parseDouble("35F") return 35.0
but Double.parseDouble("35A") throws Exception

In fact, Double.parseDouble("35F") or Double.parseDouble("35D") return 35.0 
because F or D means Float or Double ...

Is the bug still exits in newer versions ?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to