The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/filters/PropertyFilterTest2.java
3 issues
Line: 12
public class PropertyFilterTest2 extends TestCase {
public void test_0() throws Exception {
class VO {
public int id;
public String name;
}
Reported by PMD.
Line: 18
public String name;
}
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
return "id".equals(name);
}
};
Reported by PMD.
Line: 18
public String name;
}
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
return "id".equals(name);
}
};
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/JSONDirectTest.java
3 issues
Line: 11
import junit.framework.TestCase;
public class JSONDirectTest extends TestCase {
public void test_feature() throws Exception {
Model model = new Model();
model.id = 1001;
model.value = "{}";
String json = JSON.toJSONString(model);
Reported by PMD.
Line: 22
}
public static class Model {
public int id;
@JSONField(jsonDirect=true)
public String value;
}
}
Reported by PMD.
Line: 24
public static class Model {
public int id;
@JSONField(jsonDirect=true)
public String value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/JSONFieldSetterTest.java
3 issues
Line: 11
* Created by wenshao on 05/04/2017.
*/
public class JSONFieldSetterTest extends TestCase {
public void test_for_setter() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class);
assertEquals(123, model._id);
}
public static class Model {
Reported by PMD.
Line: 13
public class JSONFieldSetterTest extends TestCase {
public void test_for_setter() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class);
assertEquals(123, model._id);
}
public static class Model {
private int _id;
Reported by PMD.
Line: 17
}
public static class Model {
private int _id;
@JSONField(name = "id")
public void id(int id) {
this._id = id;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/TestPivateStaticClass.java
3 issues
Line: 10
public class TestPivateStaticClass extends TestCase {
public void test_inner() throws Exception {
VO vo = new VO();
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"value\":234}", text);
VO v1 = JSON.parseObject(text, VO.class);
Reported by PMD.
Line: 15
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"value\":234}", text);
VO v1 = JSON.parseObject(text, VO.class);
}
private static class VO {
private int value = 234;
Reported by PMD.
Line: 15
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"value\":234}", text);
VO v1 = JSON.parseObject(text, VO.class);
}
private static class VO {
private int value = 234;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/JSONDirectTest_private.java
3 issues
Line: 11
import junit.framework.TestCase;
public class JSONDirectTest_private extends TestCase {
public void test_feature() throws Exception {
Model model = new Model();
model.id = 1001;
model.value = "{}";
String json = JSON.toJSONString(model);
Reported by PMD.
Line: 22
}
private static class Model {
public int id;
@JSONField(jsonDirect=true)
public String value;
}
}
Reported by PMD.
Line: 24
private static class Model {
public int id;
@JSONField(jsonDirect=true)
public String value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/TestSpecial.java
3 issues
Line: 16
public void test_0 () throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "\n\r\t");
System.out.println(JSON.toJSONString(map, SerializerFeature.WriteTabAsSpecial));
}
}
Reported by PMD.
Line: 12
import com.alibaba.fastjson.serializer.SerializerFeature;
public class TestSpecial extends TestCase {
@SuppressWarnings("deprecation")
public void test_0 () throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "\n\r\t");
System.out.println(JSON.toJSONString(map, SerializerFeature.WriteTabAsSpecial));
}
Reported by PMD.
Line: 13
public class TestSpecial extends TestCase {
@SuppressWarnings("deprecation")
public void test_0 () throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "\n\r\t");
System.out.println(JSON.toJSONString(map, SerializerFeature.WriteTabAsSpecial));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/deny/DenyTest13.java
3 issues
Line: 11
* Created by wenshao on 29/01/2017.
*/
public class DenyTest13 extends TestCase {
public void test_deny() throws Exception {
String text = "{\"value\":{\"@type\":\"java.lang.Thread\"}}";
Exception error = null;
try {
JSON.parseObject(text, Model.class);
} catch (JSONException ex) {
Reported by PMD.
Line: 19
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
public static class Model {
public Object value;
}
Reported by PMD.
Line: 13
public class DenyTest13 extends TestCase {
public void test_deny() throws Exception {
String text = "{\"value\":{\"@type\":\"java.lang.Thread\"}}";
Exception error = null;
try {
JSON.parseObject(text, Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterClassLevelTest_private.java
3 issues
Line: 14
public class NameFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
Reported by PMD.
Line: 15
public class NameFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
config.addFilter(ModelB.class, //
Reported by PMD.
Line: 15
public class NameFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
config.addFilter(ModelB.class, //
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/TestSpecial4.java
3 issues
Line: 11
public class TestSpecial4 extends TestCase {
public void test_0() throws Exception {
StringBuilder buf = new StringBuilder();
buf.append('\r');
buf.append('\r');
for (int i = 0; i < 1000; ++i) {
buf.append('\u2028');
Reported by PMD.
Line: 13
public void test_0() throws Exception {
StringBuilder buf = new StringBuilder();
buf.append('\r');
buf.append('\r');
for (int i = 0; i < 1000; ++i) {
buf.append('\u2028');
}
Reported by PMD.
Line: 13
public void test_0() throws Exception {
StringBuilder buf = new StringBuilder();
buf.append('\r');
buf.append('\r');
for (int i = 0; i < 1000; ++i) {
buf.append('\u2028');
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterClassLevelTest.java
3 issues
Line: 14
public class NameFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
Reported by PMD.
Line: 15
public class NameFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
config.addFilter(ModelB.class, //
Reported by PMD.
Line: 15
public class NameFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PascalNameFilter());
config.addFilter(ModelB.class, //
Reported by PMD.