#2 a bug with JSONField annotation

v1.0 (example)
open
nobody
5
2011-12-26
2011-12-26
Anonymous
No

now m using fastjson v1.1.14. and when i using annotation of @JSONField(format="yyyy年MM月dd日"), whick is the chinese date formate. the code will throw an exception as following:

Exception in thread "main" com.alibaba.fastjson.JSONException: create asm serilizer error,

and my code as following:

public class Person {
private String name;
private Date birthday;
@JSONField(name="StudentName")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@JSONField(name="StudentBirthday", format="yyyy年MM月dd日")
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
@JSONCreator()
public Person(@JSONField(name="StudentName")String name, @JSONField(name="StudentBirthday")Date birthday) {
this.name = name;
this.birthday = birthday;
}
}

mainmethod:

public static void main(String[] args){
new Person("Mc", Calendar.getInstance().getTime());
}

if i change the format from yyyy年MM月dd日 to yyyy-MM-dd, it will be OK.
is there anyone can help me to resolve the problem? Thx :)

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks