The following issues were found
src/test/java/com/alibaba/fastjson/deserializer/issues569/parser/ParserConfigBug569.java
36 issues
Line: 55
return new DefaultFieldDeserializerBug569(mapping, clazz, fieldInfo);
}
public ObjectDeserializer getDeserializer(Class<?> clazz, Type type) {
com.alibaba.fastjson.util.IdentityHashMap<Type, ObjectDeserializer> deserializers = super.getDeserializers();
ObjectDeserializer deserializer = deserializers.get(type);
if (deserializer != null) {
return deserializer;
}
Reported by PMD.
Line: 27
* Author : BlackShadowWalker
* Date : 2016-10-10
*/
public class ParserConfigBug569 extends ParserConfig {
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
Reported by PMD.
Line: 27
* Author : BlackShadowWalker
* Date : 2016-10-10
*/
public class ParserConfigBug569 extends ParserConfig {
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
Reported by PMD.
Line: 29
*/
public class ParserConfigBug569 extends ParserConfig {
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
JavaBeanInfo beanInfo, //
Reported by PMD.
Line: 30
public class ParserConfigBug569 extends ParserConfig {
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
JavaBeanInfo beanInfo, //
FieldInfo fieldInfo) {
Reported by PMD.
Line: 31
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
JavaBeanInfo beanInfo, //
FieldInfo fieldInfo) {
Class<?> clazz = beanInfo.clazz;
Reported by PMD.
Line: 31
private static boolean awtError = false;
private static boolean jdk8Error = false;
private String[] denyList = new String[] { "java.lang.Thread" };
public FieldDeserializer createFieldDeserializer(ParserConfig mapping, //
JavaBeanInfo beanInfo, //
FieldInfo fieldInfo) {
Class<?> clazz = beanInfo.clazz;
Reported by PMD.
Line: 44
if (annotation != null) {
deserializeUsing = annotation.deserializeUsing();
if (deserializeUsing == Void.class) {
deserializeUsing = null;
}
}
if (deserializeUsing == null && (fieldClass == List.class || fieldClass == ArrayList.class)) {
return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
Reported by PMD.
Line: 48
}
}
if (deserializeUsing == null && (fieldClass == List.class || fieldClass == ArrayList.class)) {
return new ArrayListTypeFieldDeserializer(mapping, clazz, fieldInfo);
}
return new DefaultFieldDeserializerBug569(mapping, clazz, fieldInfo);
}
Reported by PMD.
Line: 55
return new DefaultFieldDeserializerBug569(mapping, clazz, fieldInfo);
}
public ObjectDeserializer getDeserializer(Class<?> clazz, Type type) {
com.alibaba.fastjson.util.IdentityHashMap<Type, ObjectDeserializer> deserializers = super.getDeserializers();
ObjectDeserializer deserializer = deserializers.get(type);
if (deserializer != null) {
return deserializer;
}
Reported by PMD.
src/test/java/com/alibaba/json/test/FNV32_CollisionTest_All.java
36 issues
Line: 38
FileOutputStream out;
protected void setUp() throws Exception {
out = new FileOutputStream(file);
for (int i = 0; i < bits.length; ++i) {
bits[i] = new BitSet(Integer.MAX_VALUE);
}
}
Reported by PMD.
Line: 89
long now = System.currentTimeMillis();
long millis = now - time;
time = now;
System.out.println("millis : " + millis + ", collision " + format.format(collisionCount) + ", " + format.format(v));
}
}
System.out.println("end : " + len);
}
Reported by PMD.
Line: 93
}
}
System.out.println("end : " + len);
}
}
String build(long v, int len) {
char[] chars = new char[len];
Reported by PMD.
Line: 21
*/
public class FNV32_CollisionTest_All extends TestCase {
char[] digLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".toCharArray();
//char[] digLetters = "0123456789".toCharArray();
Random r = new Random();
int[] powers = new int[10];
{
Reported by PMD.
Line: 24
char[] digLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".toCharArray();
//char[] digLetters = "0123456789".toCharArray();
Random r = new Random();
int[] powers = new int[10];
{
for (int i = 0; i < powers.length; ++i) {
powers[i] = (int) Math.pow(digLetters.length, i);
}
Reported by PMD.
Line: 26
Random r = new Random();
int[] powers = new int[10];
{
for (int i = 0; i < powers.length; ++i) {
powers[i] = (int) Math.pow(digLetters.length, i);
}
}
Reported by PMD.
Line: 32
}
}
private BitSet[] bits = new BitSet[16];
private File file = new File("/Users/wenshao/Downloads/fnv/hash.bin");
FileOutputStream out;
protected void setUp() throws Exception {
Reported by PMD.
Line: 34
private BitSet[] bits = new BitSet[16];
private File file = new File("/Users/wenshao/Downloads/fnv/hash.bin");
FileOutputStream out;
protected void setUp() throws Exception {
out = new FileOutputStream(file);
Reported by PMD.
Line: 34
private BitSet[] bits = new BitSet[16];
private File file = new File("/Users/wenshao/Downloads/fnv/hash.bin");
FileOutputStream out;
protected void setUp() throws Exception {
out = new FileOutputStream(file);
Reported by PMD.
Line: 35
private BitSet[] bits = new BitSet[16];
private File file = new File("/Users/wenshao/Downloads/fnv/hash.bin");
FileOutputStream out;
protected void setUp() throws Exception {
out = new FileOutputStream(file);
for (int i = 0; i < bits.length; ++i) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_reverse_test.java
36 issues
Line: 11
public class JSONPath_reverse_test extends TestCase
{
public void test_reserve() throws Exception {
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
Reported by PMD.
Line: 11
public class JSONPath_reverse_test extends TestCase
{
public void test_reserve() throws Exception {
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
Reported by PMD.
Line: 14
public void test_reserve() throws Exception {
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
Reported by PMD.
Line: 14
public void test_reserve() throws Exception {
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
Reported by PMD.
Line: 14
public void test_reserve() throws Exception {
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
Reported by PMD.
Line: 15
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,50,\"ljw\"]]")
Reported by PMD.
Line: 15
JSONObject object = JSON.parseObject("{\"id\":1001,\"name\":\"ljw\",\"age\":50}");
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,50,\"ljw\"]]")
Reported by PMD.
Line: 17
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,50,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,\"ljw\",50]]")
|| text.equals("[\"ljw\",[50,\"ljw\",1001]]"));
Reported by PMD.
Line: 17
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,50,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,\"ljw\",50]]")
|| text.equals("[\"ljw\",[50,\"ljw\",1001]]"));
Reported by PMD.
Line: 17
assertEquals("[1001,\"ljw\"]", JSONPath.reserveToArray(object, "id", "name").toString());
assertEquals("[\"ljw\",1001]", JSONPath.reserveToArray(object, "name", "id").toString());
String text = JSON.toJSONString(JSONPath.reserveToArray(object, "name", "*"), SerializerFeature.MapSortField);
assertTrue(text.equals("[\"ljw\",[\"ljw\",1001,50]]")
|| text.equals("[\"ljw\",[\"ljw\",50,1001]]")
|| text.equals("[\"ljw\",[50,1001,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,50,\"ljw\"]]")
|| text.equals("[\"ljw\",[1001,\"ljw\",50]]")
|| text.equals("[\"ljw\",[50,\"ljw\",1001]]"));
Reported by PMD.
src/test/java/com/alibaba/china/bolt/biz/daili/merchants/vo/MerchantsVO.java
36 issues
Line: 160
return minarea;
}
public void setMinarea(Integer minarea) {
if (null == minarea) {
minarea = -1; //opensearch 搜索空问题 ,设置默认值
}
this.minarea = minarea;
}
Reported by PMD.
Line: 1
package com.alibaba.china.bolt.biz.daili.merchants.vo;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;
import com.alibaba.fastjson.JSON;
Reported by PMD.
Line: 17
* @author hongwei.quhw
*
*/
public class MerchantsVO implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
Reported by PMD.
Line: 17
* @author hongwei.quhw
*
*/
public class MerchantsVO implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
Reported by PMD.
Line: 141
}
public String[] getRegion() {
return region;
}
public void setRegionArray(String[] region) {
this.region = region;
}
Reported by PMD.
Line: 144
return region;
}
public void setRegionArray(String[] region) {
this.region = region;
}
public String[] getRegionname() {
return regionname;
Reported by PMD.
Line: 149
}
public String[] getRegionname() {
return regionname;
}
public void setRegionnameArray(String[] regionname) {
this.regionname = regionname;
}
Reported by PMD.
Line: 152
return regionname;
}
public void setRegionnameArray(String[] regionname) {
this.regionname = regionname;
}
public Integer getMinarea() {
return minarea;
Reported by PMD.
Line: 192
}
public String[] getShoptype() {
return shoptype;
}
public void setShoptypeArray(String[] shoptype) {
this.shoptype = shoptype;
}
Reported by PMD.
Line: 195
return shoptype;
}
public void setShoptypeArray(String[] shoptype) {
this.shoptype = shoptype;
}
public String[] getShoptypename() {
return shoptypename;
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/RyuFloat.java
35 issues
Line: 20
/**
* An implementation of Ryu for float.
*/
public final class RyuFloat {
private static final int[][] POW5_SPLIT = {
{536870912, 0},
{671088640, 0},
{838860800, 0},
{1048576000, 0},
Reported by PMD.
Line: 20
/**
* An implementation of Ryu for float.
*/
public final class RyuFloat {
private static final int[][] POW5_SPLIT = {
{536870912, 0},
{671088640, 0},
{838860800, 0},
{1048576000, 0},
Reported by PMD.
Line: 20
/**
* An implementation of Ryu for float.
*/
public final class RyuFloat {
private static final int[][] POW5_SPLIT = {
{536870912, 0},
{671088640, 0},
{838860800, 0},
{1048576000, 0},
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
Line: 111
return new String(result, 0, len);
}
public static int toString(float value, char[] result, int off) {
final int FLOAT_MANTISSA_MASK = 8388607; // (1 << 23) - 1;
final int FLOAT_EXPONENT_MASK = 255; // (1 << 8) - 1;
final int FLOAT_EXPONENT_BIAS = 127; // (1 << (8 - 1)) - 1;
final long LOG10_2_NUMERATOR = 3010299; // (long) (10000000L * Math.log10(2));
final long LOG10_5_DENOMINATOR = 10000000L;
Reported by PMD.
src/test/java/com/alibaba/fastjson/support/jaxrs/TestIssue885.java
35 issues
Line: 19
public class TestIssue885 extends JerseyTest {
@Path("user")
public static class UserResource {
@GET
public User getUser() {
User user = new User();
user.setId(12345L);
Reported by PMD.
Line: 49
}
@Test
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
Reported by PMD.
Line: 50
@Test
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
Reported by PMD.
Line: 50
@Test
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
Reported by PMD.
Line: 50
@Test
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
Reported by PMD.
Line: 52
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
@Test
Reported by PMD.
Line: 52
public void testWriteTo() {
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
@Test
Reported by PMD.
Line: 53
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
@Test
public void testWriteToWithPretty() {
Reported by PMD.
Line: 53
final String user = target("user").request().accept("application/json").get(String.class);
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
@Test
public void testWriteToWithPretty() {
Reported by PMD.
Line: 54
// {"createdOn":1412036891919,"id":12345,"name":"smallnest"}]
assertTrue(user.indexOf("createdOn") > 0);
assertTrue(user.indexOf("\"id\":12345") > 0);
assertTrue(user.indexOf("\"name\":\"smallnest\"") > 0);
}
@Test
public void testWriteToWithPretty() {
//System.out.println("@@@@@Test Pretty");
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_false.java
35 issues
Line: 9
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.JSONScanner;
public class JSONScannerTest_false extends TestCase {
public void test_scan_false_0() throws Exception {
JSONScanner lexer = new JSONScanner("false");
lexer.scanFalse();
}
Reported by PMD.
Line: 11
public class JSONScannerTest_false extends TestCase {
public void test_scan_false_0() throws Exception {
JSONScanner lexer = new JSONScanner("false");
lexer.scanFalse();
}
public void test_scan_false_1() throws Exception {
Reported by PMD.
Line: 11
public class JSONScannerTest_false extends TestCase {
public void test_scan_false_0() throws Exception {
JSONScanner lexer = new JSONScanner("false");
lexer.scanFalse();
}
public void test_scan_false_1() throws Exception {
Reported by PMD.
Line: 16
lexer.scanFalse();
}
public void test_scan_false_1() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("zalse");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 27
Assert.assertNotNull(error);
}
public void test_scan_false_2() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("fzlse");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 38
Assert.assertNotNull(error);
}
public void test_scan_false_3() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("fazse");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 49
Assert.assertNotNull(error);
}
public void test_scan_false_4() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("falze");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 60
Assert.assertNotNull(error);
}
public void test_scan_false_5() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("falsz");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 71
Assert.assertNotNull(error);
}
public void test_scan_false_6_1() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("falsee");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
Line: 82
Assert.assertNotNull(error);
}
public void test_scan_false_6() throws Exception {
JSONException error = null;
try {
JSONScanner lexer = new JSONScanner("false\"");
lexer.scanFalse();
} catch (JSONException e) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/validate/JSONValidatorTest.java
35 issues
Line: 13
import static org.junit.Assert.*;
public class JSONValidatorTest {
@Test
public void validate_test_accurate() throws Throwable {
boolean isValidate = JSONValidator.from("{\"string\":\"a\",\"nums\":[0,-1,10,0.123,1e5,-1e+6,0.1e-7],\"object\":{\"empty\":{},\"list\":[]},\"list\":[\"object\",{\"true\":true,\"false\":false,\"null\":null}]}").validate();
assertTrue(isValidate);
Reported by PMD.
Line: 17
@Test
public void validate_test_accurate() throws Throwable {
boolean isValidate = JSONValidator.from("{\"string\":\"a\",\"nums\":[0,-1,10,0.123,1e5,-1e+6,0.1e-7],\"object\":{\"empty\":{},\"list\":[]},\"list\":[\"object\",{\"true\":true,\"false\":false,\"null\":null}]}").validate();
assertTrue(isValidate);
}
@Test
public void validate_test_quotation() throws Throwable {
Reported by PMD.
Line: 18
@Test
public void validate_test_accurate() throws Throwable {
boolean isValidate = JSONValidator.from("{\"string\":\"a\",\"nums\":[0,-1,10,0.123,1e5,-1e+6,0.1e-7],\"object\":{\"empty\":{},\"list\":[]},\"list\":[\"object\",{\"true\":true,\"false\":false,\"null\":null}]}").validate();
assertTrue(isValidate);
}
@Test
public void validate_test_quotation() throws Throwable {
boolean isValidate = JSONValidator.from("{noQuotationMarksError}").validate();
Reported by PMD.
Line: 23
@Test
public void validate_test_quotation() throws Throwable {
boolean isValidate = JSONValidator.from("{noQuotationMarksError}").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_colon() throws Throwable {
Reported by PMD.
Line: 24
@Test
public void validate_test_quotation() throws Throwable {
boolean isValidate = JSONValidator.from("{noQuotationMarksError}").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_colon() throws Throwable {
boolean isValidate = JSONValidator.from("{\"colonError\"}").validate();
Reported by PMD.
Line: 29
@Test
public void validate_test_colon() throws Throwable {
boolean isValidate = JSONValidator.from("{\"colonError\"}").validate();
assertFalse(isValidate);
}
@Test
Reported by PMD.
Line: 30
@Test
public void validate_test_colon() throws Throwable {
boolean isValidate = JSONValidator.from("{\"colonError\"}").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_bracket() throws Throwable {
Reported by PMD.
Line: 36
@Test
public void validate_test_bracket() throws Throwable {
boolean isValidate = JSONValidator.from("[1}").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_num1() throws Throwable {
Reported by PMD.
Line: 37
@Test
public void validate_test_bracket() throws Throwable {
boolean isValidate = JSONValidator.from("[1}").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_num1() throws Throwable {
boolean isValidate = JSONValidator.from("-a").validate();
Reported by PMD.
Line: 42
@Test
public void validate_test_num1() throws Throwable {
boolean isValidate = JSONValidator.from("-a").validate();
assertFalse(isValidate);
}
@Test
public void validate_test_num2() throws Throwable {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_scanFieldFloat.java
34 issues
Line: 10
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.JSONScanner;
public class JSONScannerTest_scanFieldFloat extends TestCase {
public void test_0() throws Exception {
String text = "{\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
Reported by PMD.
Line: 12
public class JSONScannerTest_scanFieldFloat extends TestCase {
public void test_0() throws Exception {
String text = "{\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
Reported by PMD.
Line: 15
public void test_0() throws Exception {
String text = "{\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
@SuppressWarnings("resource")
public void test_isBlank() throws Exception {
String text = " {\"value\":1.0}";
Reported by PMD.
Line: 18
Assert.assertTrue(1F == obj.getValue());
}
@SuppressWarnings("resource")
public void test_isBlank() throws Exception {
String text = " {\"value\":1.0}";
Assert.assertTrue(!new JSONScanner(text).isBlankInput());
}
Reported by PMD.
Line: 24
Assert.assertTrue(!new JSONScanner(text).isBlankInput());
}
public void test_1() throws Exception {
String text = "{\"value\":\"1\"}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
Reported by PMD.
Line: 27
public void test_1() throws Exception {
String text = "{\"value\":\"1\"}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
public void test_2() throws Exception {
String text = "{\"f1\":2,\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Reported by PMD.
Line: 30
Assert.assertTrue(1F == obj.getValue());
}
public void test_2() throws Exception {
String text = "{\"f1\":2,\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
Reported by PMD.
Line: 33
public void test_2() throws Exception {
String text = "{\"f1\":2,\"value\":1.0}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1F == obj.getValue());
}
public void test_3() throws Exception {
String text = "{\"value\":1.01}";
VO obj = JSON.parseObject(text, VO.class);
Reported by PMD.
Line: 36
Assert.assertTrue(1F == obj.getValue());
}
public void test_3() throws Exception {
String text = "{\"value\":1.01}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1.01F == obj.getValue());
}
Reported by PMD.
Line: 39
public void test_3() throws Exception {
String text = "{\"value\":1.01}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertTrue(1.01F == obj.getValue());
}
public void test_4() throws Exception {
String text = "{\"value\":1.}";
VO obj = JSON.parseObject(text, VO.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_field_access_filter_compare_string.java
34 issues
Line: 137
JSONArray array = JSON.parseArray("[{\"id\":\"1\",\"name\":\"a\"},{\"id\":\"2\",\"name\":\"b\"}]");
Object result = path.eval(array);
System.out.println(result);
}
public static class Entity {
private Integer id;
Reported by PMD.
Line: 16
public class JSONPath_field_access_filter_compare_string extends TestCase {
public void test_list_eq() throws Exception {
JSONPath path = new JSONPath("$[?(@.name = 'ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
Reported by PMD.
Line: 20
JSONPath path = new JSONPath("$[?(@.name = 'ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, null));
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Reported by PMD.
Line: 21
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, null));
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Reported by PMD.
Line: 26
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_x() throws Exception {
JSONPath path = new JSONPath("$[?(name = 'ljw2083')]");
Reported by PMD.
Line: 27
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_x() throws Exception {
JSONPath path = new JSONPath("$[?(name = 'ljw2083')]");
Reported by PMD.
Line: 30
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_x() throws Exception {
JSONPath path = new JSONPath("$[?(name = 'ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
Reported by PMD.
Line: 40
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_null() throws Exception {
JSONPath path = new JSONPath("$[?(@.name = null)]");
Reported by PMD.
Line: 41
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_null() throws Exception {
JSONPath path = new JSONPath("$[?(@.name = null)]");
Reported by PMD.
Line: 44
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_eq_null() throws Exception {
JSONPath path = new JSONPath("$[?(@.name = null)]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
Reported by PMD.