The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_chengchao.java
2 issues
Line: 12
public class Bug_for_chengchao extends TestCase {
public void test_0() throws Exception {
SerializerFeature[] features = { SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteEnumUsingToString, SerializerFeature.SortField };
Entity entity = new Entity();
Reported by PMD.
Line: 12
public class Bug_for_chengchao extends TestCase {
public void test_0() throws Exception {
SerializerFeature[] features = { SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteEnumUsingToString, SerializerFeature.SortField };
Entity entity = new Entity();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_280.java
2 issues
Line: 12
public class Bug_for_issue_280 extends TestCase {
public void test_for_issue() throws Exception {
TypeReference<Respone<User>> type= new TypeReference<Respone<User>>() {};
Respone<User> resp = JSON.parseObject("{\"code\":\"\",\"data\":\"\",\"msg\":\"\"}", type);
Assert.assertNull(resp.data);
}
Reported by PMD.
Line: 23
public String code;
public String msg;
public T data;
}
public static class User {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_akvadrako.java
2 issues
Line: 9
public class Bug_for_akvadrako extends TestCase {
public void testNakedFields() throws Exception {
Naked naked = new Naked();
DefaultJSONParser parser = new DefaultJSONParser("{ \"field\": 3 }");
parser.parseObject(naked);
}
Reported by PMD.
Line: 9
public class Bug_for_akvadrako extends TestCase {
public void testNakedFields() throws Exception {
Naked naked = new Naked();
DefaultJSONParser parser = new DefaultJSONParser("{ \"field\": 3 }");
parser.parseObject(naked);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue_for_jiongxiong.java
2 issues
Line: 12
* Created by wenshao on 15/02/2017.
*/
public class Issue_for_jiongxiong extends TestCase {
public void test_for_jiongxiong() throws Exception {
JSON.parseObject("{\"groupNames\":[\"a\"]}", Model.class);
}
public static class Model {
private Set<String> groupNames;
Reported by PMD.
Line: 12
* Created by wenshao on 15/02/2017.
*/
public class Issue_for_jiongxiong extends TestCase {
public void test_for_jiongxiong() throws Exception {
JSON.parseObject("{\"groupNames\":[\"a\"]}", Model.class);
}
public static class Model {
private Set<String> groupNames;
Reported by PMD.
src/main/java/com/alibaba/fastjson/JSONStreamContext.java
2 issues
Line: 11
final static int StartArray = 1004;
final static int ArrayValue = 1005;
protected final JSONStreamContext parent;
protected int state;
public JSONStreamContext(JSONStreamContext parent, int state){
this.parent = parent;
Reported by PMD.
Line: 13
protected final JSONStreamContext parent;
protected int state;
public JSONStreamContext(JSONStreamContext parent, int state){
this.parent = parent;
this.state = state;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_agapple_2.java
2 issues
Line: 11
public class Bug_for_agapple_2 extends TestCase {
public void test_bug() throws Exception {
DbMediaSource obj = new DbMediaSource();
obj.setType(DataMediaType.ORACLE);
JSONObject json = (JSONObject) JSON.toJSON(obj);
Assert.assertEquals("ORACLE", json.get("type"));
Reported by PMD.
Line: 16
obj.setType(DataMediaType.ORACLE);
JSONObject json = (JSONObject) JSON.toJSON(obj);
Assert.assertEquals("ORACLE", json.get("type"));
}
public static class DbMediaSource {
private DataMediaType type;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_320.java
2 issues
Line: 15
public class Bug_for_issue_320 extends TestCase {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void test_for_issue() throws Exception {
Map map = new HashMap();
map.put(1001L, "aaa");
String text = JSON.toJSONString(map);
Reported by PMD.
Line: 24
Assert.assertEquals("{1001:\"aaa\"}", text);
JSONObject obj = JSON.parseObject(text);
Assert.assertEquals("aaa", obj.get(1001));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_352.java
2 issues
Line: 11
import junit.framework.TestCase;
public class Bug_for_issue_352 extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
vo.name = "张三";
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"index\":0,\"名\":\"张三\"}", text);
VO v1 = JSON.parseObject(text, VO.class);
Reported by PMD.
Line: 23
public static class VO {
public int index;
@JSONField(name="名")
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_364.java
2 issues
Line: 9
import junit.framework.TestCase;
public class Bug_for_issue_364 extends TestCase {
public void test_for_issue() throws Exception {
JSONObject jsonObject = new JSONObject(3, true);
jsonObject.put("name", "J.K.SAGE");
jsonObject.put("age", 21);
jsonObject.put("msg", "Hello!");
JSONObject cloneObject = (JSONObject) jsonObject.clone();
Reported by PMD.
Line: 15
jsonObject.put("age", 21);
jsonObject.put("msg", "Hello!");
JSONObject cloneObject = (JSONObject) jsonObject.clone();
assertEquals(JSON.toJSONString(jsonObject), JSON.toJSONString(cloneObject));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_372.java
2 issues
Line: 13
import junit.framework.TestCase;
public class Bug_for_issue_372 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
ObjectDeserializer deser = config.getDeserializer(Model.class);
Assert.assertEquals(JavaBeanDeserializer.class, deser.getClass());
}
Reported by PMD.
Line: 16
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
ObjectDeserializer deser = config.getDeserializer(Model.class);
Assert.assertEquals(JavaBeanDeserializer.class, deser.getClass());
}
@JSONType(asm=false)
public static class Model {
Reported by PMD.