The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/filters/PropertyFilterTest.java
25 issues
Line: 17
public class PropertyFilterTest extends TestCase {
public void test_0() throws Exception {
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
return false;
}
Reported by PMD.
Line: 27
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getPropertyFilters().add(filter);
A a = new A();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 36
Assert.assertEquals("{}", text);
}
public void test_toJSONString() throws Exception {
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
return false;
}
Reported by PMD.
Line: 47
Assert.assertEquals("{}", JSON.toJSONString(new A(), filter));
}
public void test_1() throws Exception {
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if ("id".equals(name)) {
return true;
Reported by PMD.
Line: 60
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getPropertyFilters().add(filter);
A a = new A();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 69
Assert.assertEquals("{\"id\":0}", text);
}
public void test_2() throws Exception {
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if ("name".equals(name)) {
return true;
Reported by PMD.
Line: 73
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if ("name".equals(name)) {
return true;
}
return false;
}
};
Reported by PMD.
Line: 82
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getPropertyFilters().add(filter);
A a = new A();
a.setName("chennp2008");
serializer.write(a);
Reported by PMD.
Line: 92
Assert.assertEquals("{\"name\":\"chennp2008\"}", text);
}
public void test_3() throws Exception {
PropertyFilter filter = new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if ("name".equals(name)) {
return true;
Reported by PMD.
Line: 105
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getPropertyFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "chennp2008");
serializer.write(map);
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/JSONReaderScanner.java
24 issues
Line: 89
this(new CharArrayReader(input, 0, inputLength), features);
}
public final char charAt(int index) {
if (index >= bufLength) {
if (bufLength == -1) {
if (index < sp) {
return buf[index];
}
Reported by PMD.
Line: 34
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONReaderScanner extends JSONLexerBase {
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
Reported by PMD.
Line: 34
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONReaderScanner extends JSONLexerBase {
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
Reported by PMD.
Line: 34
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONReaderScanner extends JSONLexerBase {
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
Reported by PMD.
Line: 34
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class JSONReaderScanner extends JSONLexerBase {
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
Reported by PMD.
Line: 38
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
private int bufLength;
public JSONReaderScanner(String input){
this(input, JSON.DEFAULT_PARSER_FEATURE);
Reported by PMD.
Line: 39
private final static ThreadLocal<char[]> BUF_LOCAL = new ThreadLocal<char[]>();
private Reader reader;
private char[] buf;
private int bufLength;
public JSONReaderScanner(String input){
this(input, JSON.DEFAULT_PARSER_FEATURE);
}
Reported by PMD.
Line: 40
private Reader reader;
private char[] buf;
private int bufLength;
public JSONReaderScanner(String input){
this(input, JSON.DEFAULT_PARSER_FEATURE);
}
Reported by PMD.
Line: 80
bp = -1;
next();
if (ch == 65279) { // utf8 bom
next();
}
}
public JSONReaderScanner(char[] input, int inputLength, int features){
Reported by PMD.
Line: 89
this(new CharArrayReader(input, 0, inputLength), features);
}
public final char charAt(int index) {
if (index >= bufLength) {
if (bufLength == -1) {
if (index < sp) {
return buf[index];
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/MultiFieldIntTest_writer2.java
24 issues
Line: 38
writer.close();
String text = out.toString();
System.out.println(text);
List<Model> results = JSON.parseObject(text, new TypeReference<List<Model>>() {});
Assert.assertEquals(list.size(), results.size());
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Reported by PMD.
Line: 17
public class MultiFieldIntTest_writer2 extends TestCase {
public void test_for_big_writer() throws Exception {
List<Model> list = new ArrayList<Model>();
for (int i = 0; i < 1024 * 10; ++i) {
Model model = new Model();
model.i = 0;
Reported by PMD.
Line: 21
List<Model> list = new ArrayList<Model>();
for (int i = 0; i < 1024 * 10; ++i) {
Model model = new Model();
model.i = 0;
model.j = 1;
model.k = 2;
model.v = 3;
model.l = 4;
Reported by PMD.
Line: 43
Assert.assertEquals(list.size(), results.size());
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Reported by PMD.
Line: 43
Assert.assertEquals(list.size(), results.size());
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Reported by PMD.
Line: 44
Assert.assertEquals(list.size(), results.size());
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Assert.assertEquals(list.get(i).n, results.get(i).n);
Reported by PMD.
Line: 44
Assert.assertEquals(list.size(), results.size());
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Assert.assertEquals(list.get(i).n, results.get(i).n);
Reported by PMD.
Line: 45
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Assert.assertEquals(list.get(i).n, results.get(i).n);
}
Reported by PMD.
Line: 45
for (int i = 0; i < results.size(); ++i) {
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Assert.assertEquals(list.get(i).n, results.get(i).n);
}
Reported by PMD.
Line: 46
Assert.assertEquals(list.get(i).i, results.get(i).i);
Assert.assertEquals(list.get(i).j, results.get(i).j);
Assert.assertEquals(list.get(i).k, results.get(i).k);
Assert.assertEquals(list.get(i).v, results.get(i).v);
Assert.assertEquals(list.get(i).l, results.get(i).l);
Assert.assertEquals(list.get(i).m, results.get(i).m);
Assert.assertEquals(list.get(i).n, results.get(i).n);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/test/DigitTest.java
24 issues
Line: 36
f_isDigitSwitch();
f_isDigitProhibit();
System.out.println();
System.out.println();
}
}
public void f_isDigitBitSet() throws Exception {
Reported by PMD.
Line: 37
f_isDigitProhibit();
System.out.println();
System.out.println();
}
}
public void f_isDigitBitSet() throws Exception {
long startNano = System.nanoTime();
Reported by PMD.
Line: 49
}
}
long nano = System.nanoTime() - startNano;
System.out.println("bitset \t: " + NumberFormat.getInstance().format(nano));
}
public void f_isDigitRange() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 60
}
}
long nano = System.nanoTime() - startNano;
System.out.println("range \t: " + NumberFormat.getInstance().format(nano));
}
public void f_isDigitArray() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 71
}
}
long nano = System.nanoTime() - startNano;
System.out.println("array \t: " + NumberFormat.getInstance().format(nano));
}
public void f_isDigitSwitch() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 82
}
}
long nano = System.nanoTime() - startNano;
System.out.println("swtich \t: " + NumberFormat.getInstance().format(nano));
}
public void f_isDigitProhibit() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 93
}
}
long nano = System.nanoTime() - startNano;
System.out.println("prohi \t: " + NumberFormat.getInstance().format(nano));
}
private static final boolean[] digitBits = new boolean[256];
static {
for (char ch = '0'; ch <= '9'; ++ch) {
Reported by PMD.
Line: 25
public class DigitTest extends TestCase {
private char[] text = "[-5.041598256063065E-20,-7210028408342716000]".toCharArray();
private int COUNT = 1000 * 1000;
public void test_perf() throws Exception {
for (int i = 0; i < 50; ++i) {
f_isDigitBitSet();
Reported by PMD.
Line: 25
public class DigitTest extends TestCase {
private char[] text = "[-5.041598256063065E-20,-7210028408342716000]".toCharArray();
private int COUNT = 1000 * 1000;
public void test_perf() throws Exception {
for (int i = 0; i < 50; ++i) {
f_isDigitBitSet();
Reported by PMD.
Line: 26
public class DigitTest extends TestCase {
private char[] text = "[-5.041598256063065E-20,-7210028408342716000]".toCharArray();
private int COUNT = 1000 * 1000;
public void test_perf() throws Exception {
for (int i = 0; i < 50; ++i) {
f_isDigitBitSet();
f_isDigitArray();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2500/Issue2579.java
24 issues
Line: 48
Assert.assertEquals(i, ((MyPoint2) obj).getBatchNumber());
}
} catch (JSONException e) {
System.out.println(jsonString);
e.printStackTrace();
Assert.assertTrue(false);
}
}
}
Reported by PMD.
Line: 23
public class Issue2579 extends TestCase {
// 场景:走ASM
public void test_for_issue1() throws Exception {
run_test("MyPoint1");
}
// 场景:不走ASM,通过JSONType(asm=false),关闭了ASM
public void test_for_issue2() throws Exception {
Reported by PMD.
Line: 23
public class Issue2579 extends TestCase {
// 场景:走ASM
public void test_for_issue1() throws Exception {
run_test("MyPoint1");
}
// 场景:不走ASM,通过JSONType(asm=false),关闭了ASM
public void test_for_issue2() throws Exception {
Reported by PMD.
Line: 28
}
// 场景:不走ASM,通过JSONType(asm=false),关闭了ASM
public void test_for_issue2() throws Exception {
run_test("MyPoint2");
}
// 场景:随机顺序组合JSON字符串测试2000次
private void run_test(String className) {
Reported by PMD.
Line: 28
}
// 场景:不走ASM,通过JSONType(asm=false),关闭了ASM
public void test_for_issue2() throws Exception {
run_test("MyPoint2");
}
// 场景:随机顺序组合JSON字符串测试2000次
private void run_test(String className) {
Reported by PMD.
Line: 39
String jsonString;
for (int i = 1; i < 2000; i++) {
jsonString = getString(i, className);
jsonString = begin + jsonString + end;
try {
Object obj = JSON.parse(jsonString, Feature.SupportAutoType);
if ("MyPoint1".equals(className)) {
Assert.assertEquals(i, ((MyPoint1) obj).getBatchNumber());
} else {
Reported by PMD.
Line: 49
}
} catch (JSONException e) {
System.out.println(jsonString);
e.printStackTrace();
Assert.assertTrue(false);
}
}
}
Reported by PMD.
Line: 77
len = list.size();
index = getRandomIndex(len);
buffer.append(list.get(index));
buffer.append(",");
list.remove(index);
}
buffer.deleteCharAt(buffer.length() - 1);
return buffer.toString();
}
Reported by PMD.
Line: 90
}
@SuppressWarnings("serial")
public static class MyPoint1 extends Point {
private UUID id;
private int batchNumber;
private Point point = new Point();
private String[] strArr = { "te-st", "tes-t2" };
private Date date = new Date();
Reported by PMD.
Line: 123
}
public String[] getStrArr() {
return strArr;
}
public void setStrArr(String[] strArr) {
this.strArr = strArr;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/Base64Test2.java
24 issues
Line: 11
public class Base64Test2 extends TestCase {
public void test_base64_2() throws Exception {
String text = "";
for (int i = 0; i < 1000; ++i) {
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Reported by PMD.
Line: 14
public void test_base64_2() throws Exception {
String text = "";
for (int i = 0; i < 1000; ++i) {
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
Reported by PMD.
Line: 16
for (int i = 0; i < 1000; ++i) {
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
Reported by PMD.
Line: 17
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Reported by PMD.
Line: 17
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Reported by PMD.
Line: 17
byte[] bytes = text.getBytes("UTF-8");
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Reported by PMD.
Line: 18
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Reported by PMD.
Line: 19
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Reported by PMD.
Line: 19
String str = com.alibaba.json.test.Base64.encodeToString(bytes, true);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Reported by PMD.
Line: 22
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
{
String str = com.alibaba.json.test.Base64.encodeToString(bytes, false);
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str.toCharArray(), 0, str.length()), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str), "UTF-8"));
Assert.assertEquals(text, new String(IOUtils.decodeBase64(str, 0, str.length()), "UTF-8"));
}
text += ((char) i);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330.java
24 issues
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330 extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330 extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 18
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 29
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseInt error, field : value") != -1);
}
public void test_for_issue_2() throws Exception {
Exception error = null;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330_byte.java
24 issues
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_byte extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_byte extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 18
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 29
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseByte error, field : value") != -1);
}
public void test_for_issue_2() throws Exception {
Exception error = null;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2200/Issue2260.java
24 issues
Line: 11
import java.util.Calendar;
public class Issue2260 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M1 m = JSON.parseObject(json, M1.class);
assertEquals(1950, m.date.get(Calendar.YEAR));
}
Reported by PMD.
Line: 14
public void test_for_issue() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M1 m = JSON.parseObject(json, M1.class);
assertEquals(1950, m.date.get(Calendar.YEAR));
}
public void test_for_jdk8_zdt_1() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 14
public void test_for_issue() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M1 m = JSON.parseObject(json, M1.class);
assertEquals(1950, m.date.get(Calendar.YEAR));
}
public void test_for_jdk8_zdt_1() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 17
assertEquals(1950, m.date.get(Calendar.YEAR));
}
public void test_for_jdk8_zdt_1() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
Reported by PMD.
Line: 20
public void test_for_jdk8_zdt_1() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_2() throws Exception {
String json = "{\"date\":\"1950-07-14 12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 20
public void test_for_jdk8_zdt_1() throws Exception {
String json = "{\"date\":\"1950-07-14\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_2() throws Exception {
String json = "{\"date\":\"1950-07-14 12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 23
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_2() throws Exception {
String json = "{\"date\":\"1950-07-14 12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
Reported by PMD.
Line: 26
public void test_for_jdk8_zdt_2() throws Exception {
String json = "{\"date\":\"1950-07-14 12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_3() throws Exception {
String json = "{\"date\":\"1950-07-14T12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 26
public void test_for_jdk8_zdt_2() throws Exception {
String json = "{\"date\":\"1950-07-14 12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_3() throws Exception {
String json = "{\"date\":\"1950-07-14T12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
Reported by PMD.
Line: 29
assertEquals(1950, m.date.getYear());
}
public void test_for_jdk8_zdt_3() throws Exception {
String json = "{\"date\":\"1950-07-14T12:23:34\"}";
M2 m = JSON.parseObject(json, M2.class);
assertEquals(1950, m.date.getYear());
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330_boolean.java
24 issues
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_boolean extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_boolean extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 18
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 22
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":[]}", Model.class);
} catch (JSONException e) {
error = e;
Reported by PMD.
Line: 29
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseBoolean error, field : value") != -1);
}
public void test_for_issue_2() throws Exception {
Exception error = null;
Reported by PMD.