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

Map null key值序例化空指针 #1503

Closed
Luckywb opened this issue Sep 29, 2017 · 1 comment
Closed

Map null key值序例化空指针 #1503

Luckywb opened this issue Sep 29, 2017 · 1 comment
Labels
Milestone

Comments

@Luckywb
Copy link

Luckywb commented Sep 29, 2017

版本1.2.38

static {
    ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
}

public static class Bean {

}

@Test
public void test() {
    Map<Long, Bean> map = new HashMap<>();
    map.put(null, new Bean());
    Map<Long, Bean> rmap = (Map<Long, Bean>) JSON.parse(JSON.toJSONString(map, SerializerFeature.WriteClassName));
    System.out.println(rmap);
}
java.lang.NullPointerException
	at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:518)
	at com.alibaba.fastjson.parser.deserializer.MapDeserializer.deserialze(MapDeserializer.java:64)
	at com.alibaba.fastjson.parser.deserializer.MapDeserializer.deserialze(MapDeserializer.java:41)
	at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:358)
	at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1321)
	at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1287)
	at com.alibaba.fastjson.JSON.parse(JSON.java:139)
	at com.alibaba.fastjson.JSON.parse(JSON.java:130)
	at com.yhtframework.utils.third.FastjsonUtilsTest.test(FastjsonUtilsTest.java:63)
wenshao added a commit that referenced this issue Oct 1, 2017
@wenshao wenshao added the bug label Oct 1, 2017
@wenshao wenshao added this to the 1.2.39 milestone Oct 1, 2017
@wenshao
Copy link
Member

wenshao commented Oct 1, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.39
问题已经修复,请用新版本

@wenshao wenshao closed this as completed Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants