The following issues were found
src/test/java/com/alibaba/json/bvt/issue_2200/Issue2234.java
4 issues
Line: 9
import java.util.List;
public class Issue2234 extends TestCase {
public void test_for_issue() throws Exception {
String userStr = "{\"name\":\"asdfad\",\"ss\":\"\"}";
User user = JSON.parseObject(userStr, User.class);
}
public static class User {
Reported by PMD.
Line: 9
import java.util.List;
public class Issue2234 extends TestCase {
public void test_for_issue() throws Exception {
String userStr = "{\"name\":\"asdfad\",\"ss\":\"\"}";
User user = JSON.parseObject(userStr, User.class);
}
public static class User {
Reported by PMD.
Line: 11
public class Issue2234 extends TestCase {
public void test_for_issue() throws Exception {
String userStr = "{\"name\":\"asdfad\",\"ss\":\"\"}";
User user = JSON.parseObject(userStr, User.class);
}
public static class User {
public String name;
public List ss;
Reported by PMD.
Line: 11
public class Issue2234 extends TestCase {
public void test_for_issue() throws Exception {
String userStr = "{\"name\":\"asdfad\",\"ss\":\"\"}";
User user = JSON.parseObject(userStr, User.class);
}
public static class User {
public String name;
public List ss;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2500/Issue2515.java
4 issues
Line: 9
import junit.framework.TestCase;
public class Issue2515 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\n" +
" \"a\":\"{\\\"b\\\":\\\"cd\\\"}\"\n" +
"}";
JSONObject obj = JSON.parseObject(json);
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Issue2515 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\n" +
" \"a\":\"{\\\"b\\\":\\\"cd\\\"}\"\n" +
"}";
JSONObject obj = JSON.parseObject(json);
Reported by PMD.
Line: 16
JSONObject obj = JSON.parseObject(json);
assertEquals("cd", JSONPath.eval(obj, "$.a.b"));
assertEquals(1, JSONPath.eval(obj, "$.a.size"));
}
}
Reported by PMD.
Line: 17
JSONObject obj = JSON.parseObject(json);
assertEquals("cd", JSONPath.eval(obj, "$.a.b"));
assertEquals(1, JSONPath.eval(obj, "$.a.size"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2600/Issue2606.java
4 issues
Line: 13
import java.util.TimeZone;
public class Issue2606 extends TestCase {
@Override
public void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getDefault();
JSON.defaultLocale = Locale.CHINA;
}
Reported by PMD.
Line: 19
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_issue() throws Exception {
String str = "2019-07-03 19:34:22,547";
Date d = TypeUtils.castToDate(str);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
sdf.setTimeZone(TimeZone.getDefault());
assertEquals(str, sdf.format(d));
Reported by PMD.
Line: 22
public void test_for_issue() throws Exception {
String str = "2019-07-03 19:34:22,547";
Date d = TypeUtils.castToDate(str);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
sdf.setTimeZone(TimeZone.getDefault());
assertEquals(str, sdf.format(d));
}
}
Reported by PMD.
Line: 24
Date d = TypeUtils.castToDate(str);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
sdf.setTimeZone(TimeZone.getDefault());
assertEquals(str, sdf.format(d));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/bug/Bug_for_lixianfeng.java
4 issues
Line: 17
*/
public class Bug_for_lixianfeng extends TestCase {
public void test_long_list() throws Exception {
String str = "{\"id\":14281,\"name\":\"test\",\"canPurchase\":1,\"categoryId\":955063}";
JSON.parseObject(str, Te.class);
}
Reported by PMD.
Line: 17
*/
public class Bug_for_lixianfeng extends TestCase {
public void test_long_list() throws Exception {
String str = "{\"id\":14281,\"name\":\"test\",\"canPurchase\":1,\"categoryId\":955063}";
JSON.parseObject(str, Te.class);
}
Reported by PMD.
Line: 23
JSON.parseObject(str, Te.class);
}
public static class Te {
private Long id;
private String name;
private List<Long> catIds;
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.parser.bug;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSON;
import junit.framework.TestCase;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2900/Issue2982.java
4 issues
Line: 13
@Test
public void test_for_issue() {
String jsonStr = "[ { \"activity_type\" : 0, \"activity_id\" : \"***\", \"activity_tip\" : \"***\", \"position\" : \"1\" }, { \"activity_type\" : 0, \"activity_id\" : \"2669\", \"activity_tip\" : \"****\", \"position\" : \"1\" }]";
assertTrue(JSONArray.isValidArray(jsonStr));
assertTrue(JSON.isValidArray(jsonStr));
assertTrue(JSONObject.isValidArray(jsonStr));
}
Reported by PMD.
Line: 15
@Test
public void test_for_issue() {
String jsonStr = "[ { \"activity_type\" : 0, \"activity_id\" : \"***\", \"activity_tip\" : \"***\", \"position\" : \"1\" }, { \"activity_type\" : 0, \"activity_id\" : \"2669\", \"activity_tip\" : \"****\", \"position\" : \"1\" }]";
assertTrue(JSONArray.isValidArray(jsonStr));
assertTrue(JSON.isValidArray(jsonStr));
assertTrue(JSONObject.isValidArray(jsonStr));
}
Reported by PMD.
Line: 16
public void test_for_issue() {
String jsonStr = "[ { \"activity_type\" : 0, \"activity_id\" : \"***\", \"activity_tip\" : \"***\", \"position\" : \"1\" }, { \"activity_type\" : 0, \"activity_id\" : \"2669\", \"activity_tip\" : \"****\", \"position\" : \"1\" }]";
assertTrue(JSONArray.isValidArray(jsonStr));
assertTrue(JSON.isValidArray(jsonStr));
assertTrue(JSONObject.isValidArray(jsonStr));
}
}
Reported by PMD.
Line: 17
String jsonStr = "[ { \"activity_type\" : 0, \"activity_id\" : \"***\", \"activity_tip\" : \"***\", \"position\" : \"1\" }, { \"activity_type\" : 0, \"activity_id\" : \"2669\", \"activity_tip\" : \"****\", \"position\" : \"1\" }]";
assertTrue(JSONArray.isValidArray(jsonStr));
assertTrue(JSON.isValidArray(jsonStr));
assertTrue(JSONObject.isValidArray(jsonStr));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3000/Issue3057.java
4 issues
Line: 7
import junit.framework.TestCase;
public class Issue3057 extends TestCase {
public void test_for_issue() throws Exception {
String str = "{\"q\":[]}";
Bean bean = JSON.parseObject(str, Bean.class);
assertEquals(0, bean.q.size());
}
Reported by PMD.
Line: 10
public void test_for_issue() throws Exception {
String str = "{\"q\":[]}";
Bean bean = JSON.parseObject(str, Bean.class);
assertEquals(0, bean.q.size());
}
public static class Bean {
public java.util.Deque q;
}
Reported by PMD.
Line: 10
public void test_for_issue() throws Exception {
String str = "{\"q\":[]}";
Bean bean = JSON.parseObject(str, Bean.class);
assertEquals(0, bean.q.size());
}
public static class Bean {
public java.util.Deque q;
}
Reported by PMD.
Line: 14
}
public static class Bean {
public java.util.Deque q;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3000/Issue3138.java
4 issues
Line: 11
import java.util.Map;
public class Issue3138 extends TestCase {
public void test_0() throws Exception {
VO vo = JSON.parseObject("{\"value\":{\"@type\":\"aa\"}}", VO.class);
}
public static class VO {
@JSONField(parseFeatures = Feature.DisableSpecialKeyDetect)
Reported by PMD.
Line: 11
import java.util.Map;
public class Issue3138 extends TestCase {
public void test_0() throws Exception {
VO vo = JSON.parseObject("{\"value\":{\"@type\":\"aa\"}}", VO.class);
}
public static class VO {
@JSONField(parseFeatures = Feature.DisableSpecialKeyDetect)
Reported by PMD.
Line: 12
public class Issue3138 extends TestCase {
public void test_0() throws Exception {
VO vo = JSON.parseObject("{\"value\":{\"@type\":\"aa\"}}", VO.class);
}
public static class VO {
@JSONField(parseFeatures = Feature.DisableSpecialKeyDetect)
public Map<String, Object> value;
Reported by PMD.
Line: 12
public class Issue3138 extends TestCase {
public void test_0() throws Exception {
VO vo = JSON.parseObject("{\"value\":{\"@type\":\"aa\"}}", VO.class);
}
public static class VO {
@JSONField(parseFeatures = Feature.DisableSpecialKeyDetect)
public Map<String, Object> value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1800/Issue_for_dianxing.java
4 issues
Line: 11
String s = "{\"alarmLevel\":null,\"error\":null,\"errorCount\":0,\"maxAlarmCount\":10,\"warn\":null,"
+ "\"warnCount\":0}";
TopAlarm b = JSON.parseObject(s, TopAlarm.class);
System.out.println(JSON.toJSONString(b));
}
public static class TopAlarm {
private Double error; //为null表示不报警
Reported by PMD.
Line: 7
import junit.framework.TestCase;
public class Issue_for_dianxing extends TestCase {
public void test_0() throws Exception {
String s = "{\"alarmLevel\":null,\"error\":null,\"errorCount\":0,\"maxAlarmCount\":10,\"warn\":null,"
+ "\"warnCount\":0}";
TopAlarm b = JSON.parseObject(s, TopAlarm.class);
System.out.println(JSON.toJSONString(b));
}
Reported by PMD.
Line: 7
import junit.framework.TestCase;
public class Issue_for_dianxing extends TestCase {
public void test_0() throws Exception {
String s = "{\"alarmLevel\":null,\"error\":null,\"errorCount\":0,\"maxAlarmCount\":10,\"warn\":null,"
+ "\"warnCount\":0}";
TopAlarm b = JSON.parseObject(s, TopAlarm.class);
System.out.println(JSON.toJSONString(b));
}
Reported by PMD.
Line: 14
System.out.println(JSON.toJSONString(b));
}
public static class TopAlarm {
private Double error; //为null表示不报警
private int errorCount;
private Double warn; //为null表示不报警
private int warnCount;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3200/Issue3264.java
4 issues
Line: 16
* @Date :Created in 21:25 2020/6/22
*/
public class Issue3264 extends TestCase {
public void test_for_issue() throws Exception {
MyData data = MyData.builder().isTest(true).build();
String string = JSON.toJSONString(data);
Assert.assertTrue(string.contains("is_test"));
}
Reported by PMD.
Line: 17
*/
public class Issue3264 extends TestCase {
public void test_for_issue() throws Exception {
MyData data = MyData.builder().isTest(true).build();
String string = JSON.toJSONString(data);
Assert.assertTrue(string.contains("is_test"));
}
@Data
Reported by PMD.
Line: 17
*/
public class Issue3264 extends TestCase {
public void test_for_issue() throws Exception {
MyData data = MyData.builder().isTest(true).build();
String string = JSON.toJSONString(data);
Assert.assertTrue(string.contains("is_test"));
}
@Data
Reported by PMD.
Line: 19
public void test_for_issue() throws Exception {
MyData data = MyData.builder().isTest(true).build();
String string = JSON.toJSONString(data);
Assert.assertTrue(string.contains("is_test"));
}
@Data
@Builder
@AllArgsConstructor
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1800/Issue1879.java
4 issues
Line: 19
// M1 m = JSON.parseObject(json, M1.class);
// }
public void test_for_issue_2() throws Exception {
String json = "{\n" +
" \"ids\" : \"1,2,3\"\n" +
"}";
M2 m = JSON.parseObject(json, M2.class);
}
Reported by PMD.
Line: 19
// M1 m = JSON.parseObject(json, M1.class);
// }
public void test_for_issue_2() throws Exception {
String json = "{\n" +
" \"ids\" : \"1,2,3\"\n" +
"}";
M2 m = JSON.parseObject(json, M2.class);
}
Reported by PMD.
Line: 23
String json = "{\n" +
" \"ids\" : \"1,2,3\"\n" +
"}";
M2 m = JSON.parseObject(json, M2.class);
}
public static class M1 {
private List<Long> ids;
Reported by PMD.
Line: 23
String json = "{\n" +
" \"ids\" : \"1,2,3\"\n" +
"}";
M2 m = JSON.parseObject(json, M2.class);
}
public static class M1 {
private List<Long> ids;
Reported by PMD.