tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57309] Custom type conversion sometimes bypassed
Date Sat, 06 Dec 2014 16:43:04 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=57309

--- Comment #3 from Konstantin Kolinko <knst.kolinko@gmail.com> ---
Reviewing r1643367
Reviewing ELSupport.compare(Object, Object) and coerceToNumber(ctx, Object,
BigDecimal.class) calls there:

1. The first branch in compare() method:
        if (isBigDecimalOp(obj0, obj1)) {
            BigDecimal bd0 = (BigDecimal) coerceToNumber(ctx, obj0,
BigDecimal.class);
            BigDecimal bd1 = (BigDecimal) coerceToNumber(ctx, obj1,
BigDecimal.class);
            return bd0.compareTo(bd1);
        }

In this branch isBigDecimalOp check returned true, so one of operands is
already a BigDecimal.

QUESTION: Does coerceToNumber() need to call ELResolver to convert it? Can it
skip conversion if the object is already of the expected type.


2. Minor
                if (ctx.isPropertyResolved()) {
                    return (Number) result;
                }
It could be type.cast(result).

-- 
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


Mime
View raw message