The following issues were found
src/test/java/com/alibaba/json/bvt/awt/ColorTest.java
3 issues
Line: 21
Color color = Color.RED;
String text = JSON.toJSONString(color);
System.out.println(text);
Color color2 = JSON.parseObject(text, Color.class);
Assert.assertEquals(color, color2);
}
Reported by PMD.
Line: 15
public class ColorTest extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());
Color color = Color.RED;
String text = JSON.toJSONString(color);
Reported by PMD.
Line: 17
public class ColorTest extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());
Color color = Color.RED;
String text = JSON.toJSONString(color);
System.out.println(text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/awt/ColorTest2.java
3 issues
Line: 22
Color color = Color.RED;
String text = JSON.toJSONString(color, SerializerFeature.WriteClassName);
System.out.println(text);
Color color2 = (Color) JSON.parse(text);
Assert.assertEquals(color, color2);
}
Reported by PMD.
Line: 16
public class ColorTest2 extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());
Color color = Color.RED;
String text = JSON.toJSONString(color, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 18
public class ColorTest2 extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());
Color color = Color.RED;
String text = JSON.toJSONString(color, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/awt/FontTest.java
3 issues
Line: 12
public class FontTest extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font);
Font font2 = JSON.parseObject(text, Font.class);
Reported by PMD.
Line: 13
public class FontTest extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font);
Font font2 = JSON.parseObject(text, Font.class);
Reported by PMD.
Line: 13
public class FontTest extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font);
Font font2 = JSON.parseObject(text, Font.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/awt/FontTest2.java
3 issues
Line: 13
public class FontTest2 extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font, SerializerFeature.WriteClassName);
Font font2 = (Font) JSON.parse(text);
Reported by PMD.
Line: 14
public class FontTest2 extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font, SerializerFeature.WriteClassName);
Font font2 = (Font) JSON.parse(text);
Reported by PMD.
Line: 14
public class FontTest2 extends TestCase {
public void test_color() throws Exception {
Font[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font font : fonts) {
String text = JSON.toJSONString(font, SerializerFeature.WriteClassName);
Font font2 = (Font) JSON.parse(text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue952.java
3 issues
Line: 14
* Created by wenshao on 19/12/2016.
*/
public class Issue952 extends TestCase {
public void test_for_issue() throws Exception {
final String pattern = "yyyy-MM-dd'T'HH:mm:ss";
LocalDateTime dateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
Reported by PMD.
Line: 22
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
String text = JSON.toJSONString(dateTime, SerializerFeature.UseISO8601DateFormat);
assertEquals(JSON.toJSONString(formatter.format(dateTime)), text);
}
}
Reported by PMD.
Line: 22
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
String text = JSON.toJSONString(dateTime, SerializerFeature.UseISO8601DateFormat);
assertEquals(JSON.toJSONString(formatter.format(dateTime)), text);
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectS1.java
3 issues
Line: 10
import java.util.List;
public class ObjectS1 {
private int a;
private int b;
Reported by PMD.
Line: 18
private int b;
private int c = 0;
private int d;
Reported by PMD.
Line: 30
private List<ObjectS1_A> f;
private boolean g = false;
private List<ObjectK> h;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/basicType/LongTest.java
3 issues
Line: 14
import junit.framework.TestCase;
public class LongTest extends TestCase {
public void test_array() throws Exception {
long[] values = new long[] {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
String text = JSON.toJSONString(values);
long[] values_2 = JSON.parseObject(text, long[].class);
Assert.assertEquals(values_2.length, values.length);
for (int i = 0; i < values.length; ++i) {
Reported by PMD.
Line: 24
}
}
public void test_map() throws Exception {
long[] values = new long[] {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
Map<String, Object> map = new HashMap<String, Object>();
for (int i = 0; i < values.length; ++i) {
map.put(Long.toString(i), values[i]);
}
Reported by PMD.
Line: 32
}
String text = JSON.toJSONString(map);
JSONObject obj = JSON.parseObject(text);
for (int i = 0; i < values.length; ++i) {
Assert.assertEquals(values[i], ((Number) obj.get(Long.toString(i))).longValue());
}
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectP1.java
3 issues
Line: 9
import java.util.List;
public class ObjectP1 {
private int a;
private int b;
Reported by PMD.
Line: 19
private List<Long> d;
private int e = 0;
private int f = 0;
private List<ObjectP1_A> g;
Reported by PMD.
Line: 21
private int e = 0;
private int f = 0;
private List<ObjectP1_A> g;
private List<Integer> h;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug11.java
3 issues
Line: 12
public void test_bug11() throws Exception {
String text = "[{KH:\"(2010-2011-2)-13105-13039-1\", JC:\"1\"}] ";
JSON.parse(text);
System.out.println(text);
}
}
Reported by PMD.
Line: 9
public class Bug11 extends TestCase {
public void test_bug11() throws Exception {
String text = "[{KH:\"(2010-2011-2)-13105-13039-1\", JC:\"1\"}] ";
JSON.parse(text);
System.out.println(text);
}
}
Reported by PMD.
Line: 9
public class Bug11 extends TestCase {
public void test_bug11() throws Exception {
String text = "[{KH:\"(2010-2011-2)-13105-13039-1\", JC:\"1\"}] ";
JSON.parse(text);
System.out.println(text);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_8.java
3 issues
Line: 12
public class Bug_8 extends TestCase {
public void test_0() throws Exception {
List<String> typeList = JSONArray.parseArray("['java.lang.Class','java.lang.Long']", String.class);
Assert.assertEquals("java.lang.Class", typeList.get(0));
Assert.assertEquals("java.lang.Long", typeList.get(1));
}
}
Reported by PMD.
Line: 14
public void test_0() throws Exception {
List<String> typeList = JSONArray.parseArray("['java.lang.Class','java.lang.Long']", String.class);
Assert.assertEquals("java.lang.Class", typeList.get(0));
Assert.assertEquals("java.lang.Long", typeList.get(1));
}
}
Reported by PMD.
Line: 15
public void test_0() throws Exception {
List<String> typeList = JSONArray.parseArray("['java.lang.Class','java.lang.Long']", String.class);
Assert.assertEquals("java.lang.Class", typeList.get(0));
Assert.assertEquals("java.lang.Long", typeList.get(1));
}
}
Reported by PMD.