Issues

Select view

Select search mode

 

InputBaseN casting to int unnecessarily

Fixed

Description

https://github.com/lucee/Lucee/blob/master/core/src/main/java/lucee/runtime/functions/math/InputBaseN.java

public static double call(PageContext pc , String string, double radix) throws ExpressionException { ... return (int)Long.parseLong(string, (int)radix); }

Long.parseLong(string, radix) is performing the actual BaseN conversion.
The returned value is a double.
However there is a casting to (int) which appears to be unnecessary.

The consequence is that the following code does not return the correct result:

<cfdump var="#InputBaseN('40390719E3C0', 16)#">

This returns the correct result:

<cfdump var="#CreateObject('java', 'java.lang.Long').parseLong('40390719E3C0', 16)#">

Environment

None

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 28 December 2017 at 08:02
Updated 4 April 2018 at 15:42
Resolved 4 April 2018 at 15:42

Activity

Show:

Pothys - MitrahSoft2 January 2018 at 07:29

I've added test case for this ticket & confirmed issue happened on lucee. InputBaseN function returns as integer which is not expected result. I fixed the issue, after this fix it's working fine for me.

PullRequest: https://github.com/lucee/Lucee/pull/360

Flag notifications