The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Issue199.java
2 issues
Line: 11
public class Issue199 extends TestCase {
public void test_for_issue() throws Exception {
ConsumeStatus vo = new ConsumeStatus();
vo.pullRT = 101.01D;
vo.pullTPS = 102.01D;
vo.consumeRT = 103.01D;
vo.consumeOKTPS = 104.01D;
Reported by PMD.
Line: 28
Assert.assertTrue(vo.consumeFailedTPS == vo1.consumeFailedTPS);
}
public static class ConsumeStatus {
private double pullRT;
private double pullTPS;
private double consumeRT;
private double consumeOKTPS;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue204.java
2 issues
Line: 11
public class Issue204 extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
SerializeFilter filter = null;
JSON.toJSONString(vo, SerializeConfig.getGlobalInstance(), filter);
JSON.toJSONString(vo, SerializeConfig.getGlobalInstance(), new SerializeFilter[0]);
Reported by PMD.
Line: 11
public class Issue204 extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
SerializeFilter filter = null;
JSON.toJSONString(vo, SerializeConfig.getGlobalInstance(), filter);
JSON.toJSONString(vo, SerializeConfig.getGlobalInstance(), new SerializeFilter[0]);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215.java
2 issues
Line: 24
map.put("val", bytes);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, byte[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, byte[]>>() {});
byte[] bytes2 = (byte[]) map2.get("val");
Assert.assertArrayEquals(bytes2, bytes);
}
Reported by PMD.
Line: 16
public class Issue215 extends TestCase {
public void test_for_issue() throws Exception {
byte[] bytes = new byte[128];
new Random().nextBytes(bytes);
Map<String, byte[]> map = new HashMap<String, byte[]>();
map.put("val", bytes);
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/DoubleSerializer.java
2 issues
Line: 29
public final static DoubleSerializer instance = new DoubleSerializer();
private DecimalFormat decimalFormat = null;
public DoubleSerializer(){
}
Reported by PMD.
Line: 29
public final static DoubleSerializer instance = new DoubleSerializer();
private DecimalFormat decimalFormat = null;
public DoubleSerializer(){
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONObjectTest_hashCode.java
2 issues
Line: 11
public class JSONObjectTest_hashCode extends TestCase {
public void test_hashCode() throws Exception {
Assert.assertEquals(new JSONObject().hashCode(), new JSONObject().hashCode());
}
public void test_hashCode_1() throws Exception {
Assert.assertEquals(JSON.parseObject("{a:1}"), JSON.parseObject("{'a':1}"));
Reported by PMD.
Line: 15
Assert.assertEquals(new JSONObject().hashCode(), new JSONObject().hashCode());
}
public void test_hashCode_1() throws Exception {
Assert.assertEquals(JSON.parseObject("{a:1}"), JSON.parseObject("{'a':1}"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/PublicFieldFloatTest.java
2 issues
Line: 12
public static class VO {
public float id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = 123.4F;
Reported by PMD.
Line: 15
public float id;
}
public void test_codec() throws Exception {
VO vo = new VO();
vo.id = 123.4F;
String str = JSON.toJSONString(vo);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSON_toJavaObject_test.java
2 issues
Line: 13
public class JSON_toJavaObject_test extends TestCase {
public void test_0() throws Exception {
A a = (A) JSON.toJavaObject(new JSONObject(), A.class);
Assert.assertNotNull(a);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 18
Assert.assertNotNull(a);
}
public void test_1() throws Exception {
A a = (A) TypeUtils.cast(new B(), A.class, ParserConfig.getGlobalInstance());
Assert.assertNotNull(a);
}
public static class A {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/OverriadeTest.java
2 issues
Line: 9
public class OverriadeTest extends TestCase {
public void test_override() throws Exception {
JSON.parseObject("{\"id\":123}", B.class);
}
public static class A {
Reported by PMD.
Line: 9
public class OverriadeTest extends TestCase {
public void test_override() throws Exception {
JSON.parseObject("{\"id\":123}", B.class);
}
public static class A {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONArrayTest_hashCode.java
2 issues
Line: 11
public class JSONArrayTest_hashCode extends TestCase {
public void test_hashCode() throws Exception {
Assert.assertEquals(new JSONArray().hashCode(), new JSONArray().hashCode());
}
public void test_hashCode_1() throws Exception {
Assert.assertEquals(JSON.parseArray("[]"), JSON.parseArray("[]"));
Reported by PMD.
Line: 15
Assert.assertEquals(new JSONArray().hashCode(), new JSONArray().hashCode());
}
public void test_hashCode_1() throws Exception {
Assert.assertEquals(JSON.parseArray("[]"), JSON.parseArray("[]"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/ListFieldTest2.java
2 issues
Line: 14
import com.alibaba.fastjson.serializer.SerializerFeature;
public class ListFieldTest2 extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 28
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
private static class V0 {
private List<Object> value;
Reported by PMD.