The following issues were found
src/test/java/com/alibaba/json/bvt/support/hsf/HSFJSONUtilsTest_4.java
14 issues
Line: 13
import java.util.HashSet;
public class HSFJSONUtilsTest_4 extends TestCase {
public void test_for_hsf() throws Exception {
final Method method = HSFJSONUtilsTest_4.class.getMethod("f", HashSet.class, BigDecimalDO.class);
String json = "{\"argsTypes\":[\"java.util.HashSet\",\"com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_4$BigDecimalDO\"],\"argsObjs\":[[{\"bd\":10.12379}],{\"$ref\":\"$.argsObjs[0][0]\"}]}";
Object[] values = HSFJSONUtils.parseInvocationArguments(json, new MethodLocator() {
Reported by PMD.
Line: 13
import java.util.HashSet;
public class HSFJSONUtilsTest_4 extends TestCase {
public void test_for_hsf() throws Exception {
final Method method = HSFJSONUtilsTest_4.class.getMethod("f", HashSet.class, BigDecimalDO.class);
String json = "{\"argsTypes\":[\"java.util.HashSet\",\"com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_4$BigDecimalDO\"],\"argsObjs\":[[{\"bd\":10.12379}],{\"$ref\":\"$.argsObjs[0][0]\"}]}";
Object[] values = HSFJSONUtils.parseInvocationArguments(json, new MethodLocator() {
Reported by PMD.
Line: 14
public class HSFJSONUtilsTest_4 extends TestCase {
public void test_for_hsf() throws Exception {
final Method method = HSFJSONUtilsTest_4.class.getMethod("f", HashSet.class, BigDecimalDO.class);
String json = "{\"argsTypes\":[\"java.util.HashSet\",\"com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_4$BigDecimalDO\"],\"argsObjs\":[[{\"bd\":10.12379}],{\"$ref\":\"$.argsObjs[0][0]\"}]}";
Object[] values = HSFJSONUtils.parseInvocationArguments(json, new MethodLocator() {
Reported by PMD.
Line: 25
}
});
assertEquals(2, values.length);
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
Reported by PMD.
Line: 28
assertEquals(2, values.length);
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
Reported by PMD.
Line: 28
assertEquals(2, values.length);
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
Reported by PMD.
Line: 29
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
}
Reported by PMD.
Line: 29
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
}
Reported by PMD.
Line: 29
HashSet<BigDecimalDO> set = (HashSet<BigDecimalDO>) values[0];
assertEquals(1, set.size());
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
}
Reported by PMD.
Line: 32
assertSame(set.iterator().next(), values[1]);
}
public static void f(HashSet<BigDecimalDO> a, BigDecimalDO b) {
}
public static class BigDecimalDO implements Serializable {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/DefaultObjectDeserializerTest_collection.java
14 issues
Line: 54
public static class MyMap<K, V> extends HashMap {
public MyMap() {
throw new RuntimeException();
}
}
}
Reported by PMD.
Line: 14
public class DefaultObjectDeserializerTest_collection extends TestCase {
public void test_0() throws Exception {
String input = "[{}]";
List<HashMap> map = JSON.parseObject(input,
new TypeReference<List<HashMap>>() {
}.getType());
Reported by PMD.
Line: 21
new TypeReference<List<HashMap>>() {
}.getType());
Assert.assertEquals(HashMap.class, map.get(0).getClass());
}
public void test_1() throws Exception {
String input = "{}";
Reported by PMD.
Line: 21
new TypeReference<List<HashMap>>() {
}.getType());
Assert.assertEquals(HashMap.class, map.get(0).getClass());
}
public void test_1() throws Exception {
String input = "{}";
Reported by PMD.
Line: 24
Assert.assertEquals(HashMap.class, map.get(0).getClass());
}
public void test_1() throws Exception {
String input = "{}";
BO<HashMap> map = JSON.parseObject(input,
new TypeReference<BO<HashMap>>() {
}.getType());
Reported by PMD.
Line: 24
Assert.assertEquals(HashMap.class, map.get(0).getClass());
}
public void test_1() throws Exception {
String input = "{}";
BO<HashMap> map = JSON.parseObject(input,
new TypeReference<BO<HashMap>>() {
}.getType());
Reported by PMD.
Line: 27
public void test_1() throws Exception {
String input = "{}";
BO<HashMap> map = JSON.parseObject(input,
new TypeReference<BO<HashMap>>() {
}.getType());
}
public void test_2() throws Exception {
Reported by PMD.
Line: 32
}.getType());
}
public void test_2() throws Exception {
Exception error = null;
try {
String input = "{'map':{}}";
Reported by PMD.
Line: 38
try {
String input = "{'map':{}}";
MyMap<String, HashMap> map = JSON.parseObject(input,
new TypeReference<MyMap<String, HashMap>>() {
}.getType());
} catch (Exception ex) {
error = ex;
}
Reported by PMD.
Line: 41
MyMap<String, HashMap> map = JSON.parseObject(input,
new TypeReference<MyMap<String, HashMap>>() {
}.getType());
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONLexerTest_set.java
14 issues
Line: 11
public class JSONLexerTest_set extends TestCase {
public void test_treeSet() throws Exception {
JSON.parse("Set[]");
}
public void test_error() throws Exception {
Exception error = null;
Reported by PMD.
Line: 11
public class JSONLexerTest_set extends TestCase {
public void test_treeSet() throws Exception {
JSON.parse("Set[]");
}
public void test_error() throws Exception {
Exception error = null;
Reported by PMD.
Line: 15
JSON.parse("Set[]");
}
public void test_error() throws Exception {
Exception error = null;
try {
JSON.parse("S_t[]");
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 19
Exception error = null;
try {
JSON.parse("S_t[]");
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 25
Assert.assertNotNull(error);
}
public void test_error_1() throws Exception {
Exception error = null;
try {
JSON.parse("Se_[]");
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 29
Exception error = null;
try {
JSON.parse("Se_[]");
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 36
}
public void test_error_2() throws Exception {
Exception error = null;
try {
JSON.parse("Set_[]");
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 40
Exception error = null;
try {
JSON.parse("Set_[]");
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 46
Assert.assertNotNull(error);
}
public void test_error_3() throws Exception {
Exception error = null;
try {
JSON.parse("Xet[]");
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 50
Exception error = null;
try {
JSON.parse("Xet[]");
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Mogujie_01.java
14 issues
Line: 22
* Created by wenshao on 16/03/2017.
*/
public class Mogujie_01 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{}", Model.class);
}
public static class Model {
Reported by PMD.
Line: 22
* Created by wenshao on 16/03/2017.
*/
public class Mogujie_01 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{}", Model.class);
}
public static class Model {
Reported by PMD.
Line: 27
}
public static class Model {
public int f0;
public int f1;
public int f2;
public int f3;
public int f4;
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.bug;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONWriter;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
Reported by PMD.
Line: 5
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONWriter;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
Reported by PMD.
Line: 6
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONWriter;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
Reported by PMD.
Line: 7
import com.alibaba.fastjson.JSONWriter;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Reported by PMD.
Line: 8
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
Reported by PMD.
Line: 11
import com.alibaba.json.bvtVO.mogujie.BindQueryRespDTO;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;
Reported by PMD.
Line: 12
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_Set5.java
14 issues
Line: 14
public class WriteClassNameTest_Set5 extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
LinkedHashSet tables = new LinkedHashSet();
tables.add(new ExtTable(1001));
tables.add(new Table());
model.setTables(tables);
Reported by PMD.
Line: 14
public class WriteClassNameTest_Set5 extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
LinkedHashSet tables = new LinkedHashSet();
tables.add(new ExtTable(1001));
tables.add(new Table());
model.setTables(tables);
Reported by PMD.
Line: 22
model.setTables(tables);
String json = JSON.toJSONString(model);
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
Reported by PMD.
Line: 25
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
Reported by PMD.
Line: 25
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
Reported by PMD.
Line: 25
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
Reported by PMD.
Line: 25
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
Reported by PMD.
Line: 25
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set5$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
Reported by PMD.
Line: 28
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private LinkedHashSet<? extends Table> tables;
Reported by PMD.
Line: 28
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":[{\"id\":1001},{}]}", jsonObject.toJSONString());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private LinkedHashSet<? extends Table> tables;
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/TimeDeserializer.java
14 issues
Line: 13
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;
public class TimeDeserializer implements ObjectDeserializer {
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
Reported by PMD.
Line: 13
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;
public class TimeDeserializer implements ObjectDeserializer {
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
Reported by PMD.
Line: 18
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(JSONToken.LITERAL_STRING);
Reported by PMD.
Line: 18
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(JSONToken.LITERAL_STRING);
Reported by PMD.
Line: 18
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(JSONToken.LITERAL_STRING);
Reported by PMD.
Line: 18
public final static TimeDeserializer instance = new TimeDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(JSONToken.LITERAL_STRING);
Reported by PMD.
Line: 21
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.COMMA) {
lexer.nextToken(JSONToken.LITERAL_STRING);
if (lexer.token() != JSONToken.LITERAL_STRING) {
throw new JSONException("syntax error");
}
Reported by PMD.
Line: 58
return (T) new java.sql.Time(((Number) val).longValue());
} else if (val instanceof String) {
String strVal = (String) val;
if (strVal.length() == 0) {
return null;
}
long longVal;
JSONScanner dateLexer = new JSONScanner(strVal);
Reported by PMD.
Line: 65
long longVal;
JSONScanner dateLexer = new JSONScanner(strVal);
if (dateLexer.scanISO8601DateIfMatch()) {
longVal = dateLexer.getCalendar().getTimeInMillis();
} else {
boolean isDigit = true;
for (int i = 0; i< strVal.length(); ++i) {
char ch = strVal.charAt(i);
if (ch < '0' || ch > '9') {
Reported by PMD.
Line: 68
longVal = dateLexer.getCalendar().getTimeInMillis();
} else {
boolean isDigit = true;
for (int i = 0; i< strVal.length(); ++i) {
char ch = strVal.charAt(i);
if (ch < '0' || ch > '9') {
isDigit = false;
break;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue869.java
14 issues
Line: 15
* Created by wenshao on 2016/10/19.
*/
public class Issue869 extends TestCase {
public void test_for_issue() throws Exception {
List<DoublePoint> doublePointList = new ArrayList<DoublePoint>();
{
DoublePoint doublePoint = new DoublePoint();
doublePoint.startPoint = new Point(22, 35);
doublePoint.endPoint = doublePoint.startPoint;
Reported by PMD.
Line: 31
}
String json = JSON.toJSONString(doublePointList);
assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
}
public void test_for_issue_parse() throws Exception {
String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
Reported by PMD.
Line: 34
assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
}
public void test_for_issue_parse() throws Exception {
String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
Reported by PMD.
Line: 34
assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
}
public void test_for_issue_parse() throws Exception {
String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
Reported by PMD.
Line: 38
String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
Reported by PMD.
Line: 39
String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
public static class DoublePoint{
Reported by PMD.
Line: 40
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
public static class DoublePoint{
public Point startPoint;
Reported by PMD.
Line: 40
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
public static class DoublePoint{
public Point startPoint;
Reported by PMD.
Line: 40
List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
public static class DoublePoint{
public Point startPoint;
Reported by PMD.
Line: 41
assertNotNull(doublePointList.get(0));
assertNotNull(doublePointList.get(1));
assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
}
public static class DoublePoint{
public Point startPoint;
public Point endPoint;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest5.java
14 issues
Line: 20
model.a = b;
String str = JSON.toJSONString(model);
System.out.println(str);
assertEquals("{\"a\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest5$B\",\"id\":1001,\"value\":2017}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertTrue(model2.a instanceof B);
}
Reported by PMD.
Line: 34
model.a = a;
String str = JSON.toJSONString(model);
System.out.println(str);
assertEquals("{\"a\":{\"id\":1001}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertSame(A.class, model2.a.getClass());
}
Reported by PMD.
Line: 12
* Created by wenshao on 14/08/2017.
*/
public class WriteClassNameTest5 extends TestCase {
public void test_for_writeClassName() throws Exception {
Model model = new Model();
B b = new B();
b.id = 1001;
b.value = 2017;
model.a = b;
Reported by PMD.
Line: 12
* Created by wenshao on 14/08/2017.
*/
public class WriteClassNameTest5 extends TestCase {
public void test_for_writeClassName() throws Exception {
Model model = new Model();
B b = new B();
b.id = 1001;
b.value = 2017;
model.a = b;
Reported by PMD.
Line: 21
String str = JSON.toJSONString(model);
System.out.println(str);
assertEquals("{\"a\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest5$B\",\"id\":1001,\"value\":2017}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertTrue(model2.a instanceof B);
}
Reported by PMD.
Line: 24
assertEquals("{\"a\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest5$B\",\"id\":1001,\"value\":2017}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertTrue(model2.a instanceof B);
}
public void test_for_writeClassName_no() throws Exception {
Model model = new Model();
A a = new A();
Reported by PMD.
Line: 27
assertTrue(model2.a instanceof B);
}
public void test_for_writeClassName_no() throws Exception {
Model model = new Model();
A a = new A();
a.id = 1001;
model.a = a;
Reported by PMD.
Line: 27
assertTrue(model2.a instanceof B);
}
public void test_for_writeClassName_no() throws Exception {
Model model = new Model();
A a = new A();
a.id = 1001;
model.a = a;
Reported by PMD.
Line: 35
String str = JSON.toJSONString(model);
System.out.println(str);
assertEquals("{\"a\":{\"id\":1001}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertSame(A.class, model2.a.getClass());
}
Reported by PMD.
Line: 38
assertEquals("{\"a\":{\"id\":1001}}", str);
Model model2 = JSON.parseObject(str, Model.class);
assertSame(A.class, model2.a.getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
public A a;
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/ResolveFieldDeserializer.java
14 issues
Line: 16
@SuppressWarnings("rawtypes")
public final class ResolveFieldDeserializer extends FieldDeserializer {
private final int index;
private final List list;
private final DefaultJSONParser parser;
private final Object key;
private final Map map;
Reported by PMD.
Line: 17
public final class ResolveFieldDeserializer extends FieldDeserializer {
private final int index;
private final List list;
private final DefaultJSONParser parser;
private final Object key;
private final Map map;
Reported by PMD.
Line: 18
private final int index;
private final List list;
private final DefaultJSONParser parser;
private final Object key;
private final Map map;
private final Collection collection;
Reported by PMD.
Line: 20
private final List list;
private final DefaultJSONParser parser;
private final Object key;
private final Map map;
private final Collection collection;
public ResolveFieldDeserializer(DefaultJSONParser parser, List list, int index){
Reported by PMD.
Line: 21
private final DefaultJSONParser parser;
private final Object key;
private final Map map;
private final Collection collection;
public ResolveFieldDeserializer(DefaultJSONParser parser, List list, int index){
super(null, null);
Reported by PMD.
Line: 23
private final Object key;
private final Map map;
private final Collection collection;
public ResolveFieldDeserializer(DefaultJSONParser parser, List list, int index){
super(null, null);
this.parser = parser;
this.index = index;
Reported by PMD.
Line: 40
public ResolveFieldDeserializer(Map map, Object index){
super(null, null);
this.parser = null;
this.index = -1;
this.list = null;
this.key = index;
this.map = map;
Reported by PMD.
Line: 42
this.parser = null;
this.index = -1;
this.list = null;
this.key = index;
this.map = map;
collection = null;
Reported by PMD.
Line: 53
public ResolveFieldDeserializer(Collection collection){
super(null, null);
this.parser = null;
this.index = -1;
this.list = null;
key = null;
map = null;
Reported by PMD.
Line: 55
this.parser = null;
this.index = -1;
this.list = null;
key = null;
map = null;
this.collection = collection;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/feature/DisableFieldSmartMatchTest.java
14 issues
Line: 12
* Created by wenshao on 17/03/2017.
*/
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
Reported by PMD.
Line: 12
* Created by wenshao on 17/03/2017.
*/
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
Reported by PMD.
Line: 13
*/
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
Reported by PMD.
Line: 13
*/
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
Reported by PMD.
Line: 14
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
Reported by PMD.
Line: 14
public class DisableFieldSmartMatchTest extends TestCase {
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
Reported by PMD.
Line: 15
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
Reported by PMD.
Line: 15
public void test_feature() throws Exception {
assertEquals(123, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class).personId);
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
Reported by PMD.
Line: 18
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
}
public static class Model_for_disableFieldSmartMatchMask {
Reported by PMD.
Line: 18
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask.class, Feature.DisableFieldSmartMatch).personId);
}
public void test_feature2() throws Exception {
assertEquals(0, JSON.parseObject("{\"person_id\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
assertEquals(123, JSON.parseObject("{\"personId\":123}", Model_for_disableFieldSmartMatchMask2.class).personId);
}
public static class Model_for_disableFieldSmartMatchMask {
Reported by PMD.