The following issues were found
src/test/java/com/alibaba/json/bvt/issue_2100/Issue2130.java
3 issues
Line: 8
import junit.framework.TestCase;
public class Issue2130 extends TestCase {
public void test_for_issue() throws Exception {
String str = "{\"score\":0.000099369485}";
JSONObject object = JSON.parseObject(str);
assertEquals("{\"score\":0.000099369485}", object.toJSONString());
}
}
Reported by PMD.
Line: 11
public void test_for_issue() throws Exception {
String str = "{\"score\":0.000099369485}";
JSONObject object = JSON.parseObject(str);
assertEquals("{\"score\":0.000099369485}", object.toJSONString());
}
}
Reported by PMD.
Line: 11
public void test_for_issue() throws Exception {
String str = "{\"score\":0.000099369485}";
JSONObject object = JSON.parseObject(str);
assertEquals("{\"score\":0.000099369485}", object.toJSONString());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1800/Issue1870.java
2 issues
Line: 9
import java.util.List;
public class Issue1870 extends TestCase {
public void test_for_issue() throws Exception {
}
public static class Comment {
@JSONField(name = "pic_arr")
Reported by PMD.
Line: 9
import java.util.List;
public class Issue1870 extends TestCase {
public void test_for_issue() throws Exception {
}
public static class Comment {
@JSONField(name = "pic_arr")
Reported by PMD.
src/test/java/com/alibaba/json/bvt/date/DateTest_dotnet_2.java
2 issues
Line: 13
public class DateTest_dotnet_2 extends TestCase {
public void test_date() throws Exception {
String text = "{\"date\":\"/Date(1461081600000+0500)/\"}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(1461081600000L, model.date.getTime());
}
Reported by PMD.
Line: 17
String text = "{\"date\":\"/Date(1461081600000+0500)/\"}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(1461081600000L, model.date.getTime());
}
public static class Model {
private Date date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1100/Issue1140.java
2 issues
Line: 12
* Created by wenshao on 11/04/2017.
*/
public class Issue1140 extends TestCase {
public void test_for_issue() throws Exception {
String s = "\uD83C\uDDEB\uD83C\uDDF7";
ByteArrayOutputStream out = new ByteArrayOutputStream();
JSON.writeJSONString(out, s);
Reported by PMD.
Line: 12
* Created by wenshao on 11/04/2017.
*/
public class Issue1140 extends TestCase {
public void test_for_issue() throws Exception {
String s = "\uD83C\uDDEB\uD83C\uDDF7";
ByteArrayOutputStream out = new ByteArrayOutputStream();
JSON.writeJSONString(out, s);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2300/Issue2355.java
2 issues
Line: 11
import java.math.BigDecimal;
public class Issue2355 extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
BigDecimal num = new BigDecimal("0.00000001");
vo.setNum(num);
String json = JSON.toJSONString(vo);
Reported by PMD.
Line: 17
vo.setNum(num);
String json = JSON.toJSONString(vo);
assertEquals("{\"num\":0.00000001}", json);
}
static class VO {
@JSONField(serialzeFeatures = {SerializerFeature.WriteBigDecimalAsPlain})
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2200/Issue2244.java
2 issues
Line: 9
import java.util.Date;
public class Issue2244 extends TestCase {
public void test_for_issue() throws Exception {
String str = "\"2019-01-14T06:32:09.029Z\"";
JSON.parseObject(str, Date.class);
}
}
Reported by PMD.
Line: 9
import java.util.Date;
public class Issue2244 extends TestCase {
public void test_for_issue() throws Exception {
String str = "\"2019-01-14T06:32:09.029Z\"";
JSON.parseObject(str, Date.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/date/DateTest_dotnet_5.java
2 issues
Line: 14
public class DateTest_dotnet_5 extends TestCase {
public void test_date() throws Exception {
String text = "{\"date\":\"/Date(1461081600321)/\"}";
JSONObject model = JSON.parseObject(text);
Assert.assertEquals(1461081600321L, ((java.util.Date) model.getObject("date", java.util.Date.class)).getTime());
}
Reported by PMD.
Line: 18
String text = "{\"date\":\"/Date(1461081600321)/\"}";
JSONObject model = JSON.parseObject(text);
Assert.assertEquals(1461081600321L, ((java.util.Date) model.getObject("date", java.util.Date.class)).getTime());
}
private static class Model {
private Date date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2200/Issue2264.java
2 issues
Line: 8
import junit.framework.TestCase;
public class Issue2264 extends TestCase {
public void test_for_issue() throws Exception {
String oID="{\"sys\":\"ROC\",\"code\":0,\"messages\":\"分页获取信息成功!\",\"data\":{\"pageNum\":1,\"pageSize\":10,\"totalPages\":11,\"total\":110,\"records\":[{\"id\":\"64e72850-d149-46d6-8bd7-5f1d332d2a16\",\"tenantCode\":\"clouds_dianmo\",\"name\":\"asr_t1\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 14:21:03\",\"updateTime\":\"2019-01-25 14:21:03\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"4f6a0975-3980-4fd9-b27c-09aa258f4e36\",\"tenantCode\":\"cloudminds\",\"name\":\"xianglong\",\"operatorId\":\"b9bf937f-01c6-4fe8-86f8-43ce7a08167a\",\"createTime\":\"2019-01-25 11:48:03\",\"updateTime\":\"2019-01-25 13:03:00\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"zhangxianglong\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"b209b3b8-7b41-49dd-a087-fb7f6b5bfa51\",\"tenantCode\":\"cloudminds\",\"name\":\"cloud_pu\",\"operatorId\":\"21d08412-9c19-49c0-9428-a6a5ad1bb548\",\"createTime\":\"2019-01-25 11:45:14\",\"updateTime\":\"2019-01-25 11:45:14\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"dian\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"a35e468d-3ff5-48e4-a0e9-b86249167ee5\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"welcome\",\"operatorId\":\"ca69a720-8b8e-4ee5-8b12-63a20e897ef1\",\"createTime\":\"2019-01-25 11:05:42\",\"updateTime\":\"2019-01-25 14:07:05\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"duwei\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"25243f56-b31d-4b58-bd96-c6920628b06c\",\"tenantCode\":\"roc\",\"name\":\"士大夫撒点\",\"operatorId\":\"06f82222-48a4-4a6a-b1cc-52148ed27651\",\"createTime\":\"2019-01-25 11:02:02\",\"updateTime\":\"2019-01-25 11:02:02\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"admin\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"229d9c33-0606-4cda-a4d5-8c1feba2a5ed\",\"tenantCode\":\"cloudminds\",\"name\":\"LocalAsr\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 10:51:43\",\"updateTime\":\"2019-01-25 10:51:43\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"3aedd158-24b8-4021-a9a3-d6effc91a32a\",\"tenantCode\":\"cloudminds\",\"name\":\"cloudAsr\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 10:27:59\",\"updateTime\":\"2019-01-25 10:27:59\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"53065639-a467-4872-8333-73e085c99e43\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"asrtest\",\"operatorId\":\"394e0148-ba95-4c39-a9f9-973abb2c718a\",\"createTime\":\"2019-01-25 10:17:36\",\"updateTime\":\"2019-01-25 13:12:01\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liuyanan\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"da2db833-c065-49dd-bdb7-939c2026faa3\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"testwqeq\",\"operatorId\":\"bb5cd865-baea-42a0-a36d-b9e354b88f27\",\"createTime\":\"2019-01-24 19:20:04\",\"updateTime\":\"2019-01-24 19:20:27\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"cqtest01\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"da672b14-d968-4776-97ba-b7c1addaa3b3\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"cqtestASR\",\"operatorId\":\"bb5cd865-baea-42a0-a36d-b9e354b88f27\",\"createTime\":\"2019-01-24 16:46:40\",\"updateTime\":\"2019-01-24 18:14:15\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"cqtest01\",\"insRcuCnt\":0,\"distRcuCnt\":2}]},\"errors\":null,\"action\":0,\"script\":\"\"}";
JSONObject json = JSONObject.parseObject(oID);
String par="$..records[?(@.name=='asr_t1')].operatorId";
Object source = JSONPath.eval(json,par);
Reported by PMD.
Line: 15
String par="$..records[?(@.name=='asr_t1')].operatorId";
Object source = JSONPath.eval(json,par);
String device_udid=JSONObject.toJSONString(source);
assertEquals("[\"38ba5660-ef6e-4b66-9673-b0236832f179\"]", device_udid);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1100/Issue1120.java
2 issues
Line: 11
* Created by wenshao on 01/04/2017.
*/
public class Issue1120 extends TestCase {
public void test_for_issue() throws Exception {
Model model = new Model();
model.setReqNo("123");
assertEquals("{\"REQ_NO\":\"123\"}", JSON.toJSONString(model));
}
Reported by PMD.
Line: 15
Model model = new Model();
model.setReqNo("123");
assertEquals("{\"REQ_NO\":\"123\"}", JSON.toJSONString(model));
}
public static class Model {
@JSONField(name="REQ_NO")
private String ReqNo;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1100/Issue1109.java
2 issues
Line: 11
* Created by wenshao on 28/03/2017.
*/
public class Issue1109 extends TestCase {
public void test_for_issue() throws Exception {
Pair<String, String> data = Pair.of("key", "\"the\"content");
assertEquals("{\"key\":\"\\\"the\\\"content\"}", JSON.toJSONString(data));
}
}
Reported by PMD.
Line: 13
public class Issue1109 extends TestCase {
public void test_for_issue() throws Exception {
Pair<String, String> data = Pair.of("key", "\"the\"content");
assertEquals("{\"key\":\"\\\"the\\\"content\"}", JSON.toJSONString(data));
}
}
Reported by PMD.