The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Issue183.java
3 issues
Line: 12
public class Issue183 extends TestCase {
public void test_issue_183() throws Exception {
A a = new A();
a.setName("xiao").setAge(21);
String result = JSON.toJSONString(a);
A newA = JSON.parseObject(result, A.class);
Assert.assertTrue(a.equals(newA));
Reported by PMD.
Line: 14
public void test_issue_183() throws Exception {
A a = new A();
a.setName("xiao").setAge(21);
String result = JSON.toJSONString(a);
A newA = JSON.parseObject(result, A.class);
Assert.assertTrue(a.equals(newA));
}
Reported by PMD.
Line: 53
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
A other = (A) obj;
if (age != other.age) return false;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue184.java
3 issues
Line: 18
VO vo = new VO();
vo.setDate(new Date());
String text = JSON.toJSONString(vo, filter);
System.out.println(text);
}
private static class VO {
private Date date;
Reported by PMD.
Line: 12
public class Issue184 extends TestCase {
public void test_for_issue() throws Exception {
SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
VO vo = new VO();
vo.setDate(new Date());
String text = JSON.toJSONString(vo, filter);
Reported by PMD.
Line: 12
public class Issue184 extends TestCase {
public void test_for_issue() throws Exception {
SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
VO vo = new VO();
vo.setDate(new Date());
String text = JSON.toJSONString(vo, filter);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_boolean_array.java
3 issues
Line: 28
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, boolean[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, boolean[]>>() {});
boolean[] values2 = (boolean[]) map2.get("val");
Assert.assertTrue(Arrays.equals(values2, values));
}
Reported by PMD.
Line: 17
public class Issue215_boolean_array extends TestCase {
public void test_for_issue() throws Exception {
boolean[] values = new boolean[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextInt() % 2 == 0;
}
Reported by PMD.
Line: 19
public class Issue215_boolean_array extends TestCase {
public void test_for_issue() throws Exception {
boolean[] values = new boolean[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextInt() % 2 == 0;
}
Map<String, boolean[]> map = new HashMap<String, boolean[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_char_array.java
3 issues
Line: 27
map.put("val", chars);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, char[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, char[]>>() {});
char[] chars2 = (char[]) map2.get("val");
Assert.assertArrayEquals(chars2, chars);
}
Reported by PMD.
Line: 16
public class Issue215_char_array extends TestCase {
public void test_for_issue() throws Exception {
char[] chars = new char[128];
Random random = new Random();
for (int i = 0; i < chars.length; ++i) {
chars[i] = (char) Math.abs((short) random.nextInt());
}
Reported by PMD.
Line: 18
public class Issue215_char_array extends TestCase {
public void test_for_issue() throws Exception {
char[] chars = new char[128];
Random random = new Random();
for (int i = 0; i < chars.length; ++i) {
chars[i] = (char) Math.abs((short) random.nextInt());
}
Map<String, char[]> map = new HashMap<String, char[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_double_array.java
3 issues
Line: 28
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, double[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, double[]>>() {});
double[] values2 = (double[]) map2.get("val");
Assert.assertTrue(Arrays.equals(values2, values));
}
Reported by PMD.
Line: 17
public class Issue215_double_array extends TestCase {
public void test_for_issue() throws Exception {
double[] values = new double[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextDouble();
}
Reported by PMD.
Line: 19
public class Issue215_double_array extends TestCase {
public void test_for_issue() throws Exception {
double[] values = new double[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextDouble();
}
Map<String, double[]> map = new HashMap<String, double[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_float_array.java
3 issues
Line: 28
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, float[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, float[]>>() {});
float[] values2 = (float[]) map2.get("val");
Assert.assertTrue(Arrays.equals(values2, values));
}
Reported by PMD.
Line: 17
public class Issue215_float_array extends TestCase {
public void test_for_issue() throws Exception {
float[] values = new float[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextFloat();
}
Reported by PMD.
Line: 19
public class Issue215_float_array extends TestCase {
public void test_for_issue() throws Exception {
float[] values = new float[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextFloat();
}
Map<String, float[]> map = new HashMap<String, float[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_int_array.java
3 issues
Line: 27
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, int[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, int[]>>() {});
int[] values2 = (int[]) map2.get("val");
Assert.assertArrayEquals(values2, values);
}
Reported by PMD.
Line: 16
public class Issue215_int_array extends TestCase {
public void test_for_issue() throws Exception {
int[] values = new int[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextInt();
}
Reported by PMD.
Line: 18
public class Issue215_int_array extends TestCase {
public void test_for_issue() throws Exception {
int[] values = new int[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextInt();
}
Map<String, int[]> map = new HashMap<String, int[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_long_array.java
3 issues
Line: 27
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, long[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, long[]>>() {});
long[] values2 = (long[]) map2.get("val");
Assert.assertArrayEquals(values2, values);
}
Reported by PMD.
Line: 16
public class Issue215_long_array extends TestCase {
public void test_for_issue() throws Exception {
long[] values = new long[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextLong();
}
Reported by PMD.
Line: 18
public class Issue215_long_array extends TestCase {
public void test_for_issue() throws Exception {
long[] values = new long[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = random.nextLong();
}
Map<String, long[]> map = new HashMap<String, long[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue215_short_array.java
3 issues
Line: 27
map.put("val", values);
String text = JSON.toJSONString(map);
System.out.println(text);
Map<String, short[]> map2 = JSON.parseObject(text, new TypeReference<HashMap<String, short[]>>() {});
short[] values2 = (short[]) map2.get("val");
Assert.assertArrayEquals(values2, values);
}
Reported by PMD.
Line: 16
public class Issue215_short_array extends TestCase {
public void test_for_issue() throws Exception {
short[] values = new short[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = (short) random.nextInt();
}
Reported by PMD.
Line: 18
public class Issue215_short_array extends TestCase {
public void test_for_issue() throws Exception {
short[] values = new short[128];
Random random = new Random();
for (int i = 0; i < values.length; ++i) {
values[i] = (short) random.nextInt();
}
Map<String, short[]> map = new HashMap<String, short[]>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue220.java
3 issues
Line: 11
public class Issue220 extends TestCase {
public void test_for_issue() throws Exception {
Attr attr = new Attr();
attr.jTType = 123;
attr.value = "xxxx";
attr.symbol = "yyyy";
Reported by PMD.
Line: 22
Assert.assertEquals("{\"jTType\":123,\"symbol\":\"yyyy\",\"value\":\"xxxx\"}", text);
}
public static class Attr {
private int jTType;
private String value;
private String symbol;
Reported by PMD.
Line: 24
public static class Attr {
private int jTType;
private String value;
private String symbol;
public int getjTType() {
return jTType;
Reported by PMD.