Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boon cannot deserialize negative numbers #357

Closed
codemonstur opened this issue Aug 28, 2016 · 2 comments
Closed

Boon cannot deserialize negative numbers #357

codemonstur opened this issue Aug 28, 2016 · 2 comments

Comments

@codemonstur
Copy link

import io.advantageous.boon.json.JsonFactory;
import io.advantageous.boon.json.ObjectMapper;
import org.junit.Test;

public class TestSerialization {
    private final ObjectMapper mapper = JsonFactory.create();

    class ThisIsAnInt {
        public int value = -1062731519;
    }

    @Test
    public void testDeserialize() {
        String json = mapper.toJson(new ThisIsAnInt());
        mapper.fromJson(json, ThisIsAnInt.class);
    }
}

MESSAGE: fieldName value of class class nl.spero.hostrank.classifier.test.TestSerialization$ThisIsAnInt had issues for value -1062731519 for field FieldInfo [name=value, type=int, parentType=class nl.spero.hostrank.classifier.test.TestSerialization$ThisIsAnInt]

 CAUSE io.advantageous.boon.core.Exceptions$SoftenedException :: not an int

ROOT CAUSE MESSAGE: not an int 
     This happens around this area in your code.
          io.advantageous.boon.core.reflection.MapperSimple.fromValueMap(MapperSimple.java:1134)
          io.advantageous.boon.json.JsonMappingParser.finalExtract(JsonMappingParser.java:210)
          io.advantageous.boon.json.JsonMappingParser.parse(JsonMappingParser.java:202)
          io.advantageous.boon.json.implementation.ObjectMapperImpl.readValue(ObjectMapperImpl.java:68)
          io.advantageous.boon.json.implementation.ObjectMapperImpl.fromJson(ObjectMapperImpl.java:279)
@codemonstur
Copy link
Author

Looks like something went wrong during testing. I initially used version 0.6.1 to run this test where it failed. Then I updated to the latest 0.6.6 and got the same error. However, I cannot reproduce it now. I tried some other versions and can get the code to fail reliably for version 0.6.3 and lower. But no longer in the latest version. Perhaps there was a caching error of some kind on my side.
Apologies.

@RichardHightower
Copy link
Contributor

Thanks. I am glad this is fixed. Let me know if you can reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants