The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1600/Issue1653.java
9 issues
Line: 14
import java.util.Map;
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
Reported by PMD.
Line: 24
config.putDeserializer(Map.class, deserializer);
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 25
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 25
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 8
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.MapDeserializer;
import junit.framework.TestCase;
import org.apache.commons.collections4.map.*;
import java.lang.reflect.Type;
import java.util.Map;
public class Issue1653 extends TestCase {
Reported by PMD.
Line: 15
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
Reported by PMD.
Line: 15
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
Reported by PMD.
Line: 16
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
config.putDeserializer(Map.class, deserializer);
Reported by PMD.
Line: 16
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
config.putDeserializer(Map.class, deserializer);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_2.java
9 issues
Line: 13
public class JSONFieldTest_unwrapped_2 extends TestCase {
public void test_jsonField() throws Exception {
String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
Reported by PMD.
Line: 13
public class JSONFieldTest_unwrapped_2 extends TestCase {
public void test_jsonField() throws Exception {
String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
Reported by PMD.
Line: 18
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
Reported by PMD.
Line: 19
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
Reported by PMD.
Line: 19
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
public int id;
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
public int id;
Reported by PMD.
Line: 27
public static class VO {
public int id;
private Map<String, Object> properties = new LinkedHashMap<String, Object>();
@JSONField(unwrapped = true)
public void setProperty(String key, Object value) {
properties.put(key, value);
}
Reported by PMD.
Line: 27
public static class VO {
public int id;
private Map<String, Object> properties = new LinkedHashMap<String, Object>();
@JSONField(unwrapped = true)
public void setProperty(String key, Object value) {
properties.put(key, value);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_0.java
9 issues
Line: 10
public class JSONFieldTest_unwrapped_0 extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.id = 123;
vo.localtion = new Localtion(127, 37);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 10
public class JSONFieldTest_unwrapped_0 extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.id = 123;
vo.localtion = new Localtion(127, 37);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 19
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
public int id;
Reported by PMD.
Line: 21
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
public int id;
Reported by PMD.
Line: 25
}
public static class VO {
public int id;
@JSONField(unwrapped = true)
public Localtion localtion;
}
Reported by PMD.
Line: 28
public int id;
@JSONField(unwrapped = true)
public Localtion localtion;
}
public static class Localtion {
public int longitude;
public int latitude;
Reported by PMD.
Line: 32
}
public static class Localtion {
public int longitude;
public int latitude;
public Localtion() {
}
Reported by PMD.
Line: 33
public static class Localtion {
public int longitude;
public int latitude;
public Localtion() {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/IntFieldTest2.java
9 issues
Line: 17
public class IntFieldTest2 extends TestCase {
public void test_model() throws Exception {
Model model = new Model();
model.id = -1001;
model.id2 = -1002;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 26
Assert.assertEquals("{\"id\":-1001,\"id2\":-1002}", text);
}
public void test_model_max() throws Exception {
Model model = new Model();
model.id = Integer.MIN_VALUE;
model.id2 = Integer.MAX_VALUE;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 42
}
}
public void test_model_map() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}}";
JSONReader reader = new JSONReader(new StringReader(text));
Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
});
Reported by PMD.
Line: 54
reader.close();
}
public void test_model_map_error() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
Reported by PMD.
Line: 68
Assert.assertNotNull(error);
}
public void test_model_map_error_2() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
Reported by PMD.
Line: 84
public static class Model {
public int id;
public int id2;
}
}
Reported by PMD.
Line: 85
public static class Model {
public int id;
public int id2;
}
}
Reported by PMD.
Line: 57
public void test_model_map_error() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
reader.readObject(new TypeReference<Map<String, Model>>() {
});
} catch (JSONException ex) {
Reported by PMD.
Line: 71
public void test_model_map_error_2() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
reader.readObject(new TypeReference<Map<String, Model>>() {
});
} catch (JSONException ex) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest6.java
9 issues
Line: 13
public class JSONFieldTest6 extends TestCase {
public void test_for_issue1()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map1 = new HashMap();
map1.put( 111,666 );
nonStringMap.setMap1( map1 );
Reported by PMD.
Line: 20
map1.put( 111,666 );
nonStringMap.setMap1( map1 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map1\":{\"111\":666}}", json );
}
public void test_for_issue2()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 23
assertEquals( "{\"map1\":{\"111\":666}}", json );
}
public void test_for_issue2()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map2 = new HashMap();
map2.put( 222,888 );
nonStringMap.setMap2( map2 );
Reported by PMD.
Line: 30
map2.put( 222,888 );
nonStringMap.setMap2( map2 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map2\":{222:\"888\"}}", json );
}
public void test_for_issue3()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 33
assertEquals( "{\"map2\":{222:\"888\"}}", json );
}
public void test_for_issue3()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map3 = new HashMap();
map3.put( 333,999 );
nonStringMap.setMap3( map3 );
Reported by PMD.
Line: 40
map3.put( 333,999 );
nonStringMap.setMap3( map3 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
}
public void test_for_issue4()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 43
assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
}
public void test_for_issue4()
{
NonStringMap nonStringMap = new NonStringMap();
Bean person = new Bean();
person.setAge( 23 );
nonStringMap.setPerson( person );
Reported by PMD.
Line: 50
person.setAge( 23 );
nonStringMap.setPerson( person );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
}
class NonStringMap
{
@JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )
Reported by PMD.
Line: 53
assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
}
class NonStringMap
{
@JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )
private Map map1;
public Map getMap1()
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_Object_2_public.java
9 issues
Line: 13
public class WriteAsArray_Object_2_public extends TestCase {
public void test_0() throws Exception {
A a = new A();
a.setId(123);
a.setName("wenshao");
VO vo = new VO();
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 30
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
private A value;
public int getId() {
Reported by PMD.
Line: 53
}
public static class A {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1600/Issue1603_getter.java
9 issues
Line: 11
import java.util.Collections;
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Reported by PMD.
Line: 13
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 13
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 16
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Reported by PMD.
Line: 18
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 18
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 21
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
Reported by PMD.
Line: 23
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
private final Collection<String> values = Collections.emptySet();
Reported by PMD.
Line: 23
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
private final Collection<String> values = Collections.emptySet();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest6.java
9 issues
Line: 15
public class TypeReferenceTest6 extends TestCase {
public void test_typeRef() throws Exception {
TypeReference<Map<String, Entity>> typeRef = new TypeReference<Map<String, Entity>>() {
};
Map<String, Entity> map = JSON.parseObject(
"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);
Reported by PMD.
Line: 22
Map<String, Entity> map = JSON.parseObject(
"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
Reported by PMD.
Line: 24
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
Reported by PMD.
Line: 25
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 25
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 29
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
private List<A> list = new ArrayList<A>();
public String getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_Johnny.java
9 issues
Line: 60
private String stringType;
private byte byteType;
private short shortType;
private int intType;
private long longType;
private char charType;
private float floatType;
private double doubleType;
Reported by PMD.
Line: 137
/**
* @return the shortType
*/
public short getShortType() {
return shortType;
}
/**
* @param shortType
Reported by PMD.
Line: 145
* @param shortType
* the shortType to set
*/
public void setShortType(short shortType) {
this.shortType = shortType;
}
/**
* @return the intType
Reported by PMD.
Line: 47
myObject.setListType(listObj);
String text = JSON.toJSONString(myObject, SerializerFeature.WriteClassName);
System.out.println(text);
MyObject myObject2 = (MyObject) JSON.parse(text);
Assert.assertEquals(myObject2.getMapType(), myObject.getMapType());
}
public static enum EnumType {
Reported by PMD.
Line: 18
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Bug_for_Johnny extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_Johnny.");
}
public void test_bug()throws Exception {
MyObject myObject = new MyObject();
Reported by PMD.
Line: 19
public class Bug_for_Johnny extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_Johnny.");
}
public void test_bug()throws Exception {
MyObject myObject = new MyObject();
List<String> listObj = new LinkedList<String>();
Reported by PMD.
Line: 22
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_Johnny.");
}
public void test_bug()throws Exception {
MyObject myObject = new MyObject();
List<String> listObj = new LinkedList<String>();
Set<String> setObj = new HashSet<String>();
Map<String, String> mapObj = new HashMap<String, String>();
listObj.add("aaa");
Reported by PMD.
Line: 49
String text = JSON.toJSONString(myObject, SerializerFeature.WriteClassName);
System.out.println(text);
MyObject myObject2 = (MyObject) JSON.parse(text);
Assert.assertEquals(myObject2.getMapType(), myObject.getMapType());
}
public static enum EnumType {
MD5, SHA1
}
Reported by PMD.
Line: 56
MD5, SHA1
}
public static class MyObject {
private String stringType;
private byte byteType;
private short shortType;
private int intType;
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/EnumSerializer.java
9 issues
Line: 28
*/
public class EnumSerializer implements ObjectSerializer {
private final Member member;
public EnumSerializer() {
this.member = null;
}
Reported by PMD.
Line: 31
private final Member member;
public EnumSerializer() {
this.member = null;
}
public EnumSerializer(Member member) {
this.member = member;
}
Reported by PMD.
Line: 43
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
if (member == null) {
SerializeWriter out = serializer.out;
out.writeEnum((Enum<?>) object);
return;
}
Object fieldValue = null;
try {
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 54
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
}
serializer.write(fieldValue);
}
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 50
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
Reported by PMD.
Line: 52
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
}
Reported by PMD.