boonproject / boon

Simple opinionated Java for the novice to expert level Java Programmer. Low Ceremony. High Productivity.
http://richardhightower.github.io/site/Boon/Welcome.html
Apache License 2.0
520 stars 102 forks source link

Boon Long conversion fails for larger numbers #354

Closed SagarN closed 8 years ago

SagarN commented 8 years ago

Some Numbers whose string length is equal to that of Long.Max
in this case it will fail at digit[1]. The digit[1] is greater than 2 (Long.Max[1])

@Test
    public void testBoonConversion () {
        final String aLongNumberAsString = "1520698688883654656";
        final long aLongNumberAsLong = Long.valueOf(aLongNumberAsString);

        Assert.assertTrue("Number is less than long max ", aLongNumberAsLong < Long.MAX_VALUE);
        Assert.assertEquals(" Numbers should match after conversion", aLongNumberAsString, String.valueOf(aLongNumberAsLong));
        Assert.assertTrue("Should be valid a long ", CharScanner.isLong(aLongNumberAsString.toCharArray(), 0, aLongNumberAsString.length()));

    }
slandelle commented 8 years ago

I've provided a PR against "advantageous/boon" with the fix. It should be easy to port, code seemed identical to me there.

RichardHightower commented 8 years ago

https://github.com/advantageous/boon/pull/19

RichardHightower commented 8 years ago

Sagar... you are using Advantageous Boon BTW since you are using QBit.

SagarN commented 8 years ago

Not sure what it means. Please clarify

On Jun 27, 2016, at 10:08 AM, Richard Hightower notifications@github.com wrote:

Sagar... you are using Advantageous Boon BTW since you are using QBit.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

RichardHightower commented 8 years ago

Stephane Landele fixed the qbit boon version. I will do a release with that fix.