Java-Thread-Affinity icon indicating copy to clipboard operation
Java-Thread-Affinity copied to clipboard

fixed NumberFormatException when core 63 was used in -Daffinity.reserved

Open m-anthony opened this issue 3 years ago • 2 comments

The fix for using -Daffinity.reserved with more than 64 core (#68) has an issue : to compute the bitset representing that mask, it uses under the hood Long.parseLong(substring, 16) where substring is at most 16 hexadecimal digits. Unfortunately, if the highest bit is set (so if core 63 is selected in the mask), it will cause a NumberFormatException because there is an overflow (because Java types are all signed).

This PR fixes that by splitting the parsing into 2 ints and combining them into a long

m-anthony avatar Nov 24 '21 16:11 m-anthony

Thanks @m-anthony - could I suggest you add a test that would have failed with the old behaviour?

JerryShea avatar Nov 25 '21 00:11 JerryShea

Hi @m-anthony this sounds useful. Could you add a test that would have failed with the old behaviour?

JerryShea avatar Jun 21 '23 05:06 JerryShea