Issue with long type values
See original GitHub issueHi,
Seems like when migrating from java 8 to java 11 something changed with handling variables with a long-type value.
For example:
When using java 8, the following code:
* def n = function(){ return java.lang.Long.valueOf("1561470994959") }
* print n()
Will result in:
[ForkJoinPool-1-worker-1] INFO com.intuit.karate - [print] 1561470994959
But when running the exact same code but with java 11, you get:
[ForkJoinPool-1-worker-3] INFO com.intuit.karate - [print] 1.561470994959E12
This was tested using the latest Karate version (0.9.3)
I didn’t find any reference for any special-handling that should be done with long values, is it a bug or am I doing something wrong.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Issue with long type values · Issue #811 · karatelabs/karate
Hi, Seems like when migrating from java 8 to java 11 something changed with handling variables with a long-type value.
Read more >Can anyone tell me why it is giving error, while using long ...
Append L after your big numbers, so that they are considered of type long . e.g 9223372036854775807L . By default, number literals are...
Read more >Long data type | Microsoft Learn
Long (long integer) variables are stored as signed 32-bit (4-byte) numbers ranging in value from -2,147,483,648 to 2,147,483,647.
Read more >Error in getting Long data type from Table - Oracle Communities
Hi All, I have one table say xx_long. In this table one column is having Long data type. Now I want this values...
Read more >Assigning long values - IBM
Assigning constant values to long variables can lead to unexpected results. This issue is explored in more detail in Assigning constant values to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@EB123 many thanks for the update ! I’ll probably change that to
function(){ return java.lang.System.currentTimeMillis() + '' }
@ptrthomas By the way, I think it means that:
function(){ return java.lang.System.currentTimeMillis() }
as suggested in the Commonly Needed Utilities section won’t work on java 11 without theBigDecimal
addition (this was the original use case that brought us to this issue).