The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/SpecialTest.java
10 issues
Line: 16
count++;
}
}
System.out.println(count);
}
final static long flags;
static {
long val = 0L;
Reported by PMD.
Line: 5
import com.alibaba.fastjson.serializer.SerializerFeature;
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
Reported by PMD.
Line: 7
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
Reported by PMD.
Line: 28
}
static boolean isSpecial(char ch) {
if (ch <= 31) {
return true;
}
if (ch > '\\') { // 92
return false;
Reported by PMD.
Line: 32
return true;
}
if (ch > '\\') { // 92
return false;
}
return ((1L << (ch - 31)) & flags) != 0;
}
Reported by PMD.
Line: 44
// return false;
// }
if (ch == ' ') { // 32
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
Reported by PMD.
Line: 48
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
}
if (ch > '#' // 35
&& ch != '\\' // 92
Reported by PMD.
Line: 58
return false;
}
if (ch <= 0x1F // 31
|| ch == '\\' // 92
|| ch == '"' // 34
) {
return true;
}
Reported by PMD.
Line: 9
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
Reported by PMD.
Line: 13
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
}
System.out.println(count);
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/support/retrofit/Retrofit2ConverterFactory.java
9 issues
Line: 55
}
public static Retrofit2ConverterFactory create(FastJsonConfig fastJsonConfig) {
if (fastJsonConfig == null) throw new NullPointerException("fastJsonConfig == null");
return new Retrofit2ConverterFactory(fastJsonConfig);
}
@Override
public Converter<ResponseBody, Object> responseBodyConverter(Type type, //
Reported by PMD.
Line: 32
@Deprecated
private static final Feature[] EMPTY_SERIALIZER_FEATURES = new Feature[0];
@Deprecated
private ParserConfig parserConfig = ParserConfig.getGlobalInstance();
@Deprecated
private int featureValues = JSON.DEFAULT_PARSER_FEATURE;
@Deprecated
private Feature[] features;
@Deprecated
Reported by PMD.
Line: 34
@Deprecated
private ParserConfig parserConfig = ParserConfig.getGlobalInstance();
@Deprecated
private int featureValues = JSON.DEFAULT_PARSER_FEATURE;
@Deprecated
private Feature[] features;
@Deprecated
private SerializeConfig serializeConfig;
@Deprecated
Reported by PMD.
Line: 213
}
final class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private Type type;
ResponseBodyConverter(Type type) {
this.type = type;
}
Reported by PMD.
Line: 213
}
final class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private Type type;
ResponseBodyConverter(Type type) {
this.type = type;
}
Reported by PMD.
Line: 229
, JSON.DEFAULT_PARSER_FEATURE
, fastJsonConfig.getFeatures()
);
} catch (Exception e) {
throw new IOException("JSON parse error: " + e.getMessage(), e);
} finally {
value.close();
}
}
Reported by PMD.
Line: 252
, fastJsonConfig.getSerializerFeatures()
);
return RequestBody.create(MEDIA_TYPE, content);
} catch (Exception e) {
throw new IOException("Could not write JSON: " + e.getMessage(), e);
}
}
}
}
Reported by PMD.
Line: 155
* @deprecated
*/
@Deprecated
public Retrofit2ConverterFactory setParserFeatures(Feature[] features) {
fastJsonConfig.setFeatures(features);
return this;
}
/**
Reported by PMD.
Line: 207
* @deprecated
*/
@Deprecated
public Retrofit2ConverterFactory setSerializerFeatures(SerializerFeature[] features) {
fastJsonConfig.setSerializerFeatures(features);
return this;
}
final class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/SerializeEnumAsJavaBeanTest_private.java
9 issues
Line: 12
* Created by wenshao on 08/01/2017.
*/
public class SerializeEnumAsJavaBeanTest_private extends TestCase {
public void test_serializeEnumAsJavaBean() throws Exception {
String text = JSON.toJSONString(OrderType.PayOrder);
assertEquals("{\"remark\":\"支付订单\",\"value\":1}", text);
}
public void test_field() throws Exception {
Reported by PMD.
Line: 14
public class SerializeEnumAsJavaBeanTest_private extends TestCase {
public void test_serializeEnumAsJavaBean() throws Exception {
String text = JSON.toJSONString(OrderType.PayOrder);
assertEquals("{\"remark\":\"支付订单\",\"value\":1}", text);
}
public void test_field() throws Exception {
Model model = new Model();
model.orderType = OrderType.SettleBill;
Reported by PMD.
Line: 17
assertEquals("{\"remark\":\"支付订单\",\"value\":1}", text);
}
public void test_field() throws Exception {
Model model = new Model();
model.orderType = OrderType.SettleBill;
String text = JSON.toJSONString(model);
assertEquals("{\"orderType\":{\"remark\":\"结算单\",\"value\":2}}", text);
}
Reported by PMD.
Line: 21
Model model = new Model();
model.orderType = OrderType.SettleBill;
String text = JSON.toJSONString(model);
assertEquals("{\"orderType\":{\"remark\":\"结算单\",\"value\":2}}", text);
}
public void test_field_2() throws Exception {
Model model = new Model();
model.orderType = OrderType.SettleBill;
Reported by PMD.
Line: 24
assertEquals("{\"orderType\":{\"remark\":\"结算单\",\"value\":2}}", text);
}
public void test_field_2() throws Exception {
Model model = new Model();
model.orderType = OrderType.SettleBill;
model.orderType1 = OrderType.SettleBill;
String text = JSON.toJSONString(model);
assertEquals("{\"orderType\":{\"remark\":\"结算单\",\"value\":2},\"orderType1\":{\"remark\":\"结算单\",\"value\":2}}", text);
Reported by PMD.
Line: 29
model.orderType = OrderType.SettleBill;
model.orderType1 = OrderType.SettleBill;
String text = JSON.toJSONString(model);
assertEquals("{\"orderType\":{\"remark\":\"结算单\",\"value\":2},\"orderType1\":{\"remark\":\"结算单\",\"value\":2}}", text);
}
@JSONType(serializeEnumAsJavaBean = true)
private static enum OrderType {
PayOrder(1, "支付订单"), //
Reported by PMD.
Line: 47
}
private static class Model {
public OrderType orderType;
public OrderType orderType1;
}
}
Reported by PMD.
Line: 48
private static class Model {
public OrderType orderType;
public OrderType orderType1;
}
}
Reported by PMD.
Line: 5
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.serializer.SerializeConfig;
import junit.framework.TestCase;
/**
* Created by wenshao on 08/01/2017.
*/
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1700/Issue1764_bean_biginteger_type.java
9 issues
Line: 12
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean_biginteger_type extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"-9007199254741992\"}"
Reported by PMD.
Line: 12
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean_biginteger_type extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"-9007199254741992\"}"
Reported by PMD.
Line: 13
public class Issue1764_bean_biginteger_type extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"-9007199254741992\"}"
, JSON.toJSONString(
Reported by PMD.
Line: 17
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"-9007199254741992\"}"
, JSON.toJSONString(
new Model(-9007199254741992L)));
assertEquals("{\"value\":9007199254740990}"
, JSON.toJSONString(
Reported by PMD.
Line: 21
, JSON.toJSONString(
new Model(-9007199254741992L)));
assertEquals("{\"value\":9007199254740990}"
, JSON.toJSONString(
new Model(9007199254740990L)));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
Reported by PMD.
Line: 25
, JSON.toJSONString(
new Model(9007199254740990L)));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
new Model(-9007199254740990L)));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
Reported by PMD.
Line: 29
, JSON.toJSONString(
new Model(-9007199254740990L)));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
new Model(100)));
assertEquals("{\"value\":-100}"
, JSON.toJSONString(
Reported by PMD.
Line: 33
, JSON.toJSONString(
new Model(100)));
assertEquals("{\"value\":-100}"
, JSON.toJSONString(
new Model(-100)));
}
Reported by PMD.
Line: 42
@JSONType(serialzeFeatures = BrowserCompatible)
public static class Model {
public BigInteger value;
public Model() {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/generic/GenericTest2.java
9 issues
Line: 22
Assert.assertNotNull(pageBean.getItems());
Assert.assertEquals(1, pageBean.getItems().size());
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
public static class ActiveBase extends BaseModel {
Reported by PMD.
Line: 13
import com.alibaba.fastjson.TypeReference;
public class GenericTest2 extends TestCase {
public void test_for_bingyang() throws Exception {
String text = "{\"count\":123,\"index\":7,\"items\":[{\"id\":234,\"latitude\":2.5,\"longtitude\":3.7}]}";
PageBean<ActiveBase> pageBean = JSON.parseObject(text, new TypeReference<PageBean<ActiveBase>>() {});
Assert.assertNotNull(pageBean);
Assert.assertEquals(123, pageBean.getCount());
Assert.assertEquals(7, pageBean.getIndex());
Reported by PMD.
Line: 20
Assert.assertEquals(123, pageBean.getCount());
Assert.assertEquals(7, pageBean.getIndex());
Assert.assertNotNull(pageBean.getItems());
Assert.assertEquals(1, pageBean.getItems().size());
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
Reported by PMD.
Line: 21
Assert.assertEquals(7, pageBean.getIndex());
Assert.assertNotNull(pageBean.getItems());
Assert.assertEquals(1, pageBean.getItems().size());
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
Reported by PMD.
Line: 22
Assert.assertNotNull(pageBean.getItems());
Assert.assertEquals(1, pageBean.getItems().size());
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
public static class ActiveBase extends BaseModel {
Reported by PMD.
Line: 23
Assert.assertEquals(1, pageBean.getItems().size());
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
public static class ActiveBase extends BaseModel {
private double latitude;
Reported by PMD.
Line: 24
ActiveBase active = pageBean.getItems().get(0);
Assert.assertEquals(new Integer(234), active.getId());
Assert.assertTrue(3.7D == active.getLongtitude());
Assert.assertTrue(2.5D == active.getLatitude());
}
public static class ActiveBase extends BaseModel {
private double latitude;
private double longtitude;
Reported by PMD.
Line: 27
Assert.assertTrue(2.5D == active.getLatitude());
}
public static class ActiveBase extends BaseModel {
private double latitude;
private double longtitude;
public double getLatitude() {
return latitude;
}
Reported by PMD.
Line: 56
}
}
public static class PageBean<T> {
private int count;
private int index;
private List<T> items;
public int getCount() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_Collection2.java
9 issues
Line: 22
A a = new A();
a.setList(Collections.singletonList(new B()));
String text = JSON.toJSONString(a, SerializerFeature.WriteClassName);
System.out.println(text);
Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Collection2$A\",\"list\":[{}]}",
text);
A a1 = (A) JSON.parse(text);
Reported by PMD.
Line: 14
import com.alibaba.fastjson.serializer.SerializerFeature;
public class WriteClassNameTest_Collection2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Collection2");
}
public void test_list() throws Exception {
A a = new A();
Reported by PMD.
Line: 15
public class WriteClassNameTest_Collection2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Collection2");
}
public void test_list() throws Exception {
A a = new A();
a.setList(Collections.singletonList(new B()));
Reported by PMD.
Line: 18
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Collection2");
}
public void test_list() throws Exception {
A a = new A();
a.setList(Collections.singletonList(new B()));
String text = JSON.toJSONString(a, SerializerFeature.WriteClassName);
System.out.println(text);
Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Collection2$A\",\"list\":[{}]}",
Reported by PMD.
Line: 28
A a1 = (A) JSON.parse(text);
Assert.assertEquals(1, a1.getList().size());
Assert.assertTrue(a1.getList().iterator().next() instanceof B);
}
public static class A {
Reported by PMD.
Line: 28
A a1 = (A) JSON.parse(text);
Assert.assertEquals(1, a1.getList().size());
Assert.assertTrue(a1.getList().iterator().next() instanceof B);
}
public static class A {
Reported by PMD.
Line: 29
A a1 = (A) JSON.parse(text);
Assert.assertEquals(1, a1.getList().size());
Assert.assertTrue(a1.getList().iterator().next() instanceof B);
}
public static class A {
private Collection<B> list;
Reported by PMD.
Line: 29
A a1 = (A) JSON.parse(text);
Assert.assertEquals(1, a1.getList().size());
Assert.assertTrue(a1.getList().iterator().next() instanceof B);
}
public static class A {
private Collection<B> list;
Reported by PMD.
Line: 29
A a1 = (A) JSON.parse(text);
Assert.assertEquals(1, a1.getList().size());
Assert.assertTrue(a1.getList().iterator().next() instanceof B);
}
public static class A {
private Collection<B> list;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1700/Issue1764_bean.java
9 issues
Line: 11
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"9007199254741990\"}"
Reported by PMD.
Line: 11
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
public class Issue1764_bean extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"9007199254741990\"}"
Reported by PMD.
Line: 12
public class Issue1764_bean extends TestCase {
public void test_for_issue() throws Exception {
assertEquals("{\"value\":\"9007199254741992\"}"
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"9007199254741990\"}"
, JSON.toJSONString(
Reported by PMD.
Line: 16
, JSON.toJSONString(
new Model(9007199254741992L)));
assertEquals("{\"value\":\"9007199254741990\"}"
, JSON.toJSONString(
new Model(9007199254741990L)));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
Reported by PMD.
Line: 20
, JSON.toJSONString(
new Model(9007199254741990L)));
assertEquals("{\"value\":100}"
, JSON.toJSONString(
new Model(100L)));
assertEquals("{\"value\":\"-9007199254741990\"}"
, JSON.toJSONString(
Reported by PMD.
Line: 24
, JSON.toJSONString(
new Model(100L)));
assertEquals("{\"value\":\"-9007199254741990\"}"
, JSON.toJSONString(
new Model(-9007199254741990L)));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
Reported by PMD.
Line: 28
, JSON.toJSONString(
new Model(-9007199254741990L)));
assertEquals("{\"value\":-9007199254740990}"
, JSON.toJSONString(
new Model(-9007199254740990L)));
}
Reported by PMD.
Line: 38
@JSONType(serialzeFeatures = BrowserCompatible)
public static class Model {
public long value;
public Model() {
}
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.issue_1700;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import junit.framework.TestCase;
import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue87_hashset.java
9 issues
Line: 18
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
Reported by PMD.
Line: 13
public class Issue87_hashset extends TestCase {
public void test_for_issue() throws Exception {
TestObject to = new TestObject();
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
Reported by PMD.
Line: 13
public class Issue87_hashset extends TestCase {
public void test_for_issue() throws Exception {
TestObject to = new TestObject();
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
Reported by PMD.
Line: 20
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
Reported by PMD.
Line: 25
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
public HashSet<String> getSet() {
return set;
}
Reported by PMD.
Line: 27
private HashSet<String> set = new HashSet<String>(0);
public HashSet<String> getSet() {
return set;
}
public void setSet(HashSet<String> set) {
this.set = set;
Reported by PMD.
Line: 31
return set;
}
public void setSet(HashSet<String> set) {
this.set = set;
}
public void add(String str) {
set.add(str);
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.bug;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
Reported by PMD.
Line: 20
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/MapRefTest1.java
9 issues
Line: 33
text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
}
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text);
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
Reported by PMD.
Line: 14
import com.alibaba.fastjson.serializer.SerializerFeature;
public class MapRefTest1 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest1");
}
public void test_0() throws Exception {
String text;
Reported by PMD.
Line: 15
public class MapRefTest1 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest1");
}
public void test_0() throws Exception {
String text;
{
Reported by PMD.
Line: 18
ParserConfig.global.addAccept("com.alibaba.json.bvt.MapRefTest1");
}
public void test_0() throws Exception {
String text;
{
Map<String, Object> map = new HashMap<String, Object>();
User user = new User();
Reported by PMD.
Line: 27
user.setId(123);
user.setName("wenshao");
map.put("u1", user);
map.put("u2", user);
text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
}
Reported by PMD.
Line: 28
user.setName("wenshao");
map.put("u1", user);
map.put("u2", user);
text = JSON.toJSONString(map, SerializerFeature.WriteClassName);
}
System.out.println(text);
Reported by PMD.
Line: 36
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text);
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
Reported by PMD.
Line: 36
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text);
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
Reported by PMD.
Line: 39
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1600/Issue_for_gaorui.java
9 issues
Line: 8
import junit.framework.TestCase;
public class Issue_for_gaorui extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Issue_for_gaorui extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
Reported by PMD.
Line: 14
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
public static class PromotionTermDetail {
/**
* 卡券Id
*/
private Long couponId;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.