The following issues were found
src/test/java/com/alibaba/json/bvt/asm/ASMDeserTest2.java
4 issues
Line: 12
public class ASMDeserTest2 extends TestCase {
public void test_codec_1() throws Exception {
String text = JSON.toJSONString(new VO());
Assert.assertEquals("{\"value\":[]}", text);
VO object = JSON.parseObject(text, VO.class);
Reported by PMD.
Line: 18
Assert.assertEquals("{\"value\":[]}", text);
VO object = JSON.parseObject(text, VO.class);
Assert.assertEquals(0, object.getValue().size());
}
public static class VO {
private Entity value = new Entity();
Reported by PMD.
Line: 18
Assert.assertEquals("{\"value\":[]}", text);
VO object = JSON.parseObject(text, VO.class);
Assert.assertEquals(0, object.getValue().size());
}
public static class VO {
private Entity value = new Entity();
Reported by PMD.
Line: 35
}
public static class Entity extends ArrayList<String> {
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_415.java
4 issues
Line: 15
import junit.framework.TestCase;
public class Bug_for_issue_415 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
}
public void test_for_issue() throws Exception {
Teacher t = new Teacher();
Reported by PMD.
Line: 16
public class Bug_for_issue_415 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
}
public void test_for_issue() throws Exception {
Teacher t = new Teacher();
Reported by PMD.
Line: 19
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_415.");
}
public void test_for_issue() throws Exception {
Teacher t = new Teacher();
Address addr = new Address();
addr.setAddrDetail("中国上海南京路");
Reported by PMD.
Line: 75
public static class Student {
private String name;
private Address address;
public String getName() {
return name;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_414.java
4 issues
Line: 14
public void test_for_issue() throws Exception {
String jsonStr = "{publishedDate:\"2015-09-07\"}";
TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
System.out.println(news.getPublishedDate());
}
public static class TestEntity {
private Timestamp publishedDate;
Reported by PMD.
Line: 11
public class Bug_for_issue_414 extends TestCase {
public void test_for_issue() throws Exception {
String jsonStr = "{publishedDate:\"2015-09-07\"}";
TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
System.out.println(news.getPublishedDate());
}
Reported by PMD.
Line: 11
public class Bug_for_issue_414 extends TestCase {
public void test_for_issue() throws Exception {
String jsonStr = "{publishedDate:\"2015-09-07\"}";
TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
System.out.println(news.getPublishedDate());
}
Reported by PMD.
Line: 14
public void test_for_issue() throws Exception {
String jsonStr = "{publishedDate:\"2015-09-07\"}";
TestEntity news = JSON.parseObject(jsonStr, TestEntity.class);
System.out.println(news.getPublishedDate());
}
public static class TestEntity {
private Timestamp publishedDate;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONFieldTest.java
4 issues
Line: 16
demo.setId(1009);
demo.setName("IT");
demo.setAge(30);
System.out.println(JSON.toJSON(demo));
}
public static class Demo {
private int id;
Reported by PMD.
Line: 11
public class JSONFieldTest extends TestCase {
public void test_field() throws Exception {
Demo demo = new Demo();
demo.setId(1009);
demo.setName("IT");
demo.setAge(30);
System.out.println(JSON.toJSON(demo));
Reported by PMD.
Line: 11
public class JSONFieldTest extends TestCase {
public void test_field() throws Exception {
Demo demo = new Demo();
demo.setId(1009);
demo.setName("IT");
demo.setAge(30);
System.out.println(JSON.toJSON(demo));
Reported by PMD.
Line: 19
System.out.println(JSON.toJSON(demo));
}
public static class Demo {
private int id;
@JSONField(serialize = false)
private String name;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectK.java
4 issues
Line: 7
public class ObjectK {
private int a;
private int b = 0;
Reported by PMD.
Line: 11
private int a;
private int b = 0;
private int c = 0;
private int d = 0;
Reported by PMD.
Line: 13
private int b = 0;
private int c = 0;
private int d = 0;
public int getA() {
return a;
Reported by PMD.
Line: 15
private int c = 0;
private int d = 0;
public int getA() {
return a;
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/AfterFilter.java
4 issues
Line: 26
JSONSerializer serializer = serializerLocal.get();
char seperator = seperatorLocal.get();
boolean ref = serializer.containsReference(value);
serializer.writeKeyValue(seperator, key, value);
if (!ref && serializer.references != null) {
serializer.references.remove(value);
}
if (seperator != ',') {
Reported by PMD.
Line: 27
char seperator = seperatorLocal.get();
boolean ref = serializer.containsReference(value);
serializer.writeKeyValue(seperator, key, value);
if (!ref && serializer.references != null) {
serializer.references.remove(value);
}
if (seperator != ',') {
seperatorLocal.set(COMMA);
Reported by PMD.
Line: 29
boolean ref = serializer.containsReference(value);
serializer.writeKeyValue(seperator, key, value);
if (!ref && serializer.references != null) {
serializer.references.remove(value);
}
if (seperator != ',') {
seperatorLocal.set(COMMA);
}
}
Reported by PMD.
Line: 31
if (!ref && serializer.references != null) {
serializer.references.remove(value);
}
if (seperator != ',') {
seperatorLocal.set(COMMA);
}
}
public abstract void writeAfter(Object object);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/asm/Case0.java
4 issues
Line: 16
String jsonString = JSON.toJSONString(entity);
System.out.println(jsonString);
V0 entity2 = JSON.parseObject(jsonString, V0.class);
Assert.assertEquals(entity.getValue(), entity2.getValue());
}
Reported by PMD.
Line: 10
public class Case0 extends TestCase {
public void test_0() throws Exception {
V0 entity = new V0();
entity.setValue("abc");
String jsonString = JSON.toJSONString(entity);
Reported by PMD.
Line: 19
System.out.println(jsonString);
V0 entity2 = JSON.parseObject(jsonString, V0.class);
Assert.assertEquals(entity.getValue(), entity2.getValue());
}
public static class V0 {
private int id;
Reported by PMD.
Line: 22
Assert.assertEquals(entity.getValue(), entity2.getValue());
}
public static class V0 {
private int id;
private String value;
private long v2;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_apollo0317.java
4 issues
Line: 19
Object[] array = new Object[] {vo, vo, vo};
String json = JSON.toJSONString(vo, SerializerFeature.DisableCircularReferenceDetect);
System.out.println(json);
}
public static class VO {
private String brandintroduction;
Reported by PMD.
Line: 10
public class Bug_for_apollo0317 extends TestCase {
public void test_for_apollo0317() throws Exception {
String text = "广州市白云区优网通信线缆厂是一家集专业设计、生产、销售、电工解决方案提供为一体的中型企业,旗下主打品牌(简称:普禄克Pluke);公厂拥有自己的研发团队,自主研发改造的高性能电缆生产流水线使产品的性价比大幅度提升,在技术上处于行业领先。\r\n 普禄克Pluke销售服务网络覆盖全国各省市以及南美、东南亚等地区。产品广范应用在军队通信网,政府网,企业网,电信网,电力网,煤炭网,水利网,广电网,校园网 电梯设备、机电设备、汽车、电子、等行业,其中超五类六类网络线缆,彩色网络跳线,设备连接及控制传输电缆,电器连接线多年来获得客户的高度肯定。?普禄克PLUKE在不断创新中为客户创造价值,在工厂战略的指导下,凭借在售前咨询,系统设计,产品采购,工程施工等方面的综合优势和我们多面的工程服务经验,可以根据客户的要求,提供切实可行的技术方案及系统产品。\r\n 工厂未来将着力于商业模式的创新转换,为合作伙伴提供一个共同成长、双赢的、持续发展的商业平台。\r\n 我们企业的宗旨是:销售最好的产品、追求最佳的售后服务、推广最新的办公理念!";
VO vo = new VO();
vo.setBrandintroduction(text);
Reported by PMD.
Line: 10
public class Bug_for_apollo0317 extends TestCase {
public void test_for_apollo0317() throws Exception {
String text = "广州市白云区优网通信线缆厂是一家集专业设计、生产、销售、电工解决方案提供为一体的中型企业,旗下主打品牌(简称:普禄克Pluke);公厂拥有自己的研发团队,自主研发改造的高性能电缆生产流水线使产品的性价比大幅度提升,在技术上处于行业领先。\r\n 普禄克Pluke销售服务网络覆盖全国各省市以及南美、东南亚等地区。产品广范应用在军队通信网,政府网,企业网,电信网,电力网,煤炭网,水利网,广电网,校园网 电梯设备、机电设备、汽车、电子、等行业,其中超五类六类网络线缆,彩色网络跳线,设备连接及控制传输电缆,电器连接线多年来获得客户的高度肯定。?普禄克PLUKE在不断创新中为客户创造价值,在工厂战略的指导下,凭借在售前咨询,系统设计,产品采购,工程施工等方面的综合优势和我们多面的工程服务经验,可以根据客户的要求,提供切实可行的技术方案及系统产品。\r\n 工厂未来将着力于商业模式的创新转换,为合作伙伴提供一个共同成长、双赢的、持续发展的商业平台。\r\n 我们企业的宗旨是:销售最好的产品、追求最佳的售后服务、推广最新的办公理念!";
VO vo = new VO();
vo.setBrandintroduction(text);
Reported by PMD.
Line: 16
VO vo = new VO();
vo.setBrandintroduction(text);
Object[] array = new Object[] {vo, vo, vo};
String json = JSON.toJSONString(vo, SerializerFeature.DisableCircularReferenceDetect);
System.out.println(json);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONBytesTest.java
4 issues
Line: 11
public class JSONBytesTest extends TestCase {
public void test_codec() throws Exception {
int len = (Character.MAX_VALUE - Character.MIN_VALUE) + 1;
char[] chars = new char[len];
for (int i = 0; i < len; ++i) {
char ch = (char) ((int) Character.MAX_VALUE + i);
if (ch >= 55296 && ch <= 57344) {
Reported by PMD.
Line: 27
byte[] bytes = JSON.toJSONBytes(text);
String text2 = (String) JSON.parse(bytes);
Assert.assertEquals(text.length(), text2.length());
for (int i = 0; i < len; ++i) {
char c1 = text.charAt(i);
char c2 = text2.charAt(i);
Assert.assertEquals(c1, c2);
Reported by PMD.
Line: 13
public void test_codec() throws Exception {
int len = (Character.MAX_VALUE - Character.MIN_VALUE) + 1;
char[] chars = new char[len];
for (int i = 0; i < len; ++i) {
char ch = (char) ((int) Character.MAX_VALUE + i);
if (ch >= 55296 && ch <= 57344) {
continue;
}
Reported by PMD.
Line: 19
if (ch >= 55296 && ch <= 57344) {
continue;
}
chars[i] = ch;
}
String text = new String(chars);
byte[] bytes = JSON.toJSONBytes(text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue997.java
4 issues
Line: 15
Model model = new Model();
model.object = JSONNull.getInstance();
System.out.println(JSON.toJSONString(model));
// System.out.println(JSON.toJSONString(map));
}
public static class Model {
public Object object;
Reported by PMD.
Line: 11
* Created by wenshao on 17/01/2017.
*/
public class Issue997 extends TestCase {
public void test_for_issue() throws Exception {
Model model = new Model();
model.object = JSONNull.getInstance();
System.out.println(JSON.toJSONString(model));
// System.out.println(JSON.toJSONString(map));
Reported by PMD.
Line: 11
* Created by wenshao on 17/01/2017.
*/
public class Issue997 extends TestCase {
public void test_for_issue() throws Exception {
Model model = new Model();
model.object = JSONNull.getInstance();
System.out.println(JSON.toJSONString(model));
// System.out.println(JSON.toJSONString(map));
Reported by PMD.
Line: 20
}
public static class Model {
public Object object;
}
}
Reported by PMD.