The following issues were found
src/test/java/com/alibaba/json/bvt/support/spring/mock/testcase/FastJsonHttpMessageConverterCase2Test.java
22 issues
Line: 37
@WebAppConfiguration
@ContextConfiguration
public class FastJsonHttpMessageConverterCase2Test {
private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
Reported by PMD.
Line: 40
private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
@EnableWebMvc
Reported by PMD.
Line: 42
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
@EnableWebMvc
@Configuration
protected static class Config extends WebMvcConfigurerAdapter {
Reported by PMD.
Line: 74
}
@Test
public void isInjectComponent() {
wac.getBean(JSONPResponseBodyAdvice.class);
wac.getBean(FastJsonViewResponseBodyAdvice.class);
}
@Test
Reported by PMD.
Line: 80
}
@Test
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
Reported by PMD.
Line: 81
@Test
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
@Test
Reported by PMD.
Line: 81
@Test
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
@Test
Reported by PMD.
Line: 82
@Test
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
@Test
public void test8_2() throws Exception {
Reported by PMD.
Line: 82
@Test
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
@Test
public void test8_2() throws Exception {
Reported by PMD.
Line: 83
public void test8() throws Exception {
mockMvc.perform(
(post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
.contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
}
@Test
public void test8_2() throws Exception {
// ResultActions actions = mockMvc.perform((post("/jsonp-fastjsonview/test8?callback=fnUpdateSome").characterEncoding(
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/NumberDeserializer.java
22 issues
Line: 61
if (clazz == short.class || clazz == Short.class) {
BigDecimal val = lexer.decimalValue();
lexer.nextToken(JSONToken.COMMA);
short shortValue = TypeUtils.shortValue(val);
return (T) Short.valueOf(shortValue);
}
if (clazz == byte.class || clazz == Byte.class) {
BigDecimal val = lexer.decimalValue();
Reported by PMD.
Line: 13
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;
public class NumberDeserializer implements ObjectDeserializer {
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
Reported by PMD.
Line: 13
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;
public class NumberDeserializer implements ObjectDeserializer {
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 18
public final static NumberDeserializer instance = new NumberDeserializer();
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
Reported by PMD.
Line: 20
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
final JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.LITERAL_INT) {
if (clazz == double.class || clazz == Double.class) {
String val = lexer.numberString();
lexer.nextToken(JSONToken.COMMA);
return (T) Double.valueOf(Double.parseDouble(val));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/date/DateTest4_indian.java
22 issues
Line: 12
import java.util.TimeZone;
public class DateTest4_indian extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_date() throws Exception {
Reported by PMD.
Line: 17
JSON.defaultLocale = Locale.CHINA;
}
public void test_date() throws Exception {
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Reported by PMD.
Line: 17
JSON.defaultLocale = Locale.CHINA;
}
public void test_date() throws Exception {
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Reported by PMD.
Line: 18
}
public void test_date() throws Exception {
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
Reported by PMD.
Line: 19
public void test_date() throws Exception {
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
Reported by PMD.
Line: 20
public void test_date() throws Exception {
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
long delta_2_1 = date2.getTime() - date1.getTime();
Reported by PMD.
Line: 21
Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
long delta_2_1 = date2.getTime() - date1.getTime();
assertEquals(1800000, delta_2_1);
Reported by PMD.
Line: 22
assertNotNull(date1);
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
long delta_2_1 = date2.getTime() - date1.getTime();
assertEquals(1800000, delta_2_1);
Reported by PMD.
Line: 23
Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
long delta_2_1 = date2.getTime() - date1.getTime();
assertEquals(1800000, delta_2_1);
long delta_3_1 = date3.getTime() - date1.getTime();
Reported by PMD.
Line: 25
Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();
long delta_2_1 = date2.getTime() - date1.getTime();
assertEquals(1800000, delta_2_1);
long delta_3_1 = date3.getTime() - date1.getTime();
assertEquals(-900000, delta_3_1);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2700/Issue2754.java
22 issues
Line: 11
import java.util.TimeZone;
public class Issue2754 extends TestCase {
public void test_for_issue0() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
Reported by PMD.
Line: 15
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue1() throws Exception {
Reported by PMD.
Line: 15
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue1() throws Exception {
Reported by PMD.
Line: 17
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue1() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
Reported by PMD.
Line: 17
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue1() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
Reported by PMD.
Line: 20
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue1() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
Reported by PMD.
Line: 24
String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue2() throws Exception {
Reported by PMD.
Line: 26
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue2() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
C c = JSON.parseObject(s, C.class);
Reported by PMD.
Line: 26
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue2() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
C c = JSON.parseObject(s, C.class);
Reported by PMD.
Line: 29
assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
}
public void test_for_issue2() throws Exception {
String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
C c = JSON.parseObject(s, C.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Kathmandu"));
Reported by PMD.
src/test/java/com/alibaba/json/test/benchmark/BenchmarkExecutor.java
22 issues
Line: 124
return (Long) mbeanServer.getAttribute(objectName, "CollectionCount");
} catch (Exception e) {
throw new RuntimeException("error");
}
}
public long getYoungGCTime() {
try {
Reported by PMD.
Line: 144
return (Long) mbeanServer.getAttribute(objectName, "CollectionTime");
} catch (Exception e) {
throw new RuntimeException("error", e);
}
}
public long getFullGC() {
try {
Reported by PMD.
Line: 165
return (Long) mbeanServer.getAttribute(objectName, "CollectionCount");
} catch (Exception e) {
throw new RuntimeException("error");
}
}
public static class Result {
Reported by PMD.
Line: 46
}
public void execute() {
System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));
for (BenchmarkCase benchmarkCase : caseList) {
for (Codec codec : codecList) {
try {
benchmarkCase.init(codec);
Reported by PMD.
Line: 61
Result result = executeLoop(codec, benchmarkCase);
handleResult(codec, result);
}
System.out.println();
}
}
}
public void handleResult(Codec codec, Result result) {
Reported by PMD.
Line: 72
return;
}
NumberFormat format = NumberFormat.getInstance();
System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
+ "\tYGCT " + result.getYoungGCTime());
}
private Result executeLoop(Codec codec, BenchmarkCase benchmarkCase) {
long startMillis = System.currentTimeMillis();
Reported by PMD.
Line: 52
for (Codec codec : codecList) {
try {
benchmarkCase.init(codec);
} catch (Exception e) {
e.printStackTrace();
break;
}
for (int i = 0; i < executeCount; ++i) {
Reported by PMD.
Line: 53
try {
benchmarkCase.init(codec);
} catch (Exception e) {
e.printStackTrace();
break;
}
for (int i = 0; i < executeCount; ++i) {
Result result = executeLoop(codec, benchmarkCase);
Reported by PMD.
Line: 68
public void handleResult(Codec codec, Result result) {
if (result.getError() != null) {
result.getError().printStackTrace();
return;
}
NumberFormat format = NumberFormat.getInstance();
System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
+ "\tYGCT " + result.getYoungGCTime());
Reported by PMD.
Line: 68
public void handleResult(Codec codec, Result result) {
if (result.getError() != null) {
result.getError().printStackTrace();
return;
}
NumberFormat format = NumberFormat.getInstance();
System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
+ "\tYGCT " + result.getYoungGCTime());
Reported by PMD.
src/test/java/com/alibaba/json/test/UTF8Test_decode.java
22 issues
Line: 28
CharBuffer charBuffer;
public void setUp() throws Exception {
System.out.println(System.getProperty("java.runtime.version"));
}
public void test_encode() throws Exception {
String text = new StringBuilder().append(T0).append(System.currentTimeMillis()).toString();
Reported by PMD.
Line: 44
// f1(); // 695
// f2(); // 975
long millis = System.currentTimeMillis() - start;
System.out.println("millis : " + millis);
}
}
public void test_encode_en() throws Exception {
String text = new StringBuilder().append(T1).append(System.currentTimeMillis()).toString();
Reported by PMD.
Line: 60
// f1(); // 1296 1058
// f2(); // 615 635
long millis = System.currentTimeMillis() - start;
System.out.println("millis : " + millis);
}
}
private void f0() throws Exception {
for (int i = 0; i < 1000 * 1000; ++i) {
Reported by PMD.
Line: 14
* Created by wenshao on 24/07/2017.
*/
public class UTF8Test_decode extends TestCase {
String T0 = "央视的报道《陆军第82集团军:聚合重塑 强军路上当先锋!》披露,从南昌起义到平江起义,从井冈山斗争到两万五千里长征,从首战平型关到历经三大战役,从穿插三所里到全歼美军北极熊团,22勇士飞夺泸定桥、18勇士强渡乌江、鏖战冀中“野八旅”、屡战屡胜“老虎连”、万岁军,一支支善战的部队,一个个滚烫的名字,熔铸成第82集团军新的灵魂。";
String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";
Charset charset = Charset.forName("UTF-8");
Reported by PMD.
Line: 15
*/
public class UTF8Test_decode extends TestCase {
String T0 = "央视的报道《陆军第82集团军:聚合重塑 强军路上当先锋!》披露,从南昌起义到平江起义,从井冈山斗争到两万五千里长征,从首战平型关到历经三大战役,从穿插三所里到全歼美军北极熊团,22勇士飞夺泸定桥、18勇士强渡乌江、鏖战冀中“野八旅”、屡战屡胜“老虎连”、万岁军,一支支善战的部队,一个个滚烫的名字,熔铸成第82集团军新的灵魂。";
String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";
Charset charset = Charset.forName("UTF-8");
Reported by PMD.
Line: 18
String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";
Charset charset = Charset.forName("UTF-8");
char[] chars;
byte[] bytes;
Reported by PMD.
Line: 21
Charset charset = Charset.forName("UTF-8");
char[] chars;
byte[] bytes;
CharBuffer charBuffer;
Reported by PMD.
Line: 22
char[] chars;
byte[] bytes;
CharBuffer charBuffer;
public void setUp() throws Exception {
Reported by PMD.
Line: 25
byte[] bytes;
CharBuffer charBuffer;
public void setUp() throws Exception {
System.out.println(System.getProperty("java.runtime.version"));
}
Reported by PMD.
Line: 27
CharBuffer charBuffer;
public void setUp() throws Exception {
System.out.println(System.getProperty("java.runtime.version"));
}
public void test_encode() throws Exception {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_private.java
22 issues
Line: 17
public class BeanToArrayTest_private extends TestCase {
public void test_beanToArray_parse() throws Exception {
String text = "{\"go\":[[\"0\",[true,false],9999999999999,99,\"012345678901234567890123\",\"ftp://gfw.yma.co/x160\",\"xxxx\",\"9876543210123456\",[[\"m\",\"不要开心\",\"http://gfw.meiya.co\",\"123456@gg.com\",\"麻麻\",\"add\",null,\"9876543210123456\"]],null,[\"add\",\"ww\"],999,1234567890123]],\"success\":true}";
GR result = JSON.parseObject(text, GR.class);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Reported by PMD.
Line: 21
String text = "{\"go\":[[\"0\",[true,false],9999999999999,99,\"012345678901234567890123\",\"ftp://gfw.yma.co/x160\",\"xxxx\",\"9876543210123456\",[[\"m\",\"不要开心\",\"http://gfw.meiya.co\",\"123456@gg.com\",\"麻麻\",\"add\",null,\"9876543210123456\"]],null,[\"add\",\"ww\"],999,1234567890123]],\"success\":true}";
GR result = JSON.parseObject(text, GR.class);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
Reported by PMD.
Line: 22
GR result = JSON.parseObject(text, GR.class);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
Reported by PMD.
Line: 22
GR result = JSON.parseObject(text, GR.class);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
Reported by PMD.
Line: 23
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
Reported by PMD.
Line: 23
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
Reported by PMD.
Line: 23
Assert.assertNotNull(result);
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
Reported by PMD.
Line: 24
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
public static class GR {
Reported by PMD.
Line: 24
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
public static class GR {
Reported by PMD.
Line: 24
Assert.assertEquals(1, result.go.size());
Assert.assertEquals("0", result.go.get(0).bi);
Assert.assertEquals(true, result.go.get(0).co.qu);
Assert.assertEquals(false, result.go.get(0).co.sa);
Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
Assert.assertEquals(99, result.go.get(0).grCo);
}
public static class GR {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_BrowserSecure.java
22 issues
Line: 16
public class SerializeWriterTest_BrowserSecure extends TestCase {
public void test_0() throws Exception {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
Reported by PMD.
Line: 16
public class SerializeWriterTest_BrowserSecure extends TestCase {
public void test_0() throws Exception {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
Reported by PMD.
Line: 21
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
buf.append("\0");
JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 21
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
buf.append("\0");
JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 22
buf.append('a');
}
buf.append("中国");
buf.append("\0");
JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
}
public void test_1() throws Exception {
StringBuilder buf = new StringBuilder();
Reported by PMD.
Line: 26
JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
}
public void test_1() throws Exception {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
Reported by PMD.
Line: 26
JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
}
public void test_1() throws Exception {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
Reported by PMD.
Line: 31
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
buf.append("\0");
StringWriter out = new StringWriter();
JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
}
Reported by PMD.
Line: 31
for (int i = 0; i < 1024; ++i) {
buf.append('a');
}
buf.append("中国");
buf.append("\0");
StringWriter out = new StringWriter();
JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
}
Reported by PMD.
Line: 32
buf.append('a');
}
buf.append("中国");
buf.append("\0");
StringWriter out = new StringWriter();
JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONLexerTest_13.java
21 issues
Line: 11
public class JSONLexerTest_13 extends TestCase {
public void test_e() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
Reported by PMD.
Line: 12
public class JSONLexerTest_13 extends TestCase {
public void test_e() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 12
public class JSONLexerTest_13 extends TestCase {
public void test_e() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 15
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
Reported by PMD.
Line: 16
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 16
}
public void test_E() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 19
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
public void test_E_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
Reported by PMD.
Line: 20
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
public void test_E_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 20
}
public void test_e_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
public void test_E_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
}
Reported by PMD.
Line: 23
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
}
public void test_E_plus() throws Exception {
Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
}
public void test_e_minus() throws Exception {
Assert.assertTrue(123e-3D == JSON.parseObject("{\"vo\":{\"type\":123e-3}}", A.class).getVo().getType());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_fushou.java
21 issues
Line: 15
public class Bug_for_fushou extends TestCase{
public void test_case1() {
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
Reported by PMD.
Line: 15
public class Bug_for_fushou extends TestCase{
public void test_case1() {
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
Reported by PMD.
Line: 19
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
Reported by PMD.
Line: 19
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
Reported by PMD.
Line: 23
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
Reported by PMD.
Line: 23
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
Reported by PMD.
Line: 24
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
Reported by PMD.
Line: 24
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
Reported by PMD.
Line: 27
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(JSONObject.class, r0.getModules().getClass());
Reported by PMD.
Line: 27
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(JSONObject.class, r0.getModules().getClass());
Reported by PMD.