The following issues were found
src/test/java/com/alibaba/json/bvt/WriteClassNameTest2.java
7 issues
Line: 18
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName, SerializerFeature.PrettyFormat);
System.out.println(text);
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
Reported by PMD.
Line: 11
import com.alibaba.fastjson.serializer.SerializerFeature;
public class WriteClassNameTest2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest2");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
Reported by PMD.
Line: 12
public class WriteClassNameTest2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest2");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName, SerializerFeature.PrettyFormat);
Reported by PMD.
Line: 15
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest2");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName, SerializerFeature.PrettyFormat);
System.out.println(text);
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Reported by PMD.
Line: 22
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
Reported by PMD.
Line: 23
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
private int id;
Reported by PMD.
Line: 26
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
private int id;
private String name;
public Entity(){
Reported by PMD.
src/test/java/com/alibaba/json/bvt/WriteClassNameTest.java
7 issues
Line: 18
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName);
System.out.println(text);
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
Reported by PMD.
Line: 11
import com.alibaba.fastjson.serializer.SerializerFeature;
public class WriteClassNameTest extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest.");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
Reported by PMD.
Line: 12
public class WriteClassNameTest extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest.");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 15
ParserConfig.global.addAccept("com.alibaba.json.bvt.WriteClassNameTest.");
}
public void test_0() throws Exception {
Entity entity = new Entity(3, "jobs");
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName);
System.out.println(text);
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Reported by PMD.
Line: 22
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
Reported by PMD.
Line: 23
Entity entity2 = (Entity) JSON.parseObject(text, Object.class);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
private int id;
Reported by PMD.
Line: 26
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
private int id;
private String name;
public Entity(){
Reported by PMD.
src/test/java/com/alibaba/json/bvt/BooleanArrayFieldTest_primitive.java
7 issues
Line: 12
public class BooleanArrayFieldTest_primitive extends TestCase {
public void test_array() throws Exception {
Assert.assertEquals("[true]", JSON.toJSONString(new boolean[] { true }));
}
public void test_codec_null() throws Exception {
Reported by PMD.
Line: 17
}
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 28
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 31
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 46
private boolean[] value;
public boolean[] getValue() {
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
Reported by PMD.
Line: 49
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 49
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/BooleanArrayFieldTest_primitive_private.java
7 issues
Line: 12
public class BooleanArrayFieldTest_primitive_private extends TestCase {
public void test_array() throws Exception {
Assert.assertEquals("[true]", JSON.toJSONString(new boolean[] { true }));
}
public void test_codec_null() throws Exception {
Reported by PMD.
Line: 17
}
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 28
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 31
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 46
private boolean[] value;
public boolean[] getValue() {
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
Reported by PMD.
Line: 49
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 49
return value;
}
public void setValue(boolean[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/URLFieldTest.java
7 issues
Line: 21
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue().toString(), user.getValue().toString());
}
Reported by PMD.
Line: 14
public class URLFieldTest extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(new URL("http://code.alibaba-tech.com"));
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue().toString(), user.getValue().toString());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 25
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue().toString(), user.getValue().toString());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 25
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue().toString(), user.getValue().toString());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 28
Assert.assertEquals(user1.getValue().toString(), user.getValue().toString());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 38
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public static class User {
private URL value;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectP1_A.java
7 issues
Line: 8
public class ObjectP1_A {
private int a = 0;
private int b = 0;
Reported by PMD.
Line: 10
public class ObjectP1_A {
private int a = 0;
private int b = 0;
private int c = 0;
Reported by PMD.
Line: 12
private int a = 0;
private int b = 0;
private int c = 0;
private boolean d = false;
Reported by PMD.
Line: 14
private int b = 0;
private int c = 0;
private boolean d = false;
private int e = 0;
Reported by PMD.
Line: 16
private int c = 0;
private boolean d = false;
private int e = 0;
private int f = 0;
Reported by PMD.
Line: 18
private boolean d = false;
private int e = 0;
private int f = 0;
public int getA() {
return a;
Reported by PMD.
Line: 20
private int e = 0;
private int f = 0;
public int getA() {
return a;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/TypeUtilstTest.java
7 issues
Line: 73
private Boolean f2;
private byte f3;
private Byte f4;
private short f5;
private Short f6;
private int f7;
private Integer f8;
private long f9;
private Long f10;
Reported by PMD.
Line: 120
this.f4 = f4;
}
public short getF5() {
return f5;
}
public void setF5(short f5) {
this.f5 = f5;
Reported by PMD.
Line: 124
return f5;
}
public void setF5(short f5) {
this.f5 = f5;
}
public Short getF6() {
return f6;
Reported by PMD.
Line: 30
public class TypeUtilstTest extends TestCase {
public void test_0() throws Exception {
List<Person> personList = new ArrayList<Person>();
{
Person p = new Person();
p.setF1(true);
Reported by PMD.
Line: 30
public class TypeUtilstTest extends TestCase {
public void test_0() throws Exception {
List<Person> personList = new ArrayList<Person>();
{
Person p = new Person();
p.setF1(true);
Reported by PMD.
Line: 67
// CGLibExtJSONParser parser = new CGLibExtJSONParser(text);
}
public static class Person {
private boolean f1;
private Boolean f2;
private byte f3;
private Byte f4;
Reported by PMD.
Line: 67
// CGLibExtJSONParser parser = new CGLibExtJSONParser(text);
}
public static class Person {
private boolean f1;
private Boolean f2;
private byte f3;
private Byte f4;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/TestMultiLevelClass2.java
7 issues
Line: 57
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
Line: 50
}
}
public void test_codec() throws Exception {
A a = new A();
a.setB(a.new B());
a.getB().setC(a.b.new C());
a.getB().getC().setValue(123);
Reported by PMD.
Line: 50
}
}
public void test_codec() throws Exception {
A a = new A();
a.setB(a.new B());
a.getB().setC(a.b.new C());
a.getB().getC().setValue(123);
Reported by PMD.
Line: 54
A a = new A();
a.setB(a.new B());
a.getB().setC(a.b.new C());
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
Reported by PMD.
Line: 54
A a = new A();
a.setB(a.new B());
a.getB().setC(a.b.new C());
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
Reported by PMD.
Line: 59
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
Line: 59
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/TestMultiLevelClass.java
7 issues
Line: 57
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
Line: 50
}
}
public void test_codec() throws Exception {
A a = new A();
a.setB(new A.B());
a.getB().setC(new A.B.C());
a.getB().getC().setValue(123);
Reported by PMD.
Line: 50
}
}
public void test_codec() throws Exception {
A a = new A();
a.setB(new A.B());
a.getB().setC(new A.B.C());
a.getB().getC().setValue(123);
Reported by PMD.
Line: 54
A a = new A();
a.setB(new A.B());
a.getB().setC(new A.B.C());
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
Reported by PMD.
Line: 54
A a = new A();
a.setB(new A.B());
a.getB().setC(new A.B.C());
a.getB().getC().setValue(123);
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
Reported by PMD.
Line: 59
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
Line: 59
String text = JSON.toJSONString(a);
System.out.println(text);
A a2 = JSON.parseObject(text, A.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_yunban.java
7 issues
Line: 33
//ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
//String a = JSON.toJSONString(relationItemList, SerializerFeature.WriteClassName);
String a1 = JSON.toJSONString(relationItemList);
System.out.println(a1);
//ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
List<RelationItem> relationItemList1 = JSON.parseObject(a1, new com.alibaba.fastjson.TypeReference<List<RelationItem>>(){});
Reported by PMD.
Line: 39
//ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
List<RelationItem> relationItemList1 = JSON.parseObject(a1, new com.alibaba.fastjson.TypeReference<List<RelationItem>>(){});
System.out.print("fdafda");
}
public static class RelationItem {
private String sourceId;
private Map<String, String> ext;
Reported by PMD.
Line: 12
import java.util.Map;
public class Bug_for_yunban extends TestCase {
public void test_for_issue() throws Exception {
List<RelationItem> relationItemList = new LinkedList<RelationItem>();
Map<String, String> ext = new HashMap<String, String>();
ext.put("a", "b");
ext.put("c", "d");
Reported by PMD.
Line: 12
import java.util.Map;
public class Bug_for_yunban extends TestCase {
public void test_for_issue() throws Exception {
List<RelationItem> relationItemList = new LinkedList<RelationItem>();
Map<String, String> ext = new HashMap<String, String>();
ext.put("a", "b");
ext.put("c", "d");
Reported by PMD.
Line: 37
//ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
List<RelationItem> relationItemList1 = JSON.parseObject(a1, new com.alibaba.fastjson.TypeReference<List<RelationItem>>(){});
System.out.print("fdafda");
}
public static class RelationItem {
Reported by PMD.
Line: 42
System.out.print("fdafda");
}
public static class RelationItem {
private String sourceId;
private Map<String, String> ext;
public String getSourceId() {
return sourceId;
Reported by PMD.
Line: 37
//ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
List<RelationItem> relationItemList1 = JSON.parseObject(a1, new com.alibaba.fastjson.TypeReference<List<RelationItem>>(){});
System.out.print("fdafda");
}
public static class RelationItem {
Reported by PMD.