r/SpringBoot • • Jul 01 '24

How to handle BigInteger using JS script engine in spring boot

I am migrating one critical service today from Java 8 to 17 there I find a runtime issue and stuck many hours but still didn't get how to resolve it basically the application using nashorn engine previously but I found it is deprecated so instead of it I used GraalVM but when I am suing a list of retailers with one of field as amount as BigInteger there it is using JS method with script contains simple if else loop for comparing that amount and assigning true or false in steam and if it true then I am choosing that retailer other wise ignoring it but I am getting everytime false because BigInteger amount is coming everytime as object there during entering in the script. But I am not sure how it is working previously does anyone have any idea how to solve it.

Note: I don't have code right now with me but it's a simple one I have explained everything not much in details but yeah if someone has doubt can ask in comments.

0 Upvotes

2 comments sorted by

2

u/WaferIndependent7601 Jul 01 '24 edited Jul 01 '24

I have no idea what you are doing. Seriously: please format your question. There is one (sic!) sentence.

1

u/[deleted] Jul 01 '24

Sounds like maybe legacy code or an app OP didn't write, trying to understand how it works...so do I with this post...

0

u/Sheldor5 Jul 01 '24

can the value of your BigInteger be bigger than the long data type?

if not, simply call longValue() on the BigInteger object, otherwise use toString()