https://issues.apache.org/bugzilla/show_bug.cgi?id=47428
Summary: JSTL converts BigDecimal to Long Product: Taglibs Version: unspecified Platform: PC OS/Version: Windows Server 2003 Status: NEW Severity: normal Priority: P2 Component: Standard Taglib AssignedTo: taglibs-dev@jakarta.apache.org ReportedBy: hhf...@163.com CC: hhf...@msn.com <c:if test="{foo==0}"> do something </c:if> If foo is a BigDecimal,JSTL converts its type to Long,which means if foo is in the range [0,1), for example,0.01,it always return true! That is not correct. I checked SUN's JSP2.0 specification,in the JSP.2.3.5.7 section. It says: A {==,!=,eq,ne} B • If A==B, apply operator • If A is null or B is null return false for == or eq, true for != or ne. • If A or B is BigDecimal, coerce both A and B to BigDecimal and then: If operator is == or eq, return A.equals( B ) If operator is != or ne, return !A.equals( B ) • If A or B is Float or Double coerce both A and B to Double, apply operator • If A or B is BigInteger, coerce both A and B to BigInteger and then: If operator is == or eq, return A.equals( B ) If operator is != or ne, return !A.equals( B ) • If A or B is Byte, Short, Character, Integer, or Long coerce both A and B to Long, apply operator • If A or B is Boolean coerce both A and B to Boolean, apply operator • If A or B is String coerce both A and B to String, compare lexically • Otherwise if an error occurs while calling A.equals(B), error • Otherwise, apply operator to result of A.equals(B) According to the third rule,it seems like no problem. but when I checked apache's implementation of JSTL, in the class org.apache.taglibs.standard.lang.jstl.Coercions,I found apache didn't implement the third specification.so the preceding example will be processed according to this rule: If A or B is Byte, Short, Character, Integer, or Long coerce both A and B to Long, apply operator that is, it will convert BigDecimal to Long! so, is this a bug or something? looking forward to your answering.Thanks! -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-dev-unsubscr...@jakarta.apache.org For additional commands, e-mail: taglibs-dev-h...@jakarta.apache.org