The following issues were found
src/main/java/com/alibaba/fastjson/parser/JSONLexerBase.java
753 issues
Line: 364
}
nextToken();
break;
}
}
public final void nextIdent() {
while (isWhitespace(ch)) {
Reported by PMD.
Line: 856
hash = 31 * hash + chLocal;
sp++;
continue;
}
this.ch = charAt(bp);
token = JSONToken.IDENTIFIER;
Reported by PMD.
Line: 1766
}
matchStat = NOT_MATCH;
return null;
}
if (chLocal == ',') {
bp += offset;
this.ch = this.charAt(bp);
Reported by PMD.
Line: 1892
}
matchStat = NOT_MATCH;
return;
}
if (chLocal == seperator) {
bp += offset;
this.ch = this.charAt(bp);
Reported by PMD.
Line: 2212
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2474
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2634
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2814
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2952
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 3079
chLocal = charAt(bp + offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return null;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/TypeUtils.java
721 issues
Line: 917
return decimal.byteValueExact();
}
public static short shortValue(BigDecimal decimal) {
if (decimal == null) {
return 0;
}
int scale = decimal.scale();
Reported by PMD.
Line: 1937
Arrays.sort(paramNames_sorted);
paramNameMapping = new short[paramNames.length];
for(short p = 0; p < paramNames.length; p++){
int index = Arrays.binarySearch(paramNames_sorted, paramNames[p]);
paramNameMapping[index] = p;
}
paramNames = paramNames_sorted;
}
Reported by PMD.
Line: 1957
}
}
if(p >= 0){
short index = paramNameMapping[p];
Annotation[] paramAnnotations = paramAnnotationArrays[index];
if(paramAnnotations != null){
for(Annotation paramAnnotation : paramAnnotations){
if(paramAnnotation instanceof JSONField){
annotation = (JSONField) paramAnnotation;
Reported by PMD.
Line: 3015
return creatorConstructor;
}
public static String[] getKoltinConstructorParameters(Class clazz){
if(kotlin_kclass_constructor == null && !kotlin_class_klass_error){
try{
Class class_kotlin_kclass = Class.forName("kotlin.reflect.jvm.internal.KClassImpl");
kotlin_kclass_constructor = class_kotlin_kclass.getConstructor(Class.class);
} catch(Throwable e){
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
Line: 451
return castToDate(value, null);
}
public static Date castToDate(Object value, String format){
if(value == null){
return null;
}
if(value instanceof Date){ // 使用频率最高的,应优先处理
Reported by PMD.
src/main/java/com/alibaba/fastjson/JSONPath.java
647 issues
Line: 907
public JSONPathParser(String path){
this.path = path;
next();
}
void next() {
ch = path.charAt(pos++);
}
Reported by PMD.
Line: 102
|| segmentType == PropertySegment.class) {
continue;
}
return false;
}
return true;
} catch (JSONPathException ex) {
// skip
return false;
Reported by PMD.
Line: 772
* @param path
* @return
*/
public static Object extract(String json, String path, ParserConfig config, int features, Feature... optionFeatures) {
features |= Feature.OrderedField.mask;
DefaultJSONParser parser = new DefaultJSONParser(json, config, features);
JSONPath jsonPath = compile(path);
Object result = jsonPath.extract(parser);
parser.lexer.close();
Reported by PMD.
Line: 1744
return segment;
}
Filter filterRest(Filter filter) {
boolean and = ch == '&';
if ((ch == '&' && getNextChar() == '&') || (ch == '|' && getNextChar() == '|')) {
next();
next();
Reported by PMD.
Line: 2004
return result;
}
Segment buildArraySegement(String indexText) {
final int indexTextLen = indexText.length();
final char firstChar = indexText.charAt(0);
final char lastChar = indexText.charAt(indexTextLen - 1);
int commaIndex = indexText.indexOf(',');
Reported by PMD.
Line: 2263
}
}
static int compare(Object a, Object b) {
if (a.getClass() == b.getClass()) {
return ((Comparable) a).compareTo(b);
}
Class typeA = a.getClass();
Reported by PMD.
Line: 2263
}
}
static int compare(Object a, Object b) {
if (a.getClass() == b.getClass()) {
return ((Comparable) a).compareTo(b);
}
Class typeA = a.getClass();
Reported by PMD.
Line: 2263
}
}
static int compare(Object a, Object b) {
if (a.getClass() == b.getClass()) {
return ((Comparable) a).compareTo(b);
}
Class typeA = a.getClass();
Reported by PMD.
Line: 2263
}
}
static int compare(Object a, Object b) {
if (a.getClass() == b.getClass()) {
return ((Comparable) a).compareTo(b);
}
Class typeA = a.getClass();
Reported by PMD.
Line: 2263
}
}
static int compare(Object a, Object b) {
if (a.getClass() == b.getClass()) {
return ((Comparable) a).compareTo(b);
}
Class typeA = a.getClass();
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/JSONScanner.java
474 issues
Line: 1384
}
matchStat = NOT_MATCH;
return null;
}
} else if (text.startsWith("ull", index)) {
index += 3;
ch = charAt(index++);
list = null;
Reported by PMD.
Line: 1677
matchStat = NOT_MATCH;
return false;
}
break;
}
matchStat = END;
break;
} else if (isWhitespace(ch)) {
ch = charAt(++bp);
Reported by PMD.
Line: 1776
chLocal = charAt(offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 1922
chLocal = charAt(offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2016
chLocal = charAt(offset++);
continue;
}
break;
}
matchStat = NOT_MATCH;
return 0;
} else {
matchStat = NOT_MATCH;
Reported by PMD.
Line: 2288
next();
continue;
}
break;
}
if (types.length != typeIndex) {
String[] array = new String[typeIndex];
System.arraycopy(types, 0, array, 0, typeIndex);
types = array;
Reported by PMD.
Line: 35
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONScanner extends JSONLexerBase {
private final String text;
private final int len;
public JSONScanner(String input){
Reported by PMD.
Line: 35
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONScanner extends JSONLexerBase {
private final String text;
private final int len;
public JSONScanner(String input){
Reported by PMD.
Line: 35
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONScanner extends JSONLexerBase {
private final String text;
private final int len;
public JSONScanner(String input){
Reported by PMD.
Line: 35
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONScanner extends JSONLexerBase {
private final String text;
private final int len;
public JSONScanner(String input){
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/JavaBeanDeserializer.java
343 issues
Line: 93
fieldDeserializers = new FieldDeserializer[beanInfo.fields.length];
for (int i = 0, size = beanInfo.fields.length; i < size; ++i) {
FieldInfo fieldInfo = beanInfo.fields[i];
FieldDeserializer fieldDeserializer = getFieldDeserializer(fieldInfo.name);
fieldDeserializers[i] = fieldDeserializer;
}
}
public FieldDeserializer getFieldDeserializer(String key) {
Reported by PMD.
Line: 295
}
@SuppressWarnings({ "unchecked" })
public <T> T deserialzeArrayMapping(DefaultJSONParser parser, Type type, Object fieldName, Object object) {
final JSONLexer lexer = parser.lexer; // xxx
if (lexer.token() != JSONToken.LBRACKET) {
throw new JSONException("error");
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
Line: 395
protected <T> T deserialze(DefaultJSONParser parser, //
Type type, //
Object fieldName, //
Object object, //
int features, //
int[] setFlags) {
if (type == JSON.class || type == JSONObject.class) {
return (T) parser.parse();
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/DefaultJSONParser.java
296 issues
Line: 763
if (lexer.isEnabled(Feature.AllowArbitraryCommas)) {
while (lexer.token() == JSONToken.COMMA) {
lexer.nextToken();
continue;
}
}
if (lexer.token() == JSONToken.RBRACKET) {
break;
Reported by PMD.
Line: 1201
if (lexer.isEnabled(Feature.AllowArbitraryCommas)) {
while (lexer.token() == JSONToken.COMMA) {
lexer.nextToken();
continue;
}
}
Object value;
switch (lexer.token()) {
Reported by PMD.
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.parser;
import com.alibaba.fastjson.*;
import com.alibaba.fastjson.parser.deserializer.*;
import com.alibaba.fastjson.serializer.BeanContext;
import com.alibaba.fastjson.serializer.IntegerCodec;
Reported by PMD.
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.parser;
import com.alibaba.fastjson.*;
import com.alibaba.fastjson.parser.deserializer.*;
import com.alibaba.fastjson.serializer.BeanContext;
import com.alibaba.fastjson.serializer.IntegerCodec;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
Line: 43
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class DefaultJSONParser implements Closeable {
public final Object input;
public final SymbolTable symbolTable;
protected ParserConfig config;
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/JavaBeanInfo.java
263 issues
Line: 266
public static JavaBeanInfo build(Class<?> clazz //
, Type type //
, PropertyNamingStrategy propertyNamingStrategy //
, boolean fieldBased //
, boolean compatibleWithJavaBean
, boolean jacksonCompatible
) {
JSONType jsonType = TypeUtils.getAnnotation(clazz,JSONType.class);
Reported by PMD.
Line: 267
public static JavaBeanInfo build(Class<?> clazz //
, Type type //
, PropertyNamingStrategy propertyNamingStrategy //
, boolean fieldBased //
, boolean compatibleWithJavaBean
, boolean jacksonCompatible
) {
JSONType jsonType = TypeUtils.getAnnotation(clazz,JSONType.class);
if (jsonType != null) {
Reported by PMD.
Line: 20
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
Reported by PMD.
Line: 20
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
Reported by PMD.
Line: 20
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
Reported by PMD.
Line: 20
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
Reported by PMD.
Line: 20
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
Reported by PMD.
Line: 22
public class JavaBeanInfo {
public final Class<?> clazz;
public final Class<?> builderClass;
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
public final Method factoryMethod;
public final Method buildMethod;
Reported by PMD.
Line: 27
public final Constructor<?> defaultConstructor;
public final Constructor<?> creatorConstructor;
public final Method factoryMethod;
public final Method buildMethod;
public final int defaultConstructorParameterSize;
public final FieldInfo[] fields;
public final FieldInfo[] sortedFields;
Reported by PMD.
Line: 29
public final Method factoryMethod;
public final Method buildMethod;
public final int defaultConstructorParameterSize;
public final FieldInfo[] fields;
public final FieldInfo[] sortedFields;
public final int parserFeatures;
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/ASMSerializerFactory.java
261 issues
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 26
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
Reported by PMD.
Line: 28
public class ASMSerializerFactory implements Opcodes {
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
static final String JSONSerializer = type(JSONSerializer.class);
static final String ObjectSerializer = type(ObjectSerializer.class);
Reported by PMD.
Line: 30
protected final ASMClassLoader classLoader = new ASMClassLoader();
private final AtomicLong seed = new AtomicLong();
static final String JSONSerializer = type(JSONSerializer.class);
static final String ObjectSerializer = type(ObjectSerializer.class);
static final String ObjectSerializer_desc = "L" + ObjectSerializer + ";";
static final String SerializeWriter = type(SerializeWriter.class);
Reported by PMD.
Line: 53
static int original = 7;
static int processValue = 8;
private final FieldInfo[] getters;
private final String className;
private final SerializeBeanInfo beanInfo;
private final boolean writeDirect;
private Map<String, Integer> variants = new HashMap<String, Integer>();
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/Jdk8DateCodec.java
228 issues
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 259
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2200/Issue2224.java
226 issues
Line: 13
public class Issue2224 extends TestCase {
//support inherit with other parameterized type
public void test_for_issue() {
String json = "[{\"idNo\":\"123456\",\"name\":\"tom\"},{\"idNo\":\"123457\",\"name\":\"jack\"}]";
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
Reported by PMD.
Line: 13
public class Issue2224 extends TestCase {
//support inherit with other parameterized type
public void test_for_issue() {
String json = "[{\"idNo\":\"123456\",\"name\":\"tom\"},{\"idNo\":\"123457\",\"name\":\"jack\"}]";
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
Reported by PMD.
Line: 16
public void test_for_issue() {
String json = "[{\"idNo\":\"123456\",\"name\":\"tom\"},{\"idNo\":\"123457\",\"name\":\"jack\"}]";
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
Reported by PMD.
Line: 17
String json = "[{\"idNo\":\"123456\",\"name\":\"tom\"},{\"idNo\":\"123457\",\"name\":\"jack\"}]";
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
Reported by PMD.
Line: 17
String json = "[{\"idNo\":\"123456\",\"name\":\"tom\"},{\"idNo\":\"123457\",\"name\":\"jack\"}]";
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
Reported by PMD.
Line: 18
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
Reported by PMD.
Line: 18
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
Reported by PMD.
Line: 18
PersonCollection personCollection = JSON.parseObject(json, PersonCollection.class);
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
Reported by PMD.
Line: 19
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
//support inherit with other parameterized type and item type is generic
Reported by PMD.
Line: 19
assertNotNull(personCollection);
assertEquals(2, personCollection.size());
assertEquals("tom", personCollection.get("123456").getName());
assertEquals("jack", personCollection.get("123457").getName());
String json2 = JSON.toJSONString(personCollection);
assertNotNull(json2);
}
//support inherit with other parameterized type and item type is generic
Reported by PMD.