question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with long type values

See original GitHub issue

Hi,

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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Jun 25, 2019

@EB123 many thanks for the update ! I’ll probably change that to function(){ return java.lang.System.currentTimeMillis() + '' }

0reactions
EB123commented, Jun 25, 2019

@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 the BigDecimal addition (this was the original use case that brought us to this issue).

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found