The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_Double2Tag.java
3 issues
Line: 8
import junit.framework.TestCase;
public class Bug_for_Double2Tag extends TestCase {
public void test_double() throws Exception {
Double2Tag tag = new Double2Tag();
String str = JSON.toJSONString(tag);
JSON.parseObject(str, Double2Tag.class);
}
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Bug_for_Double2Tag extends TestCase {
public void test_double() throws Exception {
Double2Tag tag = new Double2Tag();
String str = JSON.toJSONString(tag);
JSON.parseObject(str, Double2Tag.class);
}
Reported by PMD.
Line: 14
JSON.parseObject(str, Double2Tag.class);
}
public static class Double2Tag {
public String data_time;
public String data_id;
public String hour_id;
public String minute_id;
public String tag3_id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_Issue_534.java
3 issues
Line: 10
import junit.framework.TestCase;
public class Bug_for_Issue_534 extends TestCase {
public void test_for_issue() throws Exception {
Value value = new Value();
value.aLong = 2459838341588L;
String text = JSON.toJSONString(value);
Assert.assertEquals("{\"aLong\":2459838341588}", text);
Reported by PMD.
Line: 18
Assert.assertEquals("{\"aLong\":2459838341588}", text);
}
public void test_for_issue_1() throws Exception {
Long value = 2459838341588L;
String text = JSON.toJSONString(value);
Assert.assertEquals("2459838341588", text);
}
Reported by PMD.
Line: 27
class Value {
private Long aLong;
public Long getaLong() {
return aLong;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_JeryZeng.java
3 issues
Line: 10
public class Bug_for_JeryZeng extends TestCase {
public void test_0() throws Exception {
System.out.println(JSON.parseObject("{123:123,124:true,\"value\":{123:\"abc\"}}"));
}
}
Reported by PMD.
Line: 9
public class Bug_for_JeryZeng extends TestCase {
public void test_0() throws Exception {
System.out.println(JSON.parseObject("{123:123,124:true,\"value\":{123:\"abc\"}}"));
}
}
Reported by PMD.
Line: 9
public class Bug_for_JeryZeng extends TestCase {
public void test_0() throws Exception {
System.out.println(JSON.parseObject("{123:123,124:true,\"value\":{123:\"abc\"}}"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_array.java
3 issues
Line: 40
public B (int id, String name) {
setId(id);
setName(name);
}
public String getName() {
return name;
}
Reported by PMD.
Line: 14
A[] array = new A[] { new B(123, "xxx") };
String text = JSON.toJSONString(array);
System.out.println(text);
Assert.assertEquals("[{\"id\":123,\"name\":\"xxx\"}]", text);
}
public static class A {
private int id;
Reported by PMD.
Line: 10
import com.alibaba.fastjson.JSON;
public class Bug_for_array extends TestCase {
public void test_array() throws Exception {
A[] array = new A[] { new B(123, "xxx") };
String text = JSON.toJSONString(array);
System.out.println(text);
Assert.assertEquals("[{\"id\":123,\"name\":\"xxx\"}]", text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_chengchao_1.java
3 issues
Line: 9
import junit.framework.TestCase;
public class Bug_for_chengchao_1 extends TestCase {
public void test_0() throws Exception {
ParserConfig config = new ParserConfig();
config.setAutoTypeSupport(true);
String str = "{\"@type\":\"test.MapDone\",\"data\":{\"@type\":\"test.HiluxDataByOpsmeta\",\"attends\":{\"@type\":\"java.util.HashMap\",\"center.na61\":2},\"datasByOpsmeta\":{\"@type\":\"java.util.HashMap\",{\"@type\":\"test.AppInst\",\"app\":\"wdkhummer\",\"appGroup\":\"wdkhummerhost\",\"env\":\"PUBLISH\",\"hostname\":\"wdkhummer011009059229.na61\",\"idc\":\"na61\",\"ip\":\"11.9.59.229\",\"online\":true}:{\"@type\":\"test.MiddlewareDimData\",\"attends\":{\"@type\":\"java.util.HashMap\"},\"expectAttends\":{\"@type\":\"java.util.HashMap\"},\"logLineCount\":0,\"values\":{}}}}}";
JSON.parse(str, config, JSON.DEFAULT_PARSER_FEATURE);
}
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Bug_for_chengchao_1 extends TestCase {
public void test_0() throws Exception {
ParserConfig config = new ParserConfig();
config.setAutoTypeSupport(true);
String str = "{\"@type\":\"test.MapDone\",\"data\":{\"@type\":\"test.HiluxDataByOpsmeta\",\"attends\":{\"@type\":\"java.util.HashMap\",\"center.na61\":2},\"datasByOpsmeta\":{\"@type\":\"java.util.HashMap\",{\"@type\":\"test.AppInst\",\"app\":\"wdkhummer\",\"appGroup\":\"wdkhummerhost\",\"env\":\"PUBLISH\",\"hostname\":\"wdkhummer011009059229.na61\",\"idc\":\"na61\",\"ip\":\"11.9.59.229\",\"online\":true}:{\"@type\":\"test.MiddlewareDimData\",\"attends\":{\"@type\":\"java.util.HashMap\"},\"expectAttends\":{\"@type\":\"java.util.HashMap\"},\"logLineCount\":0,\"values\":{}}}}}";
JSON.parse(str, config, JSON.DEFAULT_PARSER_FEATURE);
}
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.bug;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.ParserConfig;
import junit.framework.TestCase;
public class Bug_for_chengchao_1 extends TestCase {
public void test_0() throws Exception {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_divde_zero.java
3 issues
Line: 12
public void test_divideZero() throws Exception {
Double d = 1.0D / 0.0D;
String text = JSON.toJSONString(d);
System.out.println(text);
}
}
Reported by PMD.
Line: 9
public class Bug_for_divde_zero extends TestCase {
public void test_divideZero() throws Exception {
Double d = 1.0D / 0.0D;
String text = JSON.toJSONString(d);
System.out.println(text);
}
}
Reported by PMD.
Line: 9
public class Bug_for_divde_zero extends TestCase {
public void test_divideZero() throws Exception {
Double d = 1.0D / 0.0D;
String text = JSON.toJSONString(d);
System.out.println(text);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_field.java
3 issues
Line: 17
String text = JSON.toJSONString(vo);
System.out.println(text);
}
public static class VO {
@JSONField(name = "ID", serialzeFeatures={SerializerFeature.WriteClassName})
Reported by PMD.
Line: 11
public class Bug_for_field extends TestCase {
public void test_annotation() throws Exception {
VO vo = new VO();
vo.setId(123);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 11
public class Bug_for_field extends TestCase {
public void test_annotation() throws Exception {
VO vo = new VO();
vo.setId(123);
String text = JSON.toJSONString(vo);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_huangchun.java
3 issues
Line: 14
JSONObject json = new JSONObject();
json.put("info", "<a href=\"http://www.baidu.com\"> 问题链接 </a> ");
String text = JSON.toJSONString(json);
System.out.println(text);
}
}
Reported by PMD.
Line: 10
public class Bug_for_huangchun extends TestCase {
public void test_serialize_url() throws Exception {
JSONObject json = new JSONObject();
json.put("info", "<a href=\"http://www.baidu.com\"> 问题链接 </a> ");
String text = JSON.toJSONString(json);
System.out.println(text);
}
Reported by PMD.
Line: 10
public class Bug_for_huangchun extends TestCase {
public void test_serialize_url() throws Exception {
JSONObject json = new JSONObject();
json.put("info", "<a href=\"http://www.baidu.com\"> 问题链接 </a> ");
String text = JSON.toJSONString(json);
System.out.println(text);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_229.java
3 issues
Line: 11
public class Bug_for_issue_229 extends TestCase {
public void test_for_issue() throws Exception {
Assert.assertTrue(JSON.parseObject("{\"value\":1}", VO.class).value);
Assert.assertFalse(JSON.parseObject("{\"value\":0}", VO.class).value);
}
public static class VO {
Reported by PMD.
Line: 12
public class Bug_for_issue_229 extends TestCase {
public void test_for_issue() throws Exception {
Assert.assertTrue(JSON.parseObject("{\"value\":1}", VO.class).value);
Assert.assertFalse(JSON.parseObject("{\"value\":0}", VO.class).value);
}
public static class VO {
Reported by PMD.
Line: 13
public void test_for_issue() throws Exception {
Assert.assertTrue(JSON.parseObject("{\"value\":1}", VO.class).value);
Assert.assertFalse(JSON.parseObject("{\"value\":0}", VO.class).value);
}
public static class VO {
private boolean value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_316.java
3 issues
Line: 14
import junit.framework.TestCase;
public class Bug_for_issue_316 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_issue() throws Exception {
Reported by PMD.
Line: 19
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_issue() throws Exception {
Model model = new Model();
model.value = new Timestamp(1460563200000L);
Assert.assertEquals("{\"value\":1460563200000}", JSON.toJSONString(model));
}
Reported by PMD.
Line: 26
}
public static class Model {
public java.sql.Timestamp value;
}
}
Reported by PMD.