The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1100/Issue1146.java
2 issues
Line: 11
* Created by wenshao on 14/04/2017.
*/
public class Issue1146 extends TestCase {
public void test_for_issue() throws Exception {
String json = JSON.toJSONString(new Test());
assertEquals("{\"zzz\":true}", json);
}
@JSONType(ignores = {"xxx", "yyy"})
Reported by PMD.
Line: 13
public class Issue1146 extends TestCase {
public void test_for_issue() throws Exception {
String json = JSON.toJSONString(new Test());
assertEquals("{\"zzz\":true}", json);
}
@JSONType(ignores = {"xxx", "yyy"})
public static class Test {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/TypeUtilsTest_castToBigInteger.java
2 issues
Line: 15
/**
* NaN和正负无穷大的时候转BigInteger都会报转换异常,修改为返回null
*/
public void test_FloatNanInfinite() throws Exception {
// 正无穷大
Assert.assertNull(TypeUtils.castToBigInteger(1.0f / 0.0f));
// 负无穷大
Assert.assertNull(TypeUtils.castToBigInteger(-1.0f / 0.0f));
// NaN
Reported by PMD.
Line: 27
/**
* NaN和正负无穷大的时候转BigInteger都会报转换异常,修改为返回null
*/
public void test_DoubleNanInfinite() throws Exception {
// 正无穷大
Assert.assertNull(TypeUtils.castToBigInteger(1.0d / 0.0d));
// 负无穷大
Assert.assertNull(TypeUtils.castToBigInteger(-1.0d / 0.0d));
// NaN
Reported by PMD.
src/test/java/com/alibaba/json/ArrayRefTest2.java
2 issues
Line: 33
text = JSON.toJSONString(groups);
}
System.out.println(text);
Group[] groups = JSON.parseObject(text, new TypeReference<Group[]>() {});
Assert.assertEquals(6, groups.length);
Assert.assertNotNull(groups[0]);
Reported by PMD.
Line: 14
public class ArrayRefTest2 extends TestCase {
public void test_0() throws Exception {
String text;
{
List<Group> groups = new ArrayList<Group>();
Group g0 = new Group(0);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue987.java
2 issues
Line: 12
* Created by wenshao on 11/01/2017.
*/
public class Issue987 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"date\":\"2016-11-09T09:57:20.4Z\"}";
JSON.parseObject(text, Model.class);
}
public static class Model {
Reported by PMD.
Line: 12
* Created by wenshao on 11/01/2017.
*/
public class Issue987 extends TestCase {
public void test_for_issue() throws Exception {
String text = "{\"date\":\"2016-11-09T09:57:20.4Z\"}";
JSON.parseObject(text, Model.class);
}
public static class Model {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_Issue_519.java
2 issues
Line: 8
import junit.framework.TestCase;
public class Bug_for_Issue_519 extends TestCase {
public void test_issue() throws Exception {
String json = "{\"accomTypes\":[1],\"address\":\"\",\"airportIds\":[],\"airportrailwayIds\":[],\"areaIds\":[0,14,673],\"avgPrice\":0,\"avgScore\":3.8,\"baseScore\":-0.0035256863871981348,\"brandId\":23762,\"brandLogo\":\"\",\"brandName\":\"\",\"brandStory\":\"\",\"campaignsScore\":0,\"cates\":[392,20,79],\"cityIds\":[1],\"collegeIds\":[58],\"competeDiffPrice\":0,\"couponCount\":990,\"customAvgScore\":76.00890238508207,\"declineScore\":0,\"distance\":0,\"drLowestPrice\":289,\"festCanuse\":0,\"hasDR\":1,\"hasDRGroup\":0,\"hasGroup\":1,\"hasHR\":0,\"hasHRGroup\":0,\"hasInvoice\":0,\"hospitalIds\":[23599],\"hotelTypes\":[1,0,888],\"hrLowestPrice\":0,\"inBlackList\":0,\"innCates\":[],\"introduction\":\"\",\"landmarkScore\":0,\"lastModifyTime\":1457924599643,\"latitude\":39.997828,\"location\":\"39.997828,116.466004\",\"longitude\":116.466004,\"lowestPrice\":289,\"mapSmartPartScore\":69.74729610098822,\"markNumbers\":270,\"name\":\"布丁酒店(北京望京店)\",\"newDealScore\":0,\"phone\":\"010-64728973\",\"poiid\":52209391,\"prds\":[{\"areaIds\":[14,673],\"beginTime\":1436371200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\",\"20160405\",\"20160406\",\"20160407\",\"20160408\",\"20160409\"],\"did\":30513601,\"endTime\":1460131199,\"gid\":749878,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":59,\"soldQuantity\":535,\"value\":80},{\"areaIds\":[14,673],\"beginTime\":1438531200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\"],\"did\":31035361,\"endTime\":1459699199,\"gid\":858227,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":309,\"soldQuantity\":60,\"value\":319},{\"areaIds\":[14,673],\"beginTime\":1438531200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\"],\"did\":31035397,\"endTime\":1459699199,\"gid\":858226,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":289,\"soldQuantity\":157,\"value\":309}],\"railwayStationIds\":[],\"roomSizes\":[0,1,3,4],\"roomStates\":{},\"scenicSpotIds\":[5655],\"showFlag\":1,\"smartAvgBaseScore\":5.7669880413567585,\"smartPartScore\":58.21997185816042,\"smartSoldBaseScore\":1.6134262836027502,\"subwayLineIds\":[3,75],\"subwayStationIds\":[1490,1485,147],\"yfSourceTypes\":[],\"zlSourceType\":0}";
JSON.parse(json);
}
}
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Bug_for_Issue_519 extends TestCase {
public void test_issue() throws Exception {
String json = "{\"accomTypes\":[1],\"address\":\"\",\"airportIds\":[],\"airportrailwayIds\":[],\"areaIds\":[0,14,673],\"avgPrice\":0,\"avgScore\":3.8,\"baseScore\":-0.0035256863871981348,\"brandId\":23762,\"brandLogo\":\"\",\"brandName\":\"\",\"brandStory\":\"\",\"campaignsScore\":0,\"cates\":[392,20,79],\"cityIds\":[1],\"collegeIds\":[58],\"competeDiffPrice\":0,\"couponCount\":990,\"customAvgScore\":76.00890238508207,\"declineScore\":0,\"distance\":0,\"drLowestPrice\":289,\"festCanuse\":0,\"hasDR\":1,\"hasDRGroup\":0,\"hasGroup\":1,\"hasHR\":0,\"hasHRGroup\":0,\"hasInvoice\":0,\"hospitalIds\":[23599],\"hotelTypes\":[1,0,888],\"hrLowestPrice\":0,\"inBlackList\":0,\"innCates\":[],\"introduction\":\"\",\"landmarkScore\":0,\"lastModifyTime\":1457924599643,\"latitude\":39.997828,\"location\":\"39.997828,116.466004\",\"longitude\":116.466004,\"lowestPrice\":289,\"mapSmartPartScore\":69.74729610098822,\"markNumbers\":270,\"name\":\"布丁酒店(北京望京店)\",\"newDealScore\":0,\"phone\":\"010-64728973\",\"poiid\":52209391,\"prds\":[{\"areaIds\":[14,673],\"beginTime\":1436371200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\",\"20160405\",\"20160406\",\"20160407\",\"20160408\",\"20160409\"],\"did\":30513601,\"endTime\":1460131199,\"gid\":749878,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":59,\"soldQuantity\":535,\"value\":80},{\"areaIds\":[14,673],\"beginTime\":1438531200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\"],\"did\":31035361,\"endTime\":1459699199,\"gid\":858227,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":309,\"soldQuantity\":60,\"value\":319},{\"areaIds\":[14,673],\"beginTime\":1438531200,\"bookingType\":0,\"cates\":[0,1],\"cityIds\":[1],\"dateCantUse\":[\"20160313\",\"20160314\",\"20160315\",\"20160316\",\"20160317\",\"20160318\",\"20160319\",\"20160320\",\"20160321\",\"20160322\",\"20160323\",\"20160324\",\"20160325\",\"20160326\",\"20160327\",\"20160328\",\"20160329\",\"20160330\",\"20160331\",\"20160401\",\"20160402\",\"20160403\",\"20160404\"],\"did\":31035397,\"endTime\":1459699199,\"gid\":858226,\"hasCampaigns\":0,\"hasInvoice\":0,\"nobooking\":0,\"poiids\":[],\"price\":289,\"soldQuantity\":157,\"value\":309}],\"railwayStationIds\":[],\"roomSizes\":[0,1,3,4],\"roomStates\":{},\"scenicSpotIds\":[5655],\"showFlag\":1,\"smartAvgBaseScore\":5.7669880413567585,\"smartPartScore\":58.21997185816042,\"smartSoldBaseScore\":1.6134262836027502,\"subwayLineIds\":[3,75],\"subwayStationIds\":[1490,1485,147],\"yfSourceTypes\":[],\"zlSourceType\":0}";
JSON.parse(json);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_80108116.java
2 issues
Line: 17
import com.alibaba.fastjson.annotation.JSONField;
public class Bug_for_80108116 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_dateFormat() throws Exception {
Reported by PMD.
Line: 22
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_dateFormat() throws Exception {
VO vo = new VO();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
dateFormat.setTimeZone(JSON.defaultTimeZone);
vo.setDate(dateFormat.parse("2012-07-12"));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_jiangwei.java
2 issues
Line: 9
public class Bug_for_jiangwei extends TestCase {
public void test_0 () throws Exception {
String text = "['42-0','超級聯隊\\x28中\\x29','辛當斯','1.418',10,'11/18/2012 02:15',1,0,1,0,'',0,0,0,0]";
JSON.parse(text);
}
}
Reported by PMD.
Line: 9
public class Bug_for_jiangwei extends TestCase {
public void test_0 () throws Exception {
String text = "['42-0','超級聯隊\\x28中\\x29','辛當斯','1.418',10,'11/18/2012 02:15',1,0,1,0,'',0,0,0,0]";
JSON.parse(text);
}
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/geo/FeatureCollection.java
2 issues
Line: 14
@JSONType(typeName = "FeatureCollection", orders = {"type", "bbox", "coordinates"})
public class FeatureCollection
extends Geometry {
private List<Feature> features = new ArrayList<Feature>();
public FeatureCollection() {
super("FeatureCollection");
}
Reported by PMD.
Line: 14
@JSONType(typeName = "FeatureCollection", orders = {"type", "bbox", "coordinates"})
public class FeatureCollection
extends Geometry {
private List<Feature> features = new ArrayList<Feature>();
public FeatureCollection() {
super("FeatureCollection");
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_jsonobj_null.java
2 issues
Line: 10
public class Bug_for_jsonobj_null extends TestCase {
public void test_parseObjectNull() throws Exception {
JSON.parseObject("{\"data\":null}", VO.class);
}
public static class VO {
Reported by PMD.
Line: 10
public class Bug_for_jsonobj_null extends TestCase {
public void test_parseObjectNull() throws Exception {
JSON.parseObject("{\"data\":null}", VO.class);
}
public static class VO {
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectO1.java
2 issues
Line: 8
import java.util.List;
public class ObjectO1 implements Serializable {
int a;
int b;
Reported by PMD.
Line: 8
import java.util.List;
public class ObjectO1 implements Serializable {
int a;
int b;
Reported by PMD.