The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1233.java
12 issues
Line: 17
* Created by wenshao on 30/05/2017.
*/
public class Issue1233 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig.getGlobalInstance().putDeserializer(Area.class, new ObjectDeserializer() {
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONObject jsonObject = (JSONObject) parser.parse();
String areaType;
Reported by PMD.
Line: 17
* Created by wenshao on 30/05/2017.
*/
public class Issue1233 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig.getGlobalInstance().putDeserializer(Area.class, new ObjectDeserializer() {
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONObject jsonObject = (JSONObject) parser.parse();
String areaType;
Reported by PMD.
Line: 23
JSONObject jsonObject = (JSONObject) parser.parse();
String areaType;
if (jsonObject.get("type") instanceof String) {
areaType = (String) jsonObject.get("type");
} else {
return null;
}
if (Area.TYPE_SECTION.equals(areaType)) {
Reported by PMD.
Line: 28
} else {
return null;
}
if (Area.TYPE_SECTION.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, Section.class);
} else if (Area.TYPE_FLOORV1.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV1.class);
} else if (Area.TYPE_FLOORV2.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV2.class);
Reported by PMD.
Line: 30
}
if (Area.TYPE_SECTION.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, Section.class);
} else if (Area.TYPE_FLOORV1.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV1.class);
} else if (Area.TYPE_FLOORV2.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV2.class);
}
return null;
Reported by PMD.
Line: 32
return (T) JSON.toJavaObject(jsonObject, Section.class);
} else if (Area.TYPE_FLOORV1.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV1.class);
} else if (Area.TYPE_FLOORV2.equals(areaType)) {
return (T) JSON.toJavaObject(jsonObject, FloorV2.class);
}
return null;
}
Reported by PMD.
Line: 45
JSONObject jsonObject = JSON.parseObject("{\"type\":\"floorV2\",\"templateId\":\"x123\"}");
FloorV2 floorV2 = (FloorV2) jsonObject.toJavaObject(Area.class);
assertNotNull(floorV2);
assertEquals("x123", floorV2.templateId);
}
public interface Area {
Reported by PMD.
Line: 46
JSONObject jsonObject = JSON.parseObject("{\"type\":\"floorV2\",\"templateId\":\"x123\"}");
FloorV2 floorV2 = (FloorV2) jsonObject.toJavaObject(Area.class);
assertNotNull(floorV2);
assertEquals("x123", floorV2.templateId);
}
public interface Area {
public static final String TYPE_SECTION = "section";
Reported by PMD.
Line: 47
FloorV2 floorV2 = (FloorV2) jsonObject.toJavaObject(Area.class);
assertNotNull(floorV2);
assertEquals("x123", floorV2.templateId);
}
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
Reported by PMD.
Line: 63
public String type;
public String templateId;
public String getName() {
return templateId;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1235.java
12 issues
Line: 12
* Created by wenshao on 30/05/2017.
*/
public class Issue1235 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
Reported by PMD.
Line: 12
* Created by wenshao on 30/05/2017.
*/
public class Issue1235 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
Reported by PMD.
Line: 16
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 17
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
Reported by PMD.
Line: 18
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
Reported by PMD.
Line: 19
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
Reported by PMD.
Line: 22
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
Reported by PMD.
Line: 27
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
Reported by PMD.
Line: 28
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
public static class FloorV2 implements Area {
Reported by PMD.
Line: 29
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
public static class FloorV2 implements Area {
public String type;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1235_noasm.java
12 issues
Line: 12
* Created by wenshao on 30/05/2017.
*/
public class Issue1235_noasm extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
Reported by PMD.
Line: 12
* Created by wenshao on 30/05/2017.
*/
public class Issue1235_noasm extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
Reported by PMD.
Line: 16
String json = "{\"type\":\"floorV2\",\"templateId\":\"x123\"}";
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 17
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
Reported by PMD.
Line: 18
FloorV2 floorV2 = (FloorV2) JSON.parseObject(json, Area.class);
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
Reported by PMD.
Line: 19
assertNotNull(floorV2);
assertNotNull(floorV2.templateId);
assertEquals("x123", floorV2.templateId);
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
Reported by PMD.
Line: 22
assertEquals("floorV2", floorV2.type);
String json2 = JSON.toJSONString(floorV2, SerializerFeature.WriteClassName);
assertEquals("{\"type\":\"floorV2\",\"templateId\":\"x123\"}", json2);
}
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
Reported by PMD.
Line: 27
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
Reported by PMD.
Line: 28
@JSONType(seeAlso = {FloorV2.class}, typeKey = "type")
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
private static class FloorV2 implements Area {
Reported by PMD.
Line: 29
public interface Area {
public static final String TYPE_SECTION = "section";
public static final String TYPE_FLOORV1 = "floorV1";
public static final String TYPE_FLOORV2 = "floorV2";
}
@JSONType(typeName = "floorV2")
private static class FloorV2 implements Area {
public String type;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_wangran1.java
12 issues
Line: 26
String text = JSON.toJSONString(entity);
System.out.println(text);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Reported by PMD.
Line: 13
public class Bug_for_wangran1 extends TestCase {
public void test_0() throws Exception {
Entity entity = new Entity();
entity.setId(11);
entity.setName("xx");
Reported by PMD.
Line: 22
Queue q = new Queue();
q.setId(55);
entity.getQueue().put(q.getId(), q);
String text = JSON.toJSONString(entity);
System.out.println(text);
Reported by PMD.
Line: 30
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
Reported by PMD.
Line: 31
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
Reported by PMD.
Line: 31
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
Reported by PMD.
Line: 32
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
private int id;
Reported by PMD.
Line: 32
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
private int id;
Reported by PMD.
Line: 32
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
private int id;
Reported by PMD.
Line: 32
Assert.assertNotNull(entity2.getQueue());
Assert.assertEquals(1, entity2.getQueue().size());
Assert.assertEquals(true, entity2.getQueue().values().iterator().next() instanceof Queue);
}
public static class Entity {
private int id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue912.java
12 issues
Line: 14
* Created by wenshao on 06/12/2016.
*/
public class Issue912 extends TestCase {
public void test_for_issue() throws Exception {
String allMethods = "{\"mList\":[{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayInt\",\"parameterSize\":1,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[I\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"},{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayPrimative\",\"parameterSize\":7,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[F\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[S\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[D\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[J\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[B\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[C\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[Ljava.lang.String;\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"}]}";
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
Reported by PMD.
Line: 14
* Created by wenshao on 06/12/2016.
*/
public class Issue912 extends TestCase {
public void test_for_issue() throws Exception {
String allMethods = "{\"mList\":[{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayInt\",\"parameterSize\":1,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[I\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"},{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayPrimative\",\"parameterSize\":7,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[F\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[S\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[D\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[J\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[B\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[C\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[Ljava.lang.String;\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"}]}";
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
Reported by PMD.
Line: 18
String allMethods = "{\"mList\":[{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayInt\",\"parameterSize\":1,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[I\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"},{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayPrimative\",\"parameterSize\":7,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[F\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[S\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[D\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[J\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[B\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[C\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[Ljava.lang.String;\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"}]}";
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
Reported by PMD.
Line: 18
String allMethods = "{\"mList\":[{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayInt\",\"parameterSize\":1,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[I\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"},{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayPrimative\",\"parameterSize\":7,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[F\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[S\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[D\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[J\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[B\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[C\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[Ljava.lang.String;\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"}]}";
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
Reported by PMD.
Line: 18
String allMethods = "{\"mList\":[{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayInt\",\"parameterSize\":1,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[I\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"},{\"className\":\"com.qa.scftemplate.contract.ISCFServiceForDyjAction\",\"methodName\":\"getArrayPrimative\",\"parameterSize\":7,\"parameters\":[{\"clazz\":\"[I\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[F\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[S\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[D\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[J\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[B\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"},{\"clazz\":\"[C\",\"clsList\":null,\"isGenericity\":false,\"value\":\"\"}],\"returnType\":\"[Ljava.lang.String;\",\"url\":\"tcp://SCFServiceForDyj/SCFServiceForDyjActionService\"}]}";
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
Reported by PMD.
Line: 19
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
T jd = (T) JSON.parseObject(json, clazz,
Reported by PMD.
Line: 19
JsonBean jsonBean = getJsonData(allMethods, JsonBean.class);
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
T jd = (T) JSON.parseObject(json, clazz,
Reported by PMD.
Line: 20
assertEquals(2, jsonBean.getmList().size());
SCFMethod m1 = jsonBean.getmList().get(0);
assertNotNull(m1);
}
public static <T> T getJsonData(String json, Class<T> clazz) {
T jd = (T) JSON.parseObject(json, clazz,
Feature.IgnoreNotMatch,
Reported by PMD.
Line: 32
}
public static class JsonBean {
private List<SCFMethod> mList;
public List<SCFMethod> getmList() {
return mList;
}
Reported by PMD.
Line: 43
}
}
public static class SCFMethod {
public String className;
public String url;
public String methodName;
public int parameterSize;
public List<SCFMethodParameter> parameters = new LinkedList<SCFMethodParameter>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue922.java
12 issues
Line: 13
* Created by wenshao on 20/12/2016.
*/
public class Issue922 extends TestCase {
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
Reported by PMD.
Line: 13
* Created by wenshao on 20/12/2016.
*/
public class Issue922 extends TestCase {
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
Reported by PMD.
Line: 16
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 19
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/demo/FilterDemo.java
12 issues
Line: 46
serializer.write(object);
String outText = out.toString();
System.out.println(outText);
}
}
Reported by PMD.
Line: 13
public class FilterDemo extends TestCase {
public void test_secure() throws Exception {
ValueFilter filter = new ValueFilter() {
public Object process(Object source, String name, Object value) {
if (name.equals("name")) {
Reported by PMD.
Line: 13
public class FilterDemo extends TestCase {
public void test_secure() throws Exception {
ValueFilter filter = new ValueFilter() {
public Object process(Object source, String name, Object value) {
if (name.equals("name")) {
Reported by PMD.
Line: 18
ValueFilter filter = new ValueFilter() {
public Object process(Object source, String name, Object value) {
if (name.equals("name")) {
return "WSJ";
}
return value;
}
};
Reported by PMD.
Line: 18
ValueFilter filter = new ValueFilter() {
public Object process(Object source, String name, Object value) {
if (name.equals("name")) {
return "WSJ";
}
return value;
}
};
Reported by PMD.
Line: 27
NameFilter nameFilter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
};
Reported by PMD.
Line: 27
NameFilter nameFilter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
};
Reported by PMD.
Line: 40
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getValueFilters().add(filter);
serializer.getNameFilters().add(nameFilter);
serializer.write(object);
String outText = out.toString();
Reported by PMD.
Line: 41
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getValueFilters().add(filter);
serializer.getNameFilters().add(nameFilter);
serializer.write(object);
String outText = out.toString();
System.out.println(outText);
Reported by PMD.
Line: 15
public void test_secure() throws Exception {
ValueFilter filter = new ValueFilter() {
public Object process(Object source, String name, Object value) {
if (name.equals("name")) {
return "WSJ";
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_float_field.java
12 issues
Line: 15
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 30
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Bean a = new Bean();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 39
Assert.assertEquals("{\"ID\":0.0}", text);
}
public void test_namefilter_1() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 43
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 43
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 54
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 0);
serializer.write(map);
Reported by PMD.
Line: 16
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
Reported by PMD.
Line: 16
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_int_field.java
12 issues
Line: 15
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
}
return name;
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
}
return name;
Reported by PMD.
Line: 31
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Bean a = new Bean();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 40
Assert.assertEquals("{\"ID\":0}", text);
}
public void test_namefilter_1() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 44
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 44
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 55
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 0);
serializer.write(map);
Reported by PMD.
Line: 16
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
Reported by PMD.
Line: 16
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/generic/GenericTest.java
12 issues
Line: 10
public class GenericTest extends TestCase {
public void test_0 () throws Exception {
B b = JSON.parseObject("{\"data\":[1,2,3]}", B.class);
b.get(0);
}
public static abstract class A<T> {
Reported by PMD.
Line: 10
public class GenericTest extends TestCase {
public void test_0 () throws Exception {
B b = JSON.parseObject("{\"data\":[1,2,3]}", B.class);
b.get(0);
}
public static abstract class A<T> {
Reported by PMD.
Line: 12
public void test_0 () throws Exception {
B b = JSON.parseObject("{\"data\":[1,2,3]}", B.class);
b.get(0);
}
public static abstract class A<T> {
T[] data;
Reported by PMD.
Line: 15
b.get(0);
}
public static abstract class A<T> {
T[] data;
public A() {
}
Reported by PMD.
Line: 25
public T[] getData() {
return data;
}
public void setData(T[] data) {
Reported by PMD.
Line: 30
public void setData(T[] data) {
this.data = data;
}
}
public static class B extends A<Long> {
Reported by PMD.
Line: 46
}
public static class C<T> {
private T[] data;
public C(T[] data) {
this.data = data;
}
Reported by PMD.
Line: 46
}
public static class C<T> {
private T[] data;
public C(T[] data) {
this.data = data;
}
Reported by PMD.
Line: 48
public static class C<T> {
private T[] data;
public C(T[] data) {
this.data = data;
}
public T[] getData() {
Reported by PMD.
Line: 54
public T[] getData() {
return data;
}
}
}
Reported by PMD.