The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Issue1020.java
5 issues
Line: 12
* Created by wenshao on 11/03/2017.
*/
public class Issue1020 extends TestCase {
public void test_null() throws Exception {
Vo vo = JSON.parseObject("{\"ld\":null}", Vo.class);
assertNull(vo.ld);
}
Reported by PMD.
Line: 14
public class Issue1020 extends TestCase {
public void test_null() throws Exception {
Vo vo = JSON.parseObject("{\"ld\":null}", Vo.class);
assertNull(vo.ld);
}
public void test_empty() throws Exception {
Vo vo = JSON.parseObject("{\"ld\":\"\"}", Vo.class);
Reported by PMD.
Line: 18
}
public void test_empty() throws Exception {
Vo vo = JSON.parseObject("{\"ld\":\"\"}", Vo.class);
assertNull(vo.ld);
}
Reported by PMD.
Line: 20
public void test_empty() throws Exception {
Vo vo = JSON.parseObject("{\"ld\":\"\"}", Vo.class);
assertNull(vo.ld);
}
public static class Vo {
public LocalDate ld;
Reported by PMD.
Line: 25
}
public static class Vo {
public LocalDate ld;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_zhuangzaowen.java
5 issues
Line: 19
public void test_for_zhuangzaowen() throws Exception {
String value = "{\"begin\":1340263804415,\"buildIds\":[\"42\"],\"end\":1340265305070,\"endBuildId\":\"50\",\"id\":\"4\",\"jobs\":[\"cb-intl-rfqma-UT\",\"cb-intl-rfqma-selenium\"],\"owners\":[\"wb_jianping.shenjp\"],\"triggerBuildId\":\"42\"}";
System.out.println(JSON.parseObject(value, JenkinsFailedPhase.class, Feature.DisableASM));
}
public static class JenkinsFailedPhase {// extends BaseEntity<JenkinsFailedPhase> {
private String id;
Reported by PMD.
Line: 17
public class Bug_for_zhuangzaowen extends TestCase {
public void test_for_zhuangzaowen() throws Exception {
String value = "{\"begin\":1340263804415,\"buildIds\":[\"42\"],\"end\":1340265305070,\"endBuildId\":\"50\",\"id\":\"4\",\"jobs\":[\"cb-intl-rfqma-UT\",\"cb-intl-rfqma-selenium\"],\"owners\":[\"wb_jianping.shenjp\"],\"triggerBuildId\":\"42\"}";
System.out.println(JSON.parseObject(value, JenkinsFailedPhase.class, Feature.DisableASM));
}
public static class JenkinsFailedPhase {// extends BaseEntity<JenkinsFailedPhase> {
Reported by PMD.
Line: 17
public class Bug_for_zhuangzaowen extends TestCase {
public void test_for_zhuangzaowen() throws Exception {
String value = "{\"begin\":1340263804415,\"buildIds\":[\"42\"],\"end\":1340265305070,\"endBuildId\":\"50\",\"id\":\"4\",\"jobs\":[\"cb-intl-rfqma-UT\",\"cb-intl-rfqma-selenium\"],\"owners\":[\"wb_jianping.shenjp\"],\"triggerBuildId\":\"42\"}";
System.out.println(JSON.parseObject(value, JenkinsFailedPhase.class, Feature.DisableASM));
}
public static class JenkinsFailedPhase {// extends BaseEntity<JenkinsFailedPhase> {
Reported by PMD.
Line: 22
System.out.println(JSON.parseObject(value, JenkinsFailedPhase.class, Feature.DisableASM));
}
public static class JenkinsFailedPhase {// extends BaseEntity<JenkinsFailedPhase> {
private String id;
public static final String KEY_NAME_SPACE = "phase";
private Set<String> owners;
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.bug;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/ByteArrayFieldTest_3.java
5 issues
Line: 14
public class ByteArrayFieldTest_3 extends TestCase {
public void test_0() throws Exception {
Entity entity = new Entity("中华人民共和国");
String text = JSON.toJSONString(entity);
JSONObject json = JSON.parseObject(text);
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Reported by PMD.
Line: 18
Entity entity = new Entity("中华人民共和国");
String text = JSON.toJSONString(entity);
JSONObject json = JSON.parseObject(text);
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals("中华人民共和国", new String(entity2.getValue(), "UTF-8"));
}
Reported by PMD.
Line: 21
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals("中华人民共和国", new String(entity2.getValue(), "UTF-8"));
}
private static class Entity {
private byte[] value;
Reported by PMD.
Line: 37
}
public byte[] getValue() {
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
Reported by PMD.
Line: 40
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JsonValueTest.java
5 issues
Line: 27
public class JsonValueTest extends TestCase {
public void test_toJSONString() throws Exception {
Assert.assertEquals("null", JSON.toJSONString(Double.NaN));
Assert.assertEquals("3.0", JSON.toJSONString(3D));
Assert.assertEquals("null", JSON.toJSONString(Float.NaN));
Assert.assertEquals("3.0", JSON.toJSONString(3F));
Assert.assertEquals("1292939095640", JSON.toJSONString(new Date(1292939095640L)));
Reported by PMD.
Line: 36
Assert.assertEquals(new Date(1292939095640L), JSON.parse("new Date(1292939095640)"));
}
public void test_bug_0() throws Exception {
String text = "[{\"S\":0,\"T\":\"Register\"},{\"HOST_NAME\":\"qa-qd-62-187\",\"IP\":[\"172.29.62.187\"],\"MAC_ADDR\":[\"00:16:3E:43:E5:1C\"],\"SERVICE_TAG\":\"NOSN00:16:3E:43:E5:1C\",\"VERSION\":\"2.5\"}] ";
JSON.parseArray(text);
}
public void test_bug_1() throws Exception {
Reported by PMD.
Line: 36
Assert.assertEquals(new Date(1292939095640L), JSON.parse("new Date(1292939095640)"));
}
public void test_bug_0() throws Exception {
String text = "[{\"S\":0,\"T\":\"Register\"},{\"HOST_NAME\":\"qa-qd-62-187\",\"IP\":[\"172.29.62.187\"],\"MAC_ADDR\":[\"00:16:3E:43:E5:1C\"],\"SERVICE_TAG\":\"NOSN00:16:3E:43:E5:1C\",\"VERSION\":\"2.5\"}] ";
JSON.parseArray(text);
}
public void test_bug_1() throws Exception {
Reported by PMD.
Line: 41
JSON.parseArray(text);
}
public void test_bug_1() throws Exception {
String text = "[{\"S\":2,\"T\":\"ConnectResp\"},\n\r \t{\"VAL\" :null}]\r\f";
JSON.parseArray(text);
}
}
Reported by PMD.
Line: 41
JSON.parseArray(text);
}
public void test_bug_1() throws Exception {
String text = "[{\"S\":2,\"T\":\"ConnectResp\"},\n\r \t{\"VAL\" :null}]\r\f";
JSON.parseArray(text);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/ByteArrayFieldTest_2.java
5 issues
Line: 14
public class ByteArrayFieldTest_2 extends TestCase {
public void test_0() throws Exception {
Entity entity = new Entity("中华人民共和国");
String text = JSON.toJSONString(entity);
JSONObject json = JSON.parseObject(text);
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Reported by PMD.
Line: 18
Entity entity = new Entity("中华人民共和国");
String text = JSON.toJSONString(entity);
JSONObject json = JSON.parseObject(text);
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals("中华人民共和国", new String(entity2.getValue(), "UTF-8"));
}
Reported by PMD.
Line: 21
Assert.assertEquals(TestUtils.encodeToBase64String(entity.getValue(), false), json.getString("value"));
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals("中华人民共和国", new String(entity2.getValue(), "UTF-8"));
}
public static class Entity {
private byte[] value;
Reported by PMD.
Line: 37
}
public byte[] getValue() {
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
Reported by PMD.
Line: 40
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/MapRefTest2.java
5 issues
Line: 34
text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
}
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text, new TypeReference<Map<String, Object>>() {});
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
Reported by PMD.
Line: 15
import com.alibaba.fastjson.serializer.SerializerFeature;
public class MapRefTest2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest2");
}
public void test_0() throws Exception {
String text;
Reported by PMD.
Line: 16
public class MapRefTest2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest2");
}
public void test_0() throws Exception {
String text;
{
Reported by PMD.
Line: 19
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest2");
}
public void test_0() throws Exception {
String text;
{
Map<String, Object> map = new HashMap<String, Object>();
User user = new User();
Reported by PMD.
Line: 40
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/MapRefTest3.java
5 issues
Line: 34
text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
}
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text, new TypeReference<Map<String, Object>>() {});
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
Reported by PMD.
Line: 15
import com.alibaba.fastjson.serializer.SerializerFeature;
public class MapRefTest3 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest3");
}
public void test_0() throws Exception {
String text;
Reported by PMD.
Line: 16
public class MapRefTest3 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest3");
}
public void test_0() throws Exception {
String text;
{
Reported by PMD.
Line: 19
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest3");
}
public void test_0() throws Exception {
String text;
{
Map<String, Object> map = new HashMap<String, Object>();
User user = new User();
Reported by PMD.
Line: 40
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issue2951/TestIssue2951.java
5 issues
Line: 36
Assert.assertEquals(model.field4, actualField4);
}
public static class Model {
public final int field1;
public final float field2;
public final String field3;
public final List<String> field4;
Reported by PMD.
Line: 37
}
public static class Model {
public final int field1;
public final float field2;
public final String field3;
public final List<String> field4;
public Model(int field1, float field2, String field3, List<String> field4) {
Reported by PMD.
Line: 38
public static class Model {
public final int field1;
public final float field2;
public final String field3;
public final List<String> field4;
public Model(int field1, float field2, String field3, List<String> field4) {
this.field1 = field1;
Reported by PMD.
Line: 39
public static class Model {
public final int field1;
public final float field2;
public final String field3;
public final List<String> field4;
public Model(int field1, float field2, String field3, List<String> field4) {
this.field1 = field1;
this.field2 = field2;
Reported by PMD.
Line: 40
public final int field1;
public final float field2;
public final String field3;
public final List<String> field4;
public Model(int field1, float field2, String field3, List<String> field4) {
this.field1 = field1;
this.field2 = field2;
this.field3 = field3;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issue3804/TestIssue3804.java
5 issues
Line: 12
String textResponse="{\"error\":false,\"code";
JSONValidator validator = JSONValidator.from(textResponse);
if (validator.validate() && validator.getType() == JSONValidator.Type.Object) {
System.out.println("Yes, it is Object");
} else {
System.out.println("No, it is not Object");
}
}
}
Reported by PMD.
Line: 14
if (validator.validate() && validator.getType() == JSONValidator.Type.Object) {
System.out.println("Yes, it is Object");
} else {
System.out.println("No, it is not Object");
}
}
}
Reported by PMD.
Line: 7
public class TestIssue3804 {
@Test
public void testIssue3804() {
//String textResponse="{\"error\":false,\"code\":0}";
String textResponse="{\"error\":false,\"code";
JSONValidator validator = JSONValidator.from(textResponse);
if (validator.validate() && validator.getType() == JSONValidator.Type.Object) {
System.out.println("Yes, it is Object");
Reported by PMD.
Line: 11
//String textResponse="{\"error\":false,\"code\":0}";
String textResponse="{\"error\":false,\"code";
JSONValidator validator = JSONValidator.from(textResponse);
if (validator.validate() && validator.getType() == JSONValidator.Type.Object) {
System.out.println("Yes, it is Object");
} else {
System.out.println("No, it is not Object");
}
}
Reported by PMD.
Line: 11
//String textResponse="{\"error\":false,\"code\":0}";
String textResponse="{\"error\":false,\"code";
JSONValidator validator = JSONValidator.from(textResponse);
if (validator.validate() && validator.getType() == JSONValidator.Type.Object) {
System.out.println("Yes, it is Object");
} else {
System.out.println("No, it is not Object");
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_smoothrat.java
5 issues
Line: 10
public class Bug_for_smoothrat extends TestCase {
public void test_0() throws Exception {
Entity entity = new Entity();
entity.setValue("aaa123".toCharArray());
String text = JSON.toJSONString(entity);
Reported by PMD.
Line: 20
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(new String(entity.getValue()), new String(entity2.getValue()));
}
public static class Entity {
private char[] value;
Reported by PMD.
Line: 28
private char[] value;
public char[] getValue() {
return value;
}
public void setValue(char[] value) {
this.value = value;
}
Reported by PMD.
Line: 31
return value;
}
public void setValue(char[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 31
return value;
}
public void setValue(char[] value) {
this.value = value;
}
}
}
Reported by PMD.