The following issues were found
src/test/java/com/alibaba/json/bvt/parser/number/NumberValueTest_error_5.java
2 issues
Line: 12
public class NumberValueTest_error_5 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{-";
JSON.parse(text);
} catch (JSONException e) {
Reported by PMD.
Line: 13
public class NumberValueTest_error_5 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{-";
JSON.parse(text);
} catch (JSONException e) {
error = e;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/number/NumberValueTest_error_6.java
2 issues
Line: 12
public class NumberValueTest_error_6 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{3e+";
JSON.parse(text);
} catch (JSONException e) {
Reported by PMD.
Line: 13
public class NumberValueTest_error_6 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{3e+";
JSON.parse(text);
} catch (JSONException e) {
error = e;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/number/NumberValueTest_error_8.java
2 issues
Line: 12
public class NumberValueTest_error_8 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{\"value\":3";
JSON.parse(text);
} catch (JSONException e) {
Reported by PMD.
Line: 13
public class NumberValueTest_error_8 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{\"value\":3";
JSON.parse(text);
} catch (JSONException e) {
error = e;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/number/NumberValueTest_error_9.java
2 issues
Line: 12
public class NumberValueTest_error_9 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{\"value\":3.";
JSON.parse(text);
} catch (JSONException e) {
Reported by PMD.
Line: 13
public class NumberValueTest_error_9 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
String text = "{\"value\":3.";
JSON.parse(text);
} catch (JSONException e) {
error = e;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderScannerTest_type.java
2 issues
Line: 13
import com.alibaba.fastjson.parser.JSONReaderScanner;
public class JSONReaderScannerTest_type extends TestCase {
@SuppressWarnings("rawtypes")
public void test_true() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"@type\":\"java.util.LinkedHashMap\",\"name\":\"张三\"}"));
LinkedHashMap json = (LinkedHashMap) parser.parse();
Assert.assertEquals("张三", json.get("name"));
parser.close();
Reported by PMD.
Line: 17
public void test_true() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"@type\":\"java.util.LinkedHashMap\",\"name\":\"张三\"}"));
LinkedHashMap json = (LinkedHashMap) parser.parse();
Assert.assertEquals("张三", json.get("name"));
parser.close();
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderTest_2.java
2 issues
Line: 12
import junit.framework.TestCase;
public class JSONReaderTest_2 extends TestCase {
public void test_read_integer() throws Exception {
String text = "1001";
JSONReader reader = new JSONReader(new StringReader(text));
Assert.assertEquals(Integer.valueOf(1001), reader.readInteger());
reader.close();
}
Reported by PMD.
Line: 19
reader.close();
}
public void test_read_Long() throws Exception {
String text = "1001";
JSONReader reader = new JSONReader(new StringReader(text));
Assert.assertEquals(Long.valueOf(1001), reader.readLong());
reader.close();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderTest_3.java
2 issues
Line: 14
public class JSONReaderTest_3 extends TestCase {
public void test_read_Long() throws Exception {
String text = "1001";
JSONReader reader = new JSONReader(new StringReader(text));
Exception error = null;
try {
Reported by PMD.
Line: 18
String text = "1001";
JSONReader reader = new JSONReader(new StringReader(text));
Exception error = null;
try {
reader.hasNext();
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReader_map.java
2 issues
Line: 15
public class JSONReader_map extends TestCase {
public void test_array() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[{\"id\":123}]"));
reader.startArray();
Map<String, Object> map = new HashMap<String, Object>();
Reported by PMD.
Line: 30
reader.close();
}
public void test_map() throws Exception {
JSONReader reader = new JSONReader(new StringReader("{\"id\":123}"));
Map<String, Object> map = new HashMap<String, Object>();
reader.readObject(map);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReader_obj.java
2 issues
Line: 13
public class JSONReader_obj extends TestCase {
public void test_array() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[{\"id\":123}]"));
reader.startArray();
VO vo = new VO();
Reported by PMD.
Line: 28
reader.close();
}
public void test_obj() throws Exception {
JSONReader reader = new JSONReader(new StringReader("{\"id\":123}"));
VO vo = new VO();
reader.readObject(vo);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/taobao/BooleanObjectFieldTest.java
2 issues
Line: 10
import junit.framework.TestCase;
public class BooleanObjectFieldTest extends TestCase {
public void test_0 () throws Exception {
VO vo = JSON.parseObject("{\"value\":true}", VO.class);
Assert.assertTrue(vo.value);
}
public static class VO {
Reported by PMD.
Line: 16
}
public static class VO {
public Boolean value;
}
}
Reported by PMD.