The following issues were found
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectO1_A.java
2 issues
Line: 8
import java.io.Serializable;
public class ObjectO1_A implements Serializable {
int a;
int b;
Reported by PMD.
Line: 8
import java.io.Serializable;
public class ObjectO1_A implements Serializable {
int a;
int b;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectD.java
2 issues
Line: 5
import java.util.List;
public class ObjectD {
private int a;
private int b;
Reported by PMD.
Line: 5
import java.util.List;
public class ObjectD {
private int a;
private int b;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/SpecialKeyTest.java
2 issues
Line: 20
map.put(2, "b");
String text = JSON.toJSONString(map);
System.out.println(text);
Map<Integer, Object> map2 = JSON.parseObject(text, new TypeReference<Map<Integer, Object>>() {});
Assert.assertEquals(map, map2);
}
}
Reported by PMD.
Line: 14
public class SpecialKeyTest extends TestCase {
public void test_0() throws Exception {
Map<Integer, Object> map = new HashMap<Integer, Object>();
map.put(1, "a");
map.put(2, "b");
String text = JSON.toJSONString(map);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_liqing.java
2 issues
Line: 8
import junit.framework.TestCase;
public class Bug_for_liqing extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
config.setAutoTypeSupport(true);
String json = "{\"@type\":\"java.util.HashMap\",\"wcChangeAttr\":{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_liqing.TpFeedBackDO\",\"attributes\":{\"@type\":\"java.util.concurrent.ConcurrentHashMap\"},\"wcStatus\":102B}}";
JSON.parse(json, config);
}
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Bug_for_liqing extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
config.setAutoTypeSupport(true);
String json = "{\"@type\":\"java.util.HashMap\",\"wcChangeAttr\":{\"@type\":\"com.alibaba.json.bvt.bug.Bug_for_liqing.TpFeedBackDO\",\"attributes\":{\"@type\":\"java.util.concurrent.ConcurrentHashMap\"},\"wcStatus\":102B}}";
JSON.parse(json, config);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/SlashTest.java
2 issues
Line: 10
import com.alibaba.fastjson.JSONObject;
public class SlashTest extends TestCase {
public void test_0 () throws Exception {
String text = "{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}";
JSONObject json = (JSONObject) JSON.parse(text);
Assert.assertEquals("{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}", json.toString());
}
Reported by PMD.
Line: 14
String text = "{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}";
JSONObject json = (JSONObject) JSON.parse(text);
Assert.assertEquals("{\"errorMessage\":\"resource '/rpc/hello/none.json' is not found !\"}", json.toString());
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectC.java
2 issues
Line: 3
package com.alibaba.fastjson.deserializer.issues3796.bean;
public class ObjectC {
private int a;
private int b = 0;
private long c;
Reported by PMD.
Line: 7
private int a;
private int b = 0;
private long c;
private int d;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectQ.java
2 issues
Line: 9
import java.util.List;
public class ObjectQ {
private int a;
private int b;
Reported by PMD.
Line: 15
private int b;
private boolean c = false;
private List<CommonObject> d;
public int getA() {
return a;
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/SimpleDateFormatSerializer.java
2 issues
Line: 10
public class SimpleDateFormatSerializer implements ObjectSerializer {
private final String pattern;
public SimpleDateFormatSerializer(String pattern){
this.pattern = pattern;
}
Reported by PMD.
Line: 18
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
if (object == null) {
serializer.out.writeNull();
return;
}
Date date = (Date) object;
SimpleDateFormat format = new SimpleDateFormat(pattern, serializer.locale);
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectQ1.java
2 issues
Line: 8
import java.util.List;
public class ObjectQ1 {
private int a;
private int b;
Reported by PMD.
Line: 8
import java.util.List;
public class ObjectQ1 {
private int a;
private int b;
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/EnumCreatorDeserializer.java
2 issues
Line: 11
import java.lang.reflect.Type;
public class EnumCreatorDeserializer implements ObjectDeserializer {
private final Method creator;
private final Class paramType;
public EnumCreatorDeserializer(Method creator) {
this.creator = creator;
paramType = creator.getParameterTypes()[0];
Reported by PMD.
Line: 12
public class EnumCreatorDeserializer implements ObjectDeserializer {
private final Method creator;
private final Class paramType;
public EnumCreatorDeserializer(Method creator) {
this.creator = creator;
paramType = creator.getParameterTypes()[0];
}
Reported by PMD.