The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_gongwenhua.java
2 issues
Line: 11
public class Bug_for_gongwenhua extends TestCase {
public void test_0() throws Exception {
String text = "{\"FH2\\\"\u0005\\v\u0010\u000e\u0011\u0000\":0,\"alipa9_login\":0,\"alipay_login\":14164,\"durex\":317,\"intl.datasky\":0,\"taobao_refund\":880}";
JSONObject obj = JSONObject.parseObject(text);
Assert.assertNotNull(obj);
Assert.assertEquals(0, obj.get("FH2\"\u0005\u000B\u0010\u000e\u0011\u0000"));
Reported by PMD.
Line: 16
JSONObject obj = JSONObject.parseObject(text);
Assert.assertNotNull(obj);
Assert.assertEquals(0, obj.get("FH2\"\u0005\u000B\u0010\u000e\u0011\u0000"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue_717.java
2 issues
Line: 12
public class Issue_717 extends TestCase {
public void test_for_issue() throws Exception {
Group group = new Group();
group.setId(0L);
group.setNAME("admin");
group.setAUTHORITY("administrors");
Reported by PMD.
Line: 22
Assert.assertEquals("{\"ID\":0,\"nAME\":\"admin\"}", json);
}
public static class Group {
@JSONField(name = "ID")
private Long id;
private String NAME;
@JSONField(serialize = false, deserialize = false)
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_hmy8.java
2 issues
Line: 11
public class Bug_for_hmy8 extends TestCase {
public void test_ser() throws Exception {
IEventDto dto = new IEventDto();
dto.getEventList().add(new IEvent());
JSON.toJSONString(dto);
}
Reported by PMD.
Line: 11
public class Bug_for_hmy8 extends TestCase {
public void test_ser() throws Exception {
IEventDto dto = new IEventDto();
dto.getEventList().add(new IEvent());
JSON.toJSONString(dto);
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/geo/GeometryCollection.java
2 issues
Line: 12
*/
@JSONType(typeName = "GeometryCollection", orders = {"type", "bbox", "geometries"})
public class GeometryCollection extends Geometry {
private List<Geometry> geometries = new ArrayList<Geometry>();
public GeometryCollection() {
super("GeometryCollection");
}
Reported by PMD.
Line: 12
*/
@JSONType(typeName = "GeometryCollection", orders = {"type", "bbox", "geometries"})
public class GeometryCollection extends Geometry {
private List<Geometry> geometries = new ArrayList<Geometry>();
public GeometryCollection() {
super("GeometryCollection");
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_dongqi.java
2 issues
Line: 17
public void test_bug() throws Exception {
Map<String, Object> obj = new HashMap<String,Object>();
obj.put("value", ";\r\n3、 公");
System.out.print(JSON.toJSONString(obj));
Assert.assertEquals("{\"value\":\";\\r\\n3、\\u009E 公\"}", JSON.toJSONString(obj));
}
}
Reported by PMD.
Line: 14
public class Bug_for_dongqi extends TestCase {
public void test_bug() throws Exception {
Map<String, Object> obj = new HashMap<String,Object>();
obj.put("value", ";\r\n3、 公");
System.out.print(JSON.toJSONString(obj));
Assert.assertEquals("{\"value\":\";\\r\\n3、\\u009E 公\"}", JSON.toJSONString(obj));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue784.java
2 issues
Line: 10
* Created by wenshao on 16/8/24.
*/
public class Issue784 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parse("[{\"args\":[\"150\",\"change\",{\"timeStamp\":1471595047319,\"value\":\"\"},{\"attrs\":{\"value\":\"\"}}],\"method\":\"fireEvent\"}]");
}
}
Reported by PMD.
Line: 10
* Created by wenshao on 16/8/24.
*/
public class Issue784 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parse("[{\"args\":[\"150\",\"change\",{\"timeStamp\":1471595047319,\"value\":\"\"},{\"attrs\":{\"value\":\"\"}}],\"method\":\"fireEvent\"}]");
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_232.java
2 issues
Line: 10
import junit.framework.TestCase;
public class Bug_for_issue_232 extends TestCase {
public void test_for_issue() throws Exception {
String source = "{\"code\": 0, \"data\": {\"country\": \"China\", \"country_id\": \"CN\", \"area\": \"East China\", \"area_id\": \"300000\", \"region\": \"Jiangsu Province \",\" region_id \":\" 320000 \",\" city \":\" Nanjing \",\" city_id \":\" 320100 \",\" county \":\" \",\" county_id \":\" - 1 \",\" isp \":\" China Unicom \",\" isp_id \":\" 100026 \",\" ip \":\" 58.240.65.50 \"}}";
JSONObject object = JSONObject.parseObject (source);
Assert.assertEquals(0, object.getIntValue("code"));
}
}
Reported by PMD.
Line: 13
public void test_for_issue() throws Exception {
String source = "{\"code\": 0, \"data\": {\"country\": \"China\", \"country_id\": \"CN\", \"area\": \"East China\", \"area_id\": \"300000\", \"region\": \"Jiangsu Province \",\" region_id \":\" 320000 \",\" city \":\" Nanjing \",\" city_id \":\" 320100 \",\" county \":\" \",\" county_id \":\" - 1 \",\" isp \":\" China Unicom \",\" isp_id \":\" 100026 \",\" ip \":\" 58.240.65.50 \"}}";
JSONObject object = JSONObject.parseObject (source);
Assert.assertEquals(0, object.getIntValue("code"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_268.java
2 issues
Line: 14
public class Bug_for_issue_268 extends TestCase {
public void test_for_issue() throws Exception {
V1 vo = new V1();
vo.units = EnumSet.of(TimeUnit.DAYS, TimeUnit.HOURS);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"units\":[\"HOURS\",\"DAYS\"]}", text);
Reported by PMD.
Line: 26
Assert.assertEquals(vo.units, vo1.units);
}
public void test_for_issue_private() throws Exception {
VO vo = new VO();
vo.units = EnumSet.of(TimeUnit.DAYS, TimeUnit.HOURS);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"units\":[\"HOURS\",\"DAYS\"]}", text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_269.java
2 issues
Line: 13
public class Bug_for_issue_269 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"value\":\"2014-10-09T03:07:07.000Z\"}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(1412824027000L, vo.value.getTime());
}
Reported by PMD.
Line: 16
public void test_for_issue() throws Exception {
String text = "{\"value\":\"2014-10-09T03:07:07.000Z\"}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(1412824027000L, vo.value.getTime());
}
public static class VO {
private Date value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_273.java
2 issues
Line: 8
import junit.framework.TestCase;
public class Bug_for_issue_273 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"value\":\"\0x16\0x26\"}");
}
public static class VO {
public String value;
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Bug_for_issue_273 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"value\":\"\0x16\0x26\"}");
}
public static class VO {
public String value;
Reported by PMD.