The following issues were found
src/test/java/com/alibaba/json/bvt/PublicFieldStringTest.java
2 issues
Line: 12
public static class VO {
public String id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = "x12345";
Reported by PMD.
Line: 15
public String id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = "x12345";
String str = JSON.toJSONString(vo);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_zengjie.java
2 issues
Line: 9
public class Bug_for_zengjie extends TestCase {
public void test_0 () throws Exception {
JSON.parse("{123:'abc','value':{123:'abc'}}");
}
}
Reported by PMD.
Line: 9
public class Bug_for_zengjie extends TestCase {
public void test_0 () throws Exception {
JSON.parse("{123:'abc','value':{123:'abc'}}");
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue995.java
2 issues
Line: 10
* Created by wenshao on 15/01/2017.
*/
public class Issue995 extends TestCase {
public void test_for_issue() throws Exception {
Person person = new Person();
JSONPath.set(person, "$.nose.name", "xxx");
}
Reported by PMD.
Line: 10
* Created by wenshao on 15/01/2017.
*/
public class Issue995 extends TestCase {
public void test_for_issue() throws Exception {
Person person = new Person();
JSONPath.set(person, "$.nose.name", "xxx");
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/ParameterizedTypeImpl.java
2 issues
Line: 13
private final Type ownerType;
private final Type rawType;
public ParameterizedTypeImpl(Type[] actualTypeArguments, Type ownerType, Type rawType){
this.actualTypeArguments = actualTypeArguments;
this.ownerType = ownerType;
this.rawType = rawType;
}
Reported by PMD.
Line: 20
}
public Type[] getActualTypeArguments() {
return actualTypeArguments;
}
public Type getOwnerType() {
return ownerType;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/CollectionEmptyMapTest.java
2 issues
Line: 15
import junit.framework.TestCase;
public class CollectionEmptyMapTest extends TestCase {
public void test_0() throws Exception {
Map<String, Object> map = Collections.emptyMap();
String text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
Assert.assertEquals("{\"@type\":\"java.util.Collections$EmptyMap\"}", text);
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.bug;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue923.java
2 issues
Line: 10
* Created by wenshao on 05/12/2016.
*/
public class Issue923 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"res\": \"00000\",\"version\": \"1.8.0\",\"des\":\"版本更新:\n" +
"1、邀请有礼:新功能,新玩法,快去体验吧~\n" +
"2、直播禁言:主播再也不用担心小黑粉啦~\n" +
"3、蓝鲸币充值:多种模块任你选,多充多送!\n" +
"4、优化排行榜:修复直播页面的排行榜,让大家第一时间看到付出的你~\n" +
Reported by PMD.
Line: 10
* Created by wenshao on 05/12/2016.
*/
public class Issue923 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"res\": \"00000\",\"version\": \"1.8.0\",\"des\":\"版本更新:\n" +
"1、邀请有礼:新功能,新玩法,快去体验吧~\n" +
"2、直播禁言:主播再也不用担心小黑粉啦~\n" +
"3、蓝鲸币充值:多种模块任你选,多充多送!\n" +
"4、优化排行榜:修复直播页面的排行榜,让大家第一时间看到付出的你~\n" +
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/springfox/SwaggerJsonSerializer.java
2 issues
Line: 26
Object object, Object fieldName, Type fieldType, int features) throws IOException {
SerializeWriter out = serializer.getWriter();
Json json = (Json) object;
String value = json.value();
out.write(value);
}
}
Reported by PMD.
Line: 27
SerializeWriter out = serializer.getWriter();
Json json = (Json) object;
String value = json.value();
out.write(value);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue101.java
2 issues
Line: 13
public class Issue101 extends TestCase {
public void test_for_issure() throws Exception {
VO vo = new VO();
vo.a = new Object();
vo.b = vo.a;
vo.c = vo.a;
Reported by PMD.
Line: 24
}
@JSONType(serialzeFeatures=SerializerFeature.DisableCircularReferenceDetect)
public static class VO {
private Object a;
private Object b;
private Object c;
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/spring/messaging/MappingFastJsonMessageConverter.java
2 issues
Line: 67
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
// parse byte[] or String payload to Java Object
Object payload = message.getPayload();
Object obj = null;
if (payload instanceof byte[]) {
obj = JSON.parseObject((byte[]) payload, fastJsonConfig.getCharset(), targetClass, fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(), JSON.DEFAULT_PARSER_FEATURE, fastJsonConfig.getFeatures());
} else if (payload instanceof String) {
obj = JSON.parseObject((String) payload, targetClass, fastJsonConfig.getParserConfig(),
Reported by PMD.
Line: 67
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
// parse byte[] or String payload to Java Object
Object payload = message.getPayload();
Object obj = null;
if (payload instanceof byte[]) {
obj = JSON.parseObject((byte[]) payload, fastJsonConfig.getCharset(), targetClass, fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(), JSON.DEFAULT_PARSER_FEATURE, fastJsonConfig.getFeatures());
} else if (payload instanceof String) {
obj = JSON.parseObject((String) payload, targetClass, fastJsonConfig.getParserConfig(),
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/spring/PropertyPreFilters.java
2 issues
Line: 60
}
public MySimplePropertyPreFilter addExcludes(String... filters){
for (int i = 0; i < filters.length; i++) {
this.getExcludes().add(filters[i]);
}
return this;
}
Reported by PMD.
Line: 67
}
public MySimplePropertyPreFilter addIncludes(String... filters){
for (int i = 0; i < filters.length; i++) {
this.getIncludes().add(filters[i]);
}
return this;
}
}
Reported by PMD.