The following issues were found
src/test/java/com/alibaba/json/bvt/parser/BigSpecailKeyTest.java
4 issues
Line: 15
import junit.framework.TestCase;
public class BigSpecailKeyTest extends TestCase {
public void test_big_special_key() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Reported by PMD.
Line: 18
public void test_big_special_key() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Arrays.fill(chars, '0');
buf.append(chars);
}
Reported by PMD.
Line: 20
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Arrays.fill(chars, '0');
buf.append(chars);
}
String key = buf.toString();
Reported by PMD.
Line: 32
String text = JSON.toJSONString(map);
JSONObject obj = JSON.parseObject(text);
Assert.assertEquals(map.get(key), obj.get(key));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1399.java
4 issues
Line: 10
* Created by wenshao on 15/08/2017.
*/
public class Issue1399 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("false", boolean.class);
JSON.parseObject("false", Boolean.class);
JSON.parseObject("\"false\"", boolean.class);
JSON.parseObject("\"false\"", Boolean.class);
Reported by PMD.
Line: 10
* Created by wenshao on 15/08/2017.
*/
public class Issue1399 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("false", boolean.class);
JSON.parseObject("false", Boolean.class);
JSON.parseObject("\"false\"", boolean.class);
JSON.parseObject("\"false\"", Boolean.class);
Reported by PMD.
Line: 22
JSON.parseObject("\"FALSE\"", Boolean.class);
}
public void test_for_issue_true() throws Exception {
JSON.parseObject("true", boolean.class);
JSON.parseObject("true", Boolean.class);
JSON.parseObject("\"true\"", boolean.class);
JSON.parseObject("\"true\"", Boolean.class);
Reported by PMD.
Line: 22
JSON.parseObject("\"FALSE\"", Boolean.class);
}
public void test_for_issue_true() throws Exception {
JSON.parseObject("true", boolean.class);
JSON.parseObject("true", Boolean.class);
JSON.parseObject("\"true\"", boolean.class);
JSON.parseObject("\"true\"", Boolean.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1375.java
4 issues
Line: 13
* Created by wenshao on 06/08/2017.
*/
public class Issue1375 extends TestCase {
public void test_issue() throws Exception {
assertSame(CollectionCodec.instance
, SerializeConfig.getGlobalInstance()
.getObjectWriter(LinkedList.class));
}
}
Reported by PMD.
Line: 14
*/
public class Issue1375 extends TestCase {
public void test_issue() throws Exception {
assertSame(CollectionCodec.instance
, SerializeConfig.getGlobalInstance()
.getObjectWriter(LinkedList.class));
}
}
Reported by PMD.
Line: 15
public class Issue1375 extends TestCase {
public void test_issue() throws Exception {
assertSame(CollectionCodec.instance
, SerializeConfig.getGlobalInstance()
.getObjectWriter(LinkedList.class));
}
}
Reported by PMD.
Line: 16
public void test_issue() throws Exception {
assertSame(CollectionCodec.instance
, SerializeConfig.getGlobalInstance()
.getObjectWriter(LinkedList.class));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1357.java
4 issues
Line: 16
String str = "{\"d2\":null}";
Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
System.out.println(b);
}
public static class Test2Bean{
private LocalDateTime d2;
Reported by PMD.
Line: 12
* Created by wenshao on 31/07/2017.
*/
public class Issue1357 extends TestCase {
public void test_for_issue() throws Exception {
String str = "{\"d2\":null}";
Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
System.out.println(b);
}
Reported by PMD.
Line: 12
* Created by wenshao on 31/07/2017.
*/
public class Issue1357 extends TestCase {
public void test_for_issue() throws Exception {
String str = "{\"d2\":null}";
Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
System.out.println(b);
}
Reported by PMD.
Line: 20
}
public static class Test2Bean{
private LocalDateTime d2;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1310_noasm.java
4 issues
Line: 11
* Created by wenshao on 29/07/2017.
*/
public class Issue1310_noasm extends TestCase {
public void test_trim() throws Exception {
Model model = new Model();
model.value = " a ";
assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));
Reported by PMD.
Line: 11
* Created by wenshao on 29/07/2017.
*/
public class Issue1310_noasm extends TestCase {
public void test_trim() throws Exception {
Model model = new Model();
model.value = " a ";
assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));
Reported by PMD.
Line: 15
Model model = new Model();
model.value = " a ";
assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));
Model model2 = JSON.parseObject("{\"value\":\" a \"}", Model.class);
assertEquals("a", model2.value);
}
Reported by PMD.
Line: 18
assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));
Model model2 = JSON.parseObject("{\"value\":\" a \"}", Model.class);
assertEquals("a", model2.value);
}
private static class Model {
@JSONField(format = "trim")
private String value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/DefaultExtJSONParserTest_6.java
4 issues
Line: 11
public class DefaultExtJSONParserTest_6 extends TestCase {
public void test_0() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{value:{,,,,\"value\":3,\"id\":1}}");
parser.config(Feature.AllowArbitraryCommas, true);
Entity entity = new Entity();
parser.parseObject(entity);
Assert.assertEquals(3, entity.getValue().getValue());
Reported by PMD.
Line: 16
parser.config(Feature.AllowArbitraryCommas, true);
Entity entity = new Entity();
parser.parseObject(entity);
Assert.assertEquals(3, entity.getValue().getValue());
}
public void test_1() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{'value':{\"value\":3,\"id\":1}}");
parser.config(Feature.AllowArbitraryCommas, false);
Reported by PMD.
Line: 19
Assert.assertEquals(3, entity.getValue().getValue());
}
public void test_1() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{'value':{\"value\":3,\"id\":1}}");
parser.config(Feature.AllowArbitraryCommas, false);
Entity entity = new Entity();
parser.parseObject(entity);
Assert.assertEquals(3, entity.getValue().getValue());
Reported by PMD.
Line: 24
parser.config(Feature.AllowArbitraryCommas, false);
Entity entity = new Entity();
parser.parseObject(entity);
Assert.assertEquals(3, entity.getValue().getValue());
}
public static class Entity {
private V1 value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1272_IgnoreError.java
4 issues
Line: 12
* Created by wenshao on 18/06/2017.
*/
public class Issue1272_IgnoreError extends TestCase {
public void test_for_issue() throws Exception {
String text = JSON.toJSONString(new Point(), SerializerFeature.IgnoreErrorGetter);
assertEquals("{}", text);
}
public static class Point {
Reported by PMD.
Line: 14
public class Issue1272_IgnoreError extends TestCase {
public void test_for_issue() throws Exception {
String text = JSON.toJSONString(new Point(), SerializerFeature.IgnoreErrorGetter);
assertEquals("{}", text);
}
public static class Point {
private Long userId;
Reported by PMD.
Line: 19
public static class Point {
private Long userId;
public long getUserId() {
return userId;
}
}
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.issue_1200;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
/**
* Created by wenshao on 18/06/2017.
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1262.java
4 issues
Line: 13
* Created by wenshao on 15/06/2017.
*/
public class Issue1262 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
}
public static class Model {
public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
Reported by PMD.
Line: 13
* Created by wenshao on 15/06/2017.
*/
public class Issue1262 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
}
public static class Model {
public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
Reported by PMD.
Line: 14
*/
public class Issue1262 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
}
public static class Model {
public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
}
Reported by PMD.
Line: 14
*/
public class Issue1262 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
}
public static class Model {
public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/InetSocketAddressTest.java
4 issues
Line: 13
public class InetSocketAddressTest extends TestCase {
public void test_parse() throws Exception {
JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
}
public void test_parse_error() throws Exception {
Exception error = null;
Reported by PMD.
Line: 13
public class InetSocketAddressTest extends TestCase {
public void test_parse() throws Exception {
JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
}
public void test_parse_error() throws Exception {
Exception error = null;
Reported by PMD.
Line: 17
JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
}
public void test_parse_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"address\":'10.20.133.23',\"port\":'12.3',\"xx\":33}", InetSocketAddress.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 18
}
public void test_parse_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"address\":'10.20.133.23',\"port\":'12.3',\"xx\":33}", InetSocketAddress.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1100/Issue1177_4.java
4 issues
Line: 18
public void test_for_issue() throws Exception {
String text = "{\"models\":[{\"x\":\"y\"},{\"x\":\"y\"}]}";
Root root = JSONObject.parseObject(text, Root.class);
System.out.println(JSON.toJSONString(root));
String jsonpath = "$..x";
String value="y2";
JSONPath.set(root, jsonpath, value);
assertEquals("{\"models\":[{\"x\":\"y2\"},{\"x\":\"y2\"}]}", JSON.toJSONString(root));
Reported by PMD.
Line: 15
* Created by wenshao on 05/05/2017.
*/
public class Issue1177_4 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"models\":[{\"x\":\"y\"},{\"x\":\"y\"}]}";
Root root = JSONObject.parseObject(text, Root.class);
System.out.println(JSON.toJSONString(root));
String jsonpath = "$..x";
String value="y2";
Reported by PMD.
Line: 22
String jsonpath = "$..x";
String value="y2";
JSONPath.set(root, jsonpath, value);
assertEquals("{\"models\":[{\"x\":\"y2\"},{\"x\":\"y2\"}]}", JSON.toJSONString(root));
}
public static class Root {
public List<Model> models;
Reported by PMD.
Line: 6
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.TypeReference;
import junit.framework.TestCase;
import java.util.List;
/**
Reported by PMD.