The following issues were found
src/test/java/com/alibaba/json/bvt/atomic/AtomicIntegerArrayFieldTest.java
4 issues
Line: 14
public class AtomicIntegerArrayFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 28
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 38
Assert.assertEquals("{\"value\":[]}", text);
}
public void test_codec_null_2() throws Exception {
V0 v = JSON.parseObject("{\"value\":[1,2]}", V0.class);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/atomic/AtomicIntegerReadOnlyTest.java
4 issues
Line: 13
public class AtomicIntegerReadOnlyTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0(123);
String text = JSON.toJSONString(v);
Assert.assertEquals("{\"value\":123}", text);
Reported by PMD.
Line: 21
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue().intValue(), v.getValue().intValue());
}
public static class V0 {
private final AtomicInteger value;
Reported by PMD.
Line: 21
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue().intValue(), v.getValue().intValue());
}
public static class V0 {
private final AtomicInteger value;
Reported by PMD.
Line: 21
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue().intValue(), v.getValue().intValue());
}
public static class V0 {
private final AtomicInteger value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/atomic/AtomicLongArrayFieldTest.java
4 issues
Line: 14
public class AtomicLongArrayFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 28
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 38
Assert.assertEquals("{\"value\":[]}", text);
}
public void test_codec_null_2() throws Exception {
V0 v = JSON.parseObject("{\"value\":[1,2]}", V0.class);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/PointTest.java
4 issues
Line: 15
public class PointTest extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(3, 4);
String text = JSON.toJSONString(point);
Reported by PMD.
Line: 17
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(3, 4);
String text = JSON.toJSONString(point);
Point point2 = JSON.parseObject(text, Point.class);
Reported by PMD.
Line: 27
Assert.assertEquals(point, point2);
}
public void test_color_2() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(5, 6);
String text = JSON.toJSONString(point);
Reported by PMD.
Line: 29
public void test_color_2() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(5, 6);
String text = JSON.toJSONString(point);
Point point2 = JSON.parseObject(text, Point.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/PointTest2.java
4 issues
Line: 22
Point point = new Point(3, 4);
String text = JSON.toJSONString(point, SerializerFeature.WriteClassName);
System.out.println(text);
Object obj = JSON.parse(text);
Point point2 = (Point) obj;
Assert.assertEquals(point, point2);
Reported by PMD.
Line: 15
public class PointTest2 extends TestCase {
public void test_point() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(3, 4);
String text = JSON.toJSONString(point, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 17
public void test_point() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Point.class).getClass());
Point point = new Point(3, 4);
String text = JSON.toJSONString(point, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
Line: 33
Assert.assertEquals(point, point3);
}
public void test_point2() throws Exception {
JSON.parseObject("{}", Point.class);
JSON.parseArray("[null,null]", Point.class);
Assert.assertNull(JSON.parseObject("null", Point.class));
JSON.parseObject("{\"@type\":\"java.awt.Point\"}", Point.class);
JSON.parseObject("{\"value\":null}", VO.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/PublicFieldDoubleTest.java
4 issues
Line: 12
public static class VO {
public double id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = 12.34;
Reported by PMD.
Line: 15
public double id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = 12.34;
String str = JSON.toJSONString(vo);
Reported by PMD.
Line: 26
Assert.assertTrue(vo1.id == vo.id);
}
public void test_nan() throws Exception {
JSON.parseObject("{\"id\":NaN}", VO.class);
}
}
Reported by PMD.
Line: 26
Assert.assertTrue(vo1.id == vo.id);
}
public void test_nan() throws Exception {
JSON.parseObject("{\"id\":NaN}", VO.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FastJsonBigClassTest.java
4 issues
Line: 11
public class FastJsonBigClassTest extends TestCase {
public void test_big_class() {
BigClass bigObj = new BigClass();
String json = JSON.toJSONString(bigObj, SerializerFeature.IgnoreNonFieldGetter);
// assertThat(json, not(containsString("skipme")));
}
Reported by PMD.
Line: 11
public class FastJsonBigClassTest extends TestCase {
public void test_big_class() {
BigClass bigObj = new BigClass();
String json = JSON.toJSONString(bigObj, SerializerFeature.IgnoreNonFieldGetter);
// assertThat(json, not(containsString("skipme")));
}
Reported by PMD.
Line: 13
public void test_big_class() {
BigClass bigObj = new BigClass();
String json = JSON.toJSONString(bigObj, SerializerFeature.IgnoreNonFieldGetter);
// assertThat(json, not(containsString("skipme")));
}
}
Reported by PMD.
Line: 13
public void test_big_class() {
BigClass bigObj = new BigClass();
String json = JSON.toJSONString(bigObj, SerializerFeature.IgnoreNonFieldGetter);
// assertThat(json, not(containsString("skipme")));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/InetAddressFieldTest.java
4 issues
Line: 14
public class InetAddressFieldTest extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(InetAddress.getLocalHost());
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 24
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 27
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 37
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public static class User {
private InetAddress value;
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/Labels.java
4 issues
Line: 23
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class Labels {
private static class DefaultLabelFilter implements LabelFilter {
private String[] includes;
private String[] excludes;
Reported by PMD.
Line: 27
private static class DefaultLabelFilter implements LabelFilter {
private String[] includes;
private String[] excludes;
public DefaultLabelFilter(String[] includes, String[] excludes){
if (includes != null) {
this.includes = new String[includes.length];
Reported by PMD.
Line: 28
private static class DefaultLabelFilter implements LabelFilter {
private String[] includes;
private String[] excludes;
public DefaultLabelFilter(String[] includes, String[] excludes){
if (includes != null) {
this.includes = new String[includes.length];
System.arraycopy(includes, 0, this.includes, 0, includes.length);
Reported by PMD.
Line: 30
private String[] includes;
private String[] excludes;
public DefaultLabelFilter(String[] includes, String[] excludes){
if (includes != null) {
this.includes = new String[includes.length];
System.arraycopy(includes, 0, this.includes, 0, includes.length);
Arrays.sort(this.includes);
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/FloatCodec.java
4 issues
Line: 34
* @author wenshao[szujobs@hotmail.com]
*/
public class FloatCodec implements ObjectSerializer, ObjectDeserializer {
private NumberFormat decimalFormat;
public static FloatCodec instance = new FloatCodec();
public FloatCodec(){
Reported by PMD.
Line: 71
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
try {
return (T) deserialze(parser);
} catch (Exception ex) {
throw new JSONException("parseLong error, field : " + fieldName, ex);
}
}
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 80
public static <T> T deserialze(DefaultJSONParser parser) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
return (T) Float.valueOf(Float.parseFloat(val));
}
Reported by PMD.
Line: 86
return (T) Float.valueOf(Float.parseFloat(val));
}
if (lexer.token() == JSONToken.LITERAL_FLOAT) {
float val = lexer.floatValue();
lexer.nextToken(JSONToken.COMMA);
return (T) Float.valueOf(val);
}
Reported by PMD.