Skip to content

Commit

Permalink
add testcase for issue 228. #288
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Apr 13, 2016
1 parent fb3edc8 commit 0bcdb20
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_184.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alibaba.json.bvt.bug;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;

import junit.framework.TestCase;

public class Bug_for_issue_184 extends TestCase {

public void test_for_issue() throws Exception {
TUser user = new TUser();
user.id = 1001;
// 禁用asm(在android下使用),启用asm则没问题。
SerializeConfig.getGlobalInstance().setAsmEnable(false);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
// 输出{"@type":"xx.TUser","id":0L}
System.out.println(json);
// 下面反系列化错误:com.alibaba.fastjson.JSONException: unclosed.str
// 原因:id带L后缀
user = (TUser) JSON.parse(json);
}

public static class TUser {

public long id;
}
}

0 comments on commit 0bcdb20

Please sign in to comment.