The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330_decimal.java
24 issues
Line: 13
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_decimal 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: 13
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_decimal 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: 20
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 21
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 21
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 21
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 21
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal error, field : value") != -1);
}
public void test_for_issue_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 24
assertTrue(error.getMessage().indexOf("parseDecimal 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: 24
assertTrue(error.getMessage().indexOf("parseDecimal 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: 31
} catch (JSONException e) {
error = e;
}
assertNotNull(error);
assertTrue(error.getMessage().indexOf("parseDecimal 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/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_1300/Issue1330_double.java
24 issues
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_double 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_double 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("parseDouble 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("parseDouble 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("parseDouble 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("parseDouble 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("parseDouble 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("parseDouble 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("parseDouble 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("parseDouble 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_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_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/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.
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330_float.java
24 issues
Line: 11
* Created by wenshao on 30/07/2017.
*/
public class Issue1330_float 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_float 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("parseLong 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("parseLong 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("parseLong 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("parseLong 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("parseLong 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("parseLong 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("parseLong 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("parseLong 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/DefaultJSONParserTest.java
23 issues
Line: 29
public class DefaultJSONParserTest extends TestCase {
public void test_double() {
DefaultJSONParser parser = new DefaultJSONParser("3.4");
parser.config(Feature.UseBigDecimal, false);
Assert.assertEquals("3.4", parser.getInput());
Assert.assertEquals(false, parser.isEnabled(Feature.UseBigDecimal));
Object result = parser.parse();
Reported by PMD.
Line: 38
Assert.assertEquals(3.4D, result);
}
public void test_double_in_object() {
DefaultJSONParser parser = new DefaultJSONParser("{\"double\":3.4}");
parser.config(Feature.UseBigDecimal, false);
Assert.assertEquals("{\"double\":3.4}", parser.getInput());
Object result = parser.parse();
Assert.assertEquals(3.4D, ((Map) result).get("double"));
Reported by PMD.
Line: 46
Assert.assertEquals(3.4D, ((Map) result).get("double"));
}
public void test_error() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("{\"name\":3]");
parser.parse();
} catch (Exception ex) {
Reported by PMD.
Line: 51
try {
DefaultJSONParser parser = new DefaultJSONParser("{\"name\":3]");
parser.parse();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 57
Assert.assertNotNull(error);
}
public void test_error2() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("ttr");
parser.parse();
} catch (Exception ex) {
Reported by PMD.
Line: 62
try {
DefaultJSONParser parser = new DefaultJSONParser("ttr");
parser.parse();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 68
Assert.assertNotNull(error);
}
public void test_error3() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("33");
parser.parseObject(new HashMap());
} catch (Exception ex) {
Reported by PMD.
Line: 73
try {
DefaultJSONParser parser = new DefaultJSONParser("33");
parser.parseObject(new HashMap());
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 79
Assert.assertNotNull(error);
}
public void test_error4() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("]");
parser.parse();
} catch (Exception ex) {
Reported by PMD.
Line: 84
try {
DefaultJSONParser parser = new DefaultJSONParser("]");
parser.parse();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.