The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555_setter.java
4 issues
Line: 12
public class Bug_for_issue_555_setter extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class);
}
public static class A {
Reported by PMD.
Line: 12
public class Bug_for_issue_555_setter extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class);
}
public static class A {
Reported by PMD.
Line: 38
public static class Spec {
private int id;
public Spec(int id){
this.id = id;
}
}
Reported by PMD.
Line: 38
public static class Spec {
private int id;
public Spec(int id){
this.id = id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_555.java
4 issues
Line: 12
public class Bug_for_issue_555 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class);
}
public static class A {
Reported by PMD.
Line: 12
public class Bug_for_issue_555 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("{\"list\":[{\"spec\":{}}]}", A.class);
}
public static class A {
Reported by PMD.
Line: 28
}
public static class Spec {
private int id;
public Spec(int id) {
this.id = id;
}
}
Reported by PMD.
Line: 28
}
public static class Spec {
private int id;
public Spec(int id) {
this.id = id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/ModuleTest.java
4 issues
Line: 12
import junit.framework.TestCase;
public class ModuleTest extends TestCase {
public void test_for_module() throws Exception {
ParserConfig config = new ParserConfig();
config.register(new MyModuel2());
config.register(new MyModuel());
assertSame(MiscCodec.instance, config.getDeserializer(A.class));
Reported by PMD.
Line: 17
config.register(new MyModuel2());
config.register(new MyModuel());
assertSame(MiscCodec.instance, config.getDeserializer(A.class));
}
public void test_for_module_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.register(new MyModuel2());
Reported by PMD.
Line: 20
assertSame(MiscCodec.instance, config.getDeserializer(A.class));
}
public void test_for_module_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.register(new MyModuel2());
config.register(new MyModuel());
assertSame(MiscCodec.instance, config.getObjectWriter(A.class));
Reported by PMD.
Line: 25
config.register(new MyModuel2());
config.register(new MyModuel());
assertSame(MiscCodec.instance, config.getObjectWriter(A.class));
}
public static class A {
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectH.java
4 issues
Line: 9
import java.util.List;
public class ObjectH {
private int a;
private long b;
Reported by PMD.
Line: 9
import java.util.List;
public class ObjectH {
private int a;
private long b;
Reported by PMD.
Line: 52
private int o;
private boolean p = false;
private boolean q = false;
public int getA() {
Reported by PMD.
Line: 55
private boolean p = false;
private boolean q = false;
public int getA() {
return a;
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectI1.java
4 issues
Line: 9
import java.util.List;
public class ObjectI1 {
private int a = 0;
private long b = 0;
Reported by PMD.
Line: 11
public class ObjectI1 {
private int a = 0;
private long b = 0;
private int c = 0;
Reported by PMD.
Line: 13
private int a = 0;
private long b = 0;
private int c = 0;
Reported by PMD.
Line: 16
private long b = 0;
private int c = 0;
private List<Integer> d;
public int getA() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_435.java
4 issues
Line: 9
public class Bug_for_issue_435 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", Model.class);
}
public void test_for_issue_Float() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", ModelFloat.class);
Reported by PMD.
Line: 9
public class Bug_for_issue_435 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", Model.class);
}
public void test_for_issue_Float() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", ModelFloat.class);
Reported by PMD.
Line: 13
JSON.parseObject("\ufeff{\"value\":null}", Model.class);
}
public void test_for_issue_Float() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", ModelFloat.class);
}
public static class Model {
public float value;
Reported by PMD.
Line: 13
JSON.parseObject("\ufeff{\"value\":null}", Model.class);
}
public void test_for_issue_Float() throws Exception {
JSON.parseObject("\ufeff{\"value\":null}", ModelFloat.class);
}
public static class Model {
public float value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_O_I_See_you.java
4 issues
Line: 17
String s = JSON.toJSONString(arr);
Object[] ar = JSON.parseObject(s, Object[].class);
System.out.println();
}
}
Reported by PMD.
Line: 9
public class Bug_for_O_I_See_you extends TestCase {
public void test_bug() throws Exception {
Object[] arra = { "aa", "bb" };
Object[] arr = { "sssss", arra };
String s = JSON.toJSONString(arr);
Reported by PMD.
Line: 9
public class Bug_for_O_I_See_you extends TestCase {
public void test_bug() throws Exception {
Object[] arra = { "aa", "bb" };
Object[] arr = { "sssss", arra };
String s = JSON.toJSONString(arr);
Reported by PMD.
Line: 16
String s = JSON.toJSONString(arr);
Object[] ar = JSON.parseObject(s, Object[].class);
System.out.println();
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_jinghui70.java
4 issues
Line: 10
public class Bug_for_jinghui70 extends TestCase {
public static abstract class IdObject<I> {
private I id;
public I getId() {
return id;
Reported by PMD.
Line: 27
}
public void test_generic() throws Exception {
String str = "{\"id\":0}";
Child child = JSON.parseObject(str, Child.class);
Assert.assertEquals(Long.class, child.getId().getClass());
}
Reported by PMD.
Line: 31
String str = "{\"id\":0}";
Child child = JSON.parseObject(str, Child.class);
Assert.assertEquals(Long.class, child.getId().getClass());
}
}
Reported by PMD.
Line: 31
String str = "{\"id\":0}";
Child child = JSON.parseObject(str, Child.class);
Assert.assertEquals(Long.class, child.getId().getClass());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_SpitFire_2.java
4 issues
Line: 13
public void test_for_SpringFire() {
Generic<String> q = new Generic<String>();
String text = JSON.toJSONString(q, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, Generic.class);
}
public static class Generic<T> {
Reported by PMD.
Line: 10
public class Bug_for_SpitFire_2 extends TestCase {
public void test_for_SpringFire() {
Generic<String> q = new Generic<String>();
String text = JSON.toJSONString(q, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, Generic.class);
}
Reported by PMD.
Line: 10
public class Bug_for_SpitFire_2 extends TestCase {
public void test_for_SpringFire() {
Generic<String> q = new Generic<String>();
String text = JSON.toJSONString(q, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, Generic.class);
}
Reported by PMD.
Line: 17
JSON.parseObject(text, Generic.class);
}
public static class Generic<T> {
String header;
T payload;
public String getHeader() {
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/spring/FastJsonpResponseBodyAdvice.java
4 issues
Line: 37
* Pattern for validating jsonp callback parameter values.
*/
private static final Pattern CALLBACK_PARAM_PATTERN = Pattern.compile("[0-9A-Za-z_\\.]*");
private final String[] jsonpQueryParamNames;
/**
* Default JSONP query param names: callback/jsonp
*/
public static final String[] DEFAULT_JSONP_QUERY_PARAM_NAMES = {"callback", "jsonp"};
Reported by PMD.
Line: 47
this.jsonpQueryParamNames = DEFAULT_JSONP_QUERY_PARAM_NAMES;
}
public FastJsonpResponseBodyAdvice(String... queryParamNames) {
Assert.isTrue(!ObjectUtils.isEmpty(queryParamNames), "At least one query param name is required");
this.jsonpQueryParamNames = queryParamNames;
}
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
Reported by PMD.
Line: 100
* @param value the query param value, never {@code null}
*/
protected boolean isValidJsonpQueryParam(String value) {
return CALLBACK_PARAM_PATTERN.matcher(value).matches();
}
/**
* Return the content type to set the response to.
* This implementation always returns "application/javascript".
Reported by PMD.
Line: 77
*/
public void beforeBodyWriteInternal(MappingFastJsonValue bodyContainer, MediaType contentType,
MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) {
HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
for (String name : this.jsonpQueryParamNames) {
String value = servletRequest.getParameter(name);
if (value != null) {
if (!isValidJsonpQueryParam(value)) {
continue;
Reported by PMD.