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

com.alibaba.fastjson.serializer.IntegerCodec bug #534

Closed
dynastyX opened this issue Apr 5, 2016 · 3 comments
Closed

com.alibaba.fastjson.serializer.IntegerCodec bug #534

dynastyX opened this issue Apr 5, 2016 · 3 comments

Comments

@dynastyX
Copy link

dynastyX commented Apr 5, 2016

L49

if (fieldType == long.class) {
            out.writeLong(value.longValue());
        } else {
            out.writeInt(value.intValue());
        }

没有考虑java.lang.Long

@wenshao
Copy link
Member

wenshao commented Apr 5, 2016

能构造重现问题的case么?

@dynastyX
Copy link
Author

dynastyX commented Apr 7, 2016

public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }

    public void testFastJson() throws Exception {

        Value value = new Value();
        value.aLong = 2459838341588L;

        // {"aLong":-1177919020}
        Log.d("test", JSON.toJSONString(value));
    }

    class Value {

        private Long aLong;

        public Long getaLong() {
            return aLong;
        }

        public void setaLong(Long aLong) {
            this.aLong = aLong;
        }
    }
}

@wenshao
Copy link
Member

wenshao commented Apr 8, 2016

你用的什么版本?,我测试到1.1.47.android版本有问题,已经修复。告诉我你用的哪个版本,我好做验证。

@wenshao wenshao added this to the 1.1.48.android milestone Apr 8, 2016
@wenshao wenshao closed this as completed Apr 8, 2016
asa1997 pushed a commit to Be-Secure/fastjson that referenced this issue Feb 8, 2023
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