Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from alibaba/master
Browse files Browse the repository at this point in the history
bug fixed for null value
  • Loading branch information
VictorZeng committed Apr 21, 2016
2 parents e4229ef + e566c1e commit 6904358
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ public void writeValue(JSONSerializer serializer, Object propertyValue) throws E

ObjectSerializer fieldSerializer = runtimeInfo.fieldSerializer;

if ((out.writeMapNullValue)
&& fieldSerializer instanceof JavaBeanSerializer) {
out.writeNull();
return;
}

fieldSerializer.write(serializer, null, fieldInfo.name, fieldInfo.fieldType, fieldFeatures);
return;
}
Expand Down
24 changes: 22 additions & 2 deletions src/test/java/com/alibaba/json/bvt/bug/Bug_for_lenolix_7.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvt.parser.deser.generic.GenericTest4.Address;

import junit.framework.TestCase;

Expand All @@ -33,7 +32,7 @@ public void test_for_objectKey() throws Exception {

}

public static class User implements Serializable {
private static class User implements Serializable {

/**
*
Expand Down Expand Up @@ -106,4 +105,25 @@ public void setGmtModified(java.sql.Timestamp gmtModified) {
}

}

public static class Address {

private String value;

public Address(){
}

public Address(String value){
this.value = value;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

}
}

0 comments on commit 6904358

Please sign in to comment.