The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1900/Issue1909.java
11 issues
Line: 16
params.add("val1");
params.add(2);
ParamRequest pr = new ParamRequest("methodName", "stringID", params);
System.out.println(JSON.toJSONString(pr));
Request paramRequest = JSON.parseObject(JSON.toJSONString(pr), ParamRequest.class);
}
public static class ParamRequest extends Request {
private String methodName;
Reported by PMD.
Line: 11
import java.util.List;
public class Issue1909 extends TestCase {
public void test_for_issue() throws Exception {
JSONArray params = new JSONArray();
params.add("val1");
params.add(2);
ParamRequest pr = new ParamRequest("methodName", "stringID", params);
System.out.println(JSON.toJSONString(pr));
Reported by PMD.
Line: 11
import java.util.List;
public class Issue1909 extends TestCase {
public void test_for_issue() throws Exception {
JSONArray params = new JSONArray();
params.add("val1");
params.add(2);
ParamRequest pr = new ParamRequest("methodName", "stringID", params);
System.out.println(JSON.toJSONString(pr));
Reported by PMD.
Line: 17
params.add(2);
ParamRequest pr = new ParamRequest("methodName", "stringID", params);
System.out.println(JSON.toJSONString(pr));
Request paramRequest = JSON.parseObject(JSON.toJSONString(pr), ParamRequest.class);
}
public static class ParamRequest extends Request {
private String methodName;
Reported by PMD.
Line: 21
}
public static class ParamRequest extends Request {
private String methodName;
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
Reported by PMD.
Line: 21
}
public static class ParamRequest extends Request {
private String methodName;
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
Reported by PMD.
Line: 24
private String methodName;
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
public ParamRequest(String methodName, Object id, List<Object> params) {
this.methodName = methodName;
Reported by PMD.
Line: 24
private String methodName;
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
public ParamRequest(String methodName, Object id, List<Object> params) {
this.methodName = methodName;
Reported by PMD.
Line: 26
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
public ParamRequest(String methodName, Object id, List<Object> params) {
this.methodName = methodName;
this.id = id;
this.params = params;
Reported by PMD.
Line: 26
@JSONField(name = "id", ordinal = 3, serialize = true, deserialize = true)
private Object id;
private List<Object> params;
public ParamRequest(String methodName, Object id, List<Object> params) {
this.methodName = methodName;
this.id = id;
this.params = params;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1700/Issue1764_bean_biginteger.java
11 issues
Line: 13
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean_biginteger extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":\"-9007199254741992\"}"
Reported by PMD.
Line: 13
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean_biginteger extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":\"-9007199254741992\"}"
Reported by PMD.
Line: 14
public class Issue1764_bean_biginteger extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":\"-9007199254741992\"}"
, JSON.toJSONString(
Reported by PMD.
Line: 18
, JSON.toJSONString(
new Model(9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":\"-9007199254741992\"}"
, JSON.toJSONString(
new Model(-9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":9007199254740990}"
, JSON.toJSONString(
Reported by PMD.
Line: 22
, JSON.toJSONString(
new Model(-9007199254741992L), BrowserCompatible));
assertEquals("{\"value\":9007199254740990}"
, JSON.toJSONString(
new Model(9007199254740990L), BrowserCompatible));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
Reported by PMD.
Line: 26
, JSON.toJSONString(
new Model(9007199254740990L), BrowserCompatible));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
new Model(-9007199254740990L), BrowserCompatible));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
Reported by PMD.
Line: 30
, JSON.toJSONString(
new Model(-9007199254740990L), BrowserCompatible));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
new Model(100), BrowserCompatible));
assertEquals("{\"value\":-100}"
, JSON.toJSONString(
Reported by PMD.
Line: 34
, JSON.toJSONString(
new Model(100), BrowserCompatible));
assertEquals("{\"value\":-100}"
, JSON.toJSONString(
new Model(-100), BrowserCompatible));
}
Reported by PMD.
Line: 43
public static class Model {
public BigInteger value;
public Model() {
}
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.issue_1700;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import java.math.BigInteger;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/PropertyPathTest3.java
11 issues
Line: 68
public boolean apply(JSONSerializer serializer, Object source, String name) {
SerialContext nowContext = new SerialContext(serializer.getContext(), source, name, 0, 0);
String nowPath = getLinkedPath(nowContext);
System.out.println("path->" + nowPath);
//只输出children.id
return containInclude(onlyProperties, nowPath);
}
}
Reported by PMD.
Line: 18
public class PropertyPathTest3 extends TestCase {
/** 测试只输出子集合中的特定属性 */
public void test_path() throws Exception {
Person p1 = new Person();
p1.setId(100);
Person c1 = new Person();
c1.setId(1000);
Reported by PMD.
Line: 28
Person c2 = new Person();
c2.setId(2000);
p1.getChildren().add(c1);
p1.getChildren().add(c2);
//只输出children.id以及根上的id
String s = JSON.toJSONString(p1, new MyPropertyPreFilter(new String[] {"children.id", "id"}));
Assert.assertEquals("{\"children\":[{\"id\":1000},{\"id\":2000}],\"id\":100}", s);
Reported by PMD.
Line: 29
c2.setId(2000);
p1.getChildren().add(c1);
p1.getChildren().add(c2);
//只输出children.id以及根上的id
String s = JSON.toJSONString(p1, new MyPropertyPreFilter(new String[] {"children.id", "id"}));
Assert.assertEquals("{\"children\":[{\"id\":1000},{\"id\":2000}],\"id\":100}", s);
}
Reported by PMD.
Line: 37
}
/** 测试只输出子字段map中的特定属性 */
public void test_path2() throws Exception {
Person2 p1 = new Person2();
p1.setId(1);
Map<String, String> infoMap = new HashMap<String, String>();
infoMap.put("name", "李三");
infoMap.put("height", "168");
Reported by PMD.
Line: 50
}
public static class MyPropertyPreFilter implements PropertyPreFilter {
String[] onlyProperties;
public MyPropertyPreFilter(String[] onlyProperties) {
this.onlyProperties = onlyProperties;
}
Reported by PMD.
Line: 52
public static class MyPropertyPreFilter implements PropertyPreFilter {
String[] onlyProperties;
public MyPropertyPreFilter(String[] onlyProperties) {
this.onlyProperties = onlyProperties;
}
private static boolean containInclude(String[] ss, String s) {
if(ss == null || ss.length == 0 || s == null)
Reported by PMD.
Line: 86
if(isCollection || isFieldNameNull)
return parentLinkedPath;
return
parentLinkedPath.length() == 0 ? String.valueOf(serialContext.fieldName) :
parentLinkedPath + "." + serialContext.fieldName;
}
public static class Person {
Reported by PMD.
Line: 90
parentLinkedPath + "." + serialContext.fieldName;
}
public static class Person {
private int id;
private int id2;
private List<Person> children = new ArrayList<Person>();
Reported by PMD.
Line: 123
}
public static class Person2 {
private int id;
private Map<String, String> infoMap;
public int getId() {
return id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_colon.java
11 issues
Line: 17
*/
public class JSONScannerTest_colon extends TestCase {
public void test_0() throws Exception {
JSONScanner lexer = new JSONScanner(":true");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 23
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_1() throws Exception {
JSONScanner lexer = new JSONScanner(" : true");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 29
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_2() throws Exception {
JSONScanner lexer = new JSONScanner("\n:\ntrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 35
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_3() throws Exception {
JSONScanner lexer = new JSONScanner("\r:\rtrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 41
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_4() throws Exception {
JSONScanner lexer = new JSONScanner("\t:\ttrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 47
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_5() throws Exception {
JSONScanner lexer = new JSONScanner("\t:\ftrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 53
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_6() throws Exception {
JSONScanner lexer = new JSONScanner("\b:\btrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 59
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_f() throws Exception {
JSONScanner lexer = new JSONScanner("\f:\btrue");
lexer.nextTokenWithColon();
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
Reported by PMD.
Line: 65
Assert.assertEquals(JSONToken.TRUE, lexer.token());
}
public void test_7() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("true");
lexer.nextTokenWithColon();
} catch (JSONException e) {
Reported by PMD.
Line: 76
Assert.assertNotNull(error);
}
public void test_8() throws Exception {
JSONScanner lexer = new JSONScanner("\b:\btrue");
lexer.nextToken();
Assert.assertEquals(JSONToken.COLON, lexer.token());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_set.java
11 issues
Line: 18
public class JSONPath_set extends TestCase {
public void test_set() throws Exception {
Entity entity = new Entity();
JSONPath.set(entity, "$.name", "abc");
Assert.assertEquals("abc", entity.getName());
Reported by PMD.
Line: 21
public void test_set() throws Exception {
Entity entity = new Entity();
JSONPath.set(entity, "$.name", "abc");
Assert.assertEquals("abc", entity.getName());
}
public void test_set_array() throws Exception {
Reported by PMD.
Line: 26
Assert.assertEquals("abc", entity.getName());
}
public void test_set_array() throws Exception {
Object[] array = new Object[1];
JSONPath.set(array, "[0]", "abc");
Assert.assertEquals("abc", array[0]);
Reported by PMD.
Line: 34
Assert.assertEquals("abc", array[0]);
}
public void test_set_list() throws Exception {
List array = new ArrayList();
array.add(null);
array.add(null);
JSONPath.set(array, "[0]", "abc");
Reported by PMD.
Line: 44
Assert.assertEquals("abc", array.get(0));
}
public void test_root_null() throws Exception {
Assert.assertFalse(JSONPath.set(null, "[0]", "abc"));
}
public void test_object_not_exits() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
Reported by PMD.
Line: 48
Assert.assertFalse(JSONPath.set(null, "[0]", "abc"));
}
public void test_object_not_exits() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
root.put("values", null);
Assert.assertTrue(JSONPath.set(root, "$.values[0]", "abc"));
}
Reported by PMD.
Line: 54
Assert.assertTrue(JSONPath.set(root, "$.values[0]", "abc"));
}
public void test_error() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
root.put("values", null);
JSONPath.set(root, "$.values[0]", "abc");
}
Reported by PMD.
Line: 54
Assert.assertTrue(JSONPath.set(root, "$.values[0]", "abc"));
}
public void test_error() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
root.put("values", null);
JSONPath.set(root, "$.values[0]", "abc");
}
Reported by PMD.
Line: 60
JSONPath.set(root, "$.values[0]", "abc");
}
static class Entity {
private Integer id;
private String name;
public Integer getId() {
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_max.java
11 issues
Line: 10
import java.math.BigDecimal;
public class JSONPath_max extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(9, JSONPath.eval(root, "$.max()"));
}
public void test_max_1() throws Exception {
Reported by PMD.
Line: 12
public class JSONPath_max extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(9, JSONPath.eval(root, "$.max()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(new BigDecimal("9.1"), JSONPath.eval(root, "$.max()"));
Reported by PMD.
Line: 12
public class JSONPath_max extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(9, JSONPath.eval(root, "$.max()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(new BigDecimal("9.1"), JSONPath.eval(root, "$.max()"));
Reported by PMD.
Line: 15
assertEquals(9, JSONPath.eval(root, "$.max()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(new BigDecimal("9.1"), JSONPath.eval(root, "$.max()"));
}
public void test_max_2() throws Exception {
Reported by PMD.
Line: 17
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(new BigDecimal("9.1"), JSONPath.eval(root, "$.max()"));
}
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1D, 5, 2L, 4]");
assertEquals(9.1D, JSONPath.eval(root, "$.max()"));
Reported by PMD.
Line: 20
assertEquals(new BigDecimal("9.1"), JSONPath.eval(root, "$.max()"));
}
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1D, 5, 2L, 4]");
assertEquals(9.1D, JSONPath.eval(root, "$.max()"));
}
public void test_max_3() throws Exception {
Reported by PMD.
Line: 22
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1D, 5, 2L, 4]");
assertEquals(9.1D, JSONPath.eval(root, "$.max()"));
}
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(9.1F, JSONPath.eval(root, "$.max()"));
Reported by PMD.
Line: 25
assertEquals(9.1D, JSONPath.eval(root, "$.max()"));
}
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(9.1F, JSONPath.eval(root, "$.max()"));
}
public void test_max_4() throws Exception {
Reported by PMD.
Line: 27
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(9.1F, JSONPath.eval(root, "$.max()"));
}
public void test_max_4() throws Exception {
Object root = JSON.parse("['1', '111', '2']");
assertEquals("2", JSONPath.eval(root, "$.max()"));
Reported by PMD.
Line: 30
assertEquals(9.1F, JSONPath.eval(root, "$.max()"));
}
public void test_max_4() throws Exception {
Object root = JSON.parse("['1', '111', '2']");
assertEquals("2", JSONPath.eval(root, "$.max()"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_paths_test3.java
11 issues
Line: 13
import junit.framework.TestCase;
public class JSONPath_paths_test3 extends TestCase {
public void test_map() throws Exception {
Model model = new Model();
model.id = 1001;
model.name = "wenshao";
model.attributes.put("type", "employee");
Reported by PMD.
Line: 17
Model model = new Model();
model.id = 1001;
model.name = "wenshao";
model.attributes.put("type", "employee");
Map<String, Object> paths = JSONPath.paths(model);
Assert.assertEquals(5, paths.size());
Assert.assertSame(model, paths.get("/"));
Reported by PMD.
Line: 21
Map<String, Object> paths = JSONPath.paths(model);
Assert.assertEquals(5, paths.size());
Assert.assertSame(model, paths.get("/"));
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
Reported by PMD.
Line: 22
Map<String, Object> paths = JSONPath.paths(model);
Assert.assertEquals(5, paths.size());
Assert.assertSame(model, paths.get("/"));
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
}
Reported by PMD.
Line: 23
Assert.assertEquals(5, paths.size());
Assert.assertSame(model, paths.get("/"));
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
}
Reported by PMD.
Line: 24
Assert.assertEquals(5, paths.size());
Assert.assertSame(model, paths.get("/"));
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
}
public static class Model {
Reported by PMD.
Line: 25
Assert.assertSame(model, paths.get("/"));
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
}
public static class Model {
public int id;
Reported by PMD.
Line: 26
Assert.assertEquals(1001, paths.get("/id"));
Assert.assertEquals("wenshao", paths.get("/name"));
Assert.assertSame(model.attributes, paths.get("/attributes"));
Assert.assertEquals("employee", paths.get("/attributes/type"));
}
public static class Model {
public int id;
public String name;
Reported by PMD.
Line: 30
}
public static class Model {
public int id;
public String name;
public Map<String, Object> attributes = new HashMap<String, Object>();
}
}
Reported by PMD.
Line: 31
public static class Model {
public int id;
public String name;
public Map<String, Object> attributes = new HashMap<String, Object>();
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3300/Issue3329.java
11 issues
Line: 14
import java.lang.reflect.Type;
public class Issue3329 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
Reported by PMD.
Line: 14
import java.lang.reflect.Type;
public class Issue3329 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
Reported by PMD.
Line: 17
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
Reported by PMD.
Line: 19
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
Reported by PMD.
Line: 21
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
}
Reported by PMD.
Line: 21
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
}
Reported by PMD.
Line: 28
}
assertEquals(2, deserializers.size() - initSize);
}
public static class VO<T> {
public T value;
}
Reported by PMD.
Line: 28
}
assertEquals(2, deserializers.size() - initSize);
}
public static class VO<T> {
public T value;
}
Reported by PMD.
Line: 32
}
public static class VO<T> {
public T value;
}
public static class User {
public int id;
}
Reported by PMD.
Line: 36
}
public static class User {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_liuwanzhen_ren.java
11 issues
Line: 19
paramMap.put("url2", "456");
bean.setParamMap(paramMap);
String str = JSON.toJSONString(bean);
System.out.println(str);
Bean bean2 = JSON.parseObject(str, Bean.class);
System.out.println(bean2.getAction());
System.out.println(bean2.getParamMap());
}
Reported by PMD.
Line: 21
String str = JSON.toJSONString(bean);
System.out.println(str);
Bean bean2 = JSON.parseObject(str, Bean.class);
System.out.println(bean2.getAction());
System.out.println(bean2.getParamMap());
}
public static class Bean {
Reported by PMD.
Line: 22
System.out.println(str);
Bean bean2 = JSON.parseObject(str, Bean.class);
System.out.println(bean2.getAction());
System.out.println(bean2.getParamMap());
}
public static class Bean {
private String action;
Reported by PMD.
Line: 11
public class Bug_for_liuwanzhen_ren extends TestCase {
public void test_0() throws Exception {
Bean bean = new Bean();
bean.setAction("123");
HashMap paramMap = new HashMap();
paramMap.put("url1", "123");
paramMap.put("url2", "456");
Reported by PMD.
Line: 11
public class Bug_for_liuwanzhen_ren extends TestCase {
public void test_0() throws Exception {
Bean bean = new Bean();
bean.setAction("123");
HashMap paramMap = new HashMap();
paramMap.put("url1", "123");
paramMap.put("url2", "456");
Reported by PMD.
Line: 21
String str = JSON.toJSONString(bean);
System.out.println(str);
Bean bean2 = JSON.parseObject(str, Bean.class);
System.out.println(bean2.getAction());
System.out.println(bean2.getParamMap());
}
public static class Bean {
Reported by PMD.
Line: 22
System.out.println(str);
Bean bean2 = JSON.parseObject(str, Bean.class);
System.out.println(bean2.getAction());
System.out.println(bean2.getParamMap());
}
public static class Bean {
private String action;
Reported by PMD.
Line: 25
System.out.println(bean2.getParamMap());
}
public static class Bean {
private String action;
private HashMap<String, String> paramMap;
public String getAction() {
Reported by PMD.
Line: 28
public static class Bean {
private String action;
private HashMap<String, String> paramMap;
public String getAction() {
return action;
}
Reported by PMD.
Line: 38
this.action = action;
}
public HashMap<String, String> getParamMap() {
return paramMap;
}
public void setParamMap(HashMap<String, String> paramMap) {
this.paramMap = paramMap;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONLexerTest_2.java
11 issues
Line: 15
public class JSONLexerTest_2 extends TestCase {
public void test_0() throws Exception {
VO vo = (VO) JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}", VO.class);
Assert.assertNotNull(vo);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 20
Assert.assertNotNull(vo);
}
public void test_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO1\"}", VO.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 30
Assert.assertNotNull(error);
}
public void test_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$A\"}", VO.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 40
Assert.assertNotNull(error);
}
public void test_a() throws Exception {
P a = JSON.parseObject("{\"vo\":{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}}", P.class);
Assert.assertNotNull(a);
}
public void test_list() throws Exception {
Reported by PMD.
Line: 45
Assert.assertNotNull(a);
}
public void test_list() throws Exception {
List<VO> list = JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}]",
new TypeReference<List<VO>>() {
});
Assert.assertNotNull(list);
Assert.assertNotNull(list.get(0));
Reported by PMD.
Line: 53
Assert.assertNotNull(list.get(0));
}
public void test_list_2() throws Exception {
List<VO> list = JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"},{}]",
new TypeReference<List<VO>>() {
});
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
Reported by PMD.
Line: 63
Assert.assertNotNull(list.get(1));
}
public void test_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}[]",
new TypeReference<List<VO>>() {
});
Reported by PMD.
Line: 69
JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}[]",
new TypeReference<List<VO>>() {
});
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 21
}
public void test_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO1\"}", VO.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 31
}
public void test_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$A\"}", VO.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.