The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_leupom_3.java
3 issues
Line: 18
String text = JSON.toJSONString(person);
System.out.println(text);
Person person2 = JSON.parseObject(text, Person.class);
Assert.assertEquals(person.getId(), person2.getId());
}
Reported by PMD.
Line: 12
public class Bug_for_leupom_3 extends TestCase {
public void test_bug() throws Exception {
Person person = new Person();
person.setId(12345);
String text = JSON.toJSONString(person);
Reported by PMD.
Line: 22
Person person2 = JSON.parseObject(text, Person.class);
Assert.assertEquals(person.getId(), person2.getId());
}
public abstract static interface Model {
Serializable getId();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_liuying.java
3 issues
Line: 18
JSONArray jsonArray = JSONArray.parseArray(aa);
jsonResult.put("aaa", jsonArray);
System.out.println(jsonResult);
}
}
Reported by PMD.
Line: 12
*/
public class Bug_for_liuying extends TestCase {
public void test_for_bug() throws Exception {
String aa = "[{\"dictFont\":\"\",\"dictId\":\"wap\",\"dictName\":\"无线&手淘\"},{\"dictFont\":\"\",\"dictId\":\"etao\",\"dictName\":\"搜索\"}]";
JSONObject jsonResult = new JSONObject();
JSONArray jsonArray = JSONArray.parseArray(aa);
jsonResult.put("aaa", jsonArray);
Reported by PMD.
Line: 12
*/
public class Bug_for_liuying extends TestCase {
public void test_for_bug() throws Exception {
String aa = "[{\"dictFont\":\"\",\"dictId\":\"wap\",\"dictName\":\"无线&手淘\"},{\"dictFont\":\"\",\"dictId\":\"etao\",\"dictName\":\"搜索\"}]";
JSONObject jsonResult = new JSONObject();
JSONArray jsonArray = JSONArray.parseArray(aa);
jsonResult.put("aaa", jsonArray);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_melin.java
3 issues
Line: 13
public class Bug_for_melin extends TestCase {
public void test_for_melin() throws Exception {
Entity object = new Entity();
object.setId(123);
object.setName("\\");
String text = JSON.toJSONString(object);
Reported by PMD.
Line: 24
Assert.assertEquals("{\"id\":123,\"name\":\"\\\\\"}", text);
}
public void test_for_melin_() throws Exception {
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("id", 123);
map.put("name", "\\");
String text = JSON.toJSONString(map);
Reported by PMD.
Line: 35
Assert.assertEquals("{\"id\":123,\"name\":\"\\\\\"}", text);
}
public static class Entity {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_rendong.java
3 issues
Line: 15
public class Bug_for_rendong extends TestCase {
public void test_0() throws Exception {
String text = "{\"BX-20110613-1739\":{\"repairNum\":\"BX-20110613-1739\",\"set\":[{\"employNum\":\"a1027\",\"isConfirm\":false,\"isReceive\":false,\"state\":11}]},\"BX-20110613-1749\":{\"repairNum\":\"BX-20110613-1749\",\"set\":[{\"employNum\":\"a1027\",\"isConfirm\":false,\"isReceive\":true,\"state\":1}]}}";
Map<String, TaskMobileStatusBean> map = JSON.parseObject(text,
new TypeReference<Map<String, TaskMobileStatusBean>>() {
});
Reported by PMD.
Line: 27
// SerializerFeature.PrettyFormat));
}
public static class TaskMobileStatusBean {
private String repairNum;
private Set<PeopleTaskMobileStatusBean> set = new HashSet<PeopleTaskMobileStatusBean>();
Reported by PMD.
Line: 51
}
public static class PeopleTaskMobileStatusBean {
private String employNum;
private Boolean isConfirm;
private Boolean isReceive;
private int state;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_smoothrat3.java
3 issues
Line: 20
entity.setValue(new java.sql.Time(millis));
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName);
System.out.println(text);
Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_smoothrat3$Entity\",\"value\":{\"@type\":\"java.sql.Time\",\"val\":" + millis + "}}", text);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(time, entity2.getValue());
Reported by PMD.
Line: 11
public class Bug_for_smoothrat3 extends TestCase {
public void test_0() throws Exception {
long millis = System.currentTimeMillis();
java.sql.Time time = new java.sql.Time(millis);
Entity entity = new Entity();
Reported by PMD.
Line: 24
Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_smoothrat3$Entity\",\"value\":{\"@type\":\"java.sql.Time\",\"val\":" + millis + "}}", text);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(time, entity2.getValue());
}
public static class Entity {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_smoothrat6.java
3 issues
Line: 24
entity.setValue(set);
String text = JSON.toJSONString(entity, SerializerFeature.WriteClassName);
System.out.println(text);
Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_smoothrat6$Entity\",\"value\":Set[3L,4L]}",
text);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(set, entity2.getValue());
Reported by PMD.
Line: 14
public class Bug_for_smoothrat6 extends TestCase {
public void test_set() throws Exception {
Set<Object> set = new LinkedHashSet<Object>();
set.add(3L);
set.add(4L);
Entity entity = new Entity();
Reported by PMD.
Line: 29
text);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(set, entity2.getValue());
//Assert.assertEquals(set.getClass(), entity2.getValue().getClass());
}
public static class Entity {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_stv_liu.java
3 issues
Line: 12
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Bug_for_stv_liu extends TestCase {
protected void setUp() throws Exception {
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_stv_liu.");
}
public void test() {
User user = new User();
Reported by PMD.
Line: 13
public class Bug_for_stv_liu extends TestCase {
protected void setUp() throws Exception {
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_stv_liu.");
}
public void test() {
User user = new User();
user.setId("1");
Reported by PMD.
Line: 16
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_stv_liu.");
}
public void test() {
User user = new User();
user.setId("1");
user.setUsername("test");
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
user = (User) JSON.parse(json);// 此处抛异常
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_sunai.java
3 issues
Line: 16
String text = "{\"description\":\"【\\r\\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr\\nid:10000000\",\"detail\":\"【xxxx】\\r\\nxxxx:2019xxxxx、xx、xxxxxxxx;驾校、教练极力推荐下载!\\r\\n全国92%的xxxxxx!累计帮助1亿用户考取驾照,是一款口口相传的飞机GPP! \\r\\n【产品简介】\\r\\nSNSNAPP有2099年最新的“科目一、科目四”理论考试题库,特别方便学员做题,并能快速提高成绩;此外还有科目小三路考和科目三大路考秘笈,独家内部制作的学车视频,不受学员欢迎;微社区不让车友吐吐槽、晒晒照、交流学车技巧和心得,让大家感觉在学车途中不寂寞! \\r\\n联系我们】\\r\\n钓鱼网站:http://ddd.sunyu.com\\r\\n渠道合作: sunai@369.com\\r\\n微信公众号:SNSN\\r\\nid:99999999\",\"logo\":\"\",\"name\":\"\",\"pics\":[\"http://99999.meimaocdn.com/snscom/GD99999HVXXXXXGXVXXXXXXXXXX?xxxxx=GD99999HVXXXXXGXVXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1TcILJpXXXXbIXpXXXXXXXXXX?xxxxx=TB1TcILJpXXXXbIXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/GD2M5.OJpXXXXaOXpXXXXXXXXXX?xxxxx=GD2M5.OJpXXXXaOXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1QWElIpXXXXXvXpXXXXXXXXXX?xxxxx=TB1QWElIpXXXXXvXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1wZUQJpXXXXajXpXXXXXXXXXX?xxxxx=TB1wZUQJpXXXXajXpXXXXXXXXXX\"]}";
MultiLingual ml = JSON.parseObject(text, MultiLingual.class);
String text2 = JSON.toJSONString(ml);
System.out.println(text2);
Assert.assertEquals(text, text2);
}
public static class MultiLingual {
Reported by PMD.
Line: 12
import junit.framework.TestCase;
public class Bug_for_sunai extends TestCase {
public void test_for_sunai() throws Exception {
String text = "{\"description\":\"【\\r\\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr\\nid:10000000\",\"detail\":\"【xxxx】\\r\\nxxxx:2019xxxxx、xx、xxxxxxxx;驾校、教练极力推荐下载!\\r\\n全国92%的xxxxxx!累计帮助1亿用户考取驾照,是一款口口相传的飞机GPP! \\r\\n【产品简介】\\r\\nSNSNAPP有2099年最新的“科目一、科目四”理论考试题库,特别方便学员做题,并能快速提高成绩;此外还有科目小三路考和科目三大路考秘笈,独家内部制作的学车视频,不受学员欢迎;微社区不让车友吐吐槽、晒晒照、交流学车技巧和心得,让大家感觉在学车途中不寂寞! \\r\\n联系我们】\\r\\n钓鱼网站:http://ddd.sunyu.com\\r\\n渠道合作: sunai@369.com\\r\\n微信公众号:SNSN\\r\\nid:99999999\",\"logo\":\"\",\"name\":\"\",\"pics\":[\"http://99999.meimaocdn.com/snscom/GD99999HVXXXXXGXVXXXXXXXXXX?xxxxx=GD99999HVXXXXXGXVXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1TcILJpXXXXbIXpXXXXXXXXXX?xxxxx=TB1TcILJpXXXXbIXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/GD2M5.OJpXXXXaOXpXXXXXXXXXX?xxxxx=GD2M5.OJpXXXXaOXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1QWElIpXXXXXvXpXXXXXXXXXX?xxxxx=TB1QWElIpXXXXXvXpXXXXXXXXXX\",\"http://99999.meimaocdn.com/snscom/TB1wZUQJpXXXXajXpXXXXXXXXXX?xxxxx=TB1wZUQJpXXXXajXpXXXXXXXXXX\"]}";
MultiLingual ml = JSON.parseObject(text, MultiLingual.class);
String text2 = JSON.toJSONString(ml);
System.out.println(text2);
Assert.assertEquals(text, text2);
Reported by PMD.
Line: 20
Assert.assertEquals(text, text2);
}
public static class MultiLingual {
/**
* 语种
*/
private String lang;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_taolei0628.java
3 issues
Line: 20
{
char c = (char)rand.nextInt(65536);
if(Character.isDefined(c))
cs[i++] = c;
}
return new String(cs);
}
static final Object createObject()
{
Reported by PMD.
Line: 36
return new Object[]{map,map};
}
public void test_bug() throws Exception {
Object object = createObject();
JSON.toJSONString(object);
}
}
Reported by PMD.
Line: 36
return new Object[]{map,map};
}
public void test_bug() throws Exception {
Object object = createObject();
JSON.toJSONString(object);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/bug201810/LatLngTest.java
3 issues
Line: 12
import java.io.Serializable;
public class LatLngTest extends TestCase {
public void test_latlng() throws Exception {
LatLng v = new LatLng();
JSON.toJSONString(v);
}
public static class LatLng implements Serializable {
Reported by PMD.
Line: 12
import java.io.Serializable;
public class LatLngTest extends TestCase {
public void test_latlng() throws Exception {
LatLng v = new LatLng();
JSON.toJSONString(v);
}
public static class LatLng implements Serializable {
Reported by PMD.
Line: 17
JSON.toJSONString(v);
}
public static class LatLng implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -9176496417369601807L;
Reported by PMD.