The following issues were found
src/test/java/com/alibaba/json/bvt/support/hsf/HSFJSONUtilsTest_0.java
72 issues
Line: 143
" \t\t}]\n" +
" ]\n" +
"]";
System.out.println(json);
Object[] values = HSFJSONUtils.parseInvocationArguments(json, methodLocator);
assertNotNull(values);
assertEquals(1, values.length);
List list = (List) values[0];
Reported by PMD.
Line: 198
Object[] values = HSFJSONUtils.parseInvocationArguments(json, methodLocator);
}
long millis = System.currentTimeMillis() - start;
System.out.println("millis : " + millis);
}
public static class Service {
public void f1() {
Reported by PMD.
Line: 11
import java.util.List;
public class HSFJSONUtilsTest_0 extends TestCase {
private Method method_f2;
private Method method_f3;
private Method method_f4;
private Method method_f5;
private MethodLocator methodLocator;
Reported by PMD.
Line: 12
public class HSFJSONUtilsTest_0 extends TestCase {
private Method method_f2;
private Method method_f3;
private Method method_f4;
private Method method_f5;
private MethodLocator methodLocator;
protected void setUp() throws Exception {
Reported by PMD.
Line: 13
public class HSFJSONUtilsTest_0 extends TestCase {
private Method method_f2;
private Method method_f3;
private Method method_f4;
private Method method_f5;
private MethodLocator methodLocator;
protected void setUp() throws Exception {
method_f2 = Service.class.getMethod("f2", String.class, Model.class);
Reported by PMD.
Line: 14
private Method method_f2;
private Method method_f3;
private Method method_f4;
private Method method_f5;
private MethodLocator methodLocator;
protected void setUp() throws Exception {
method_f2 = Service.class.getMethod("f2", String.class, Model.class);
method_f3 = Service.class.getMethod("f3", String.class, List.class);
Reported by PMD.
Line: 15
private Method method_f3;
private Method method_f4;
private Method method_f5;
private MethodLocator methodLocator;
protected void setUp() throws Exception {
method_f2 = Service.class.getMethod("f2", String.class, Model.class);
method_f3 = Service.class.getMethod("f3", String.class, List.class);
method_f4 = Service.class.getMethod("f4", List.class);
Reported by PMD.
Line: 17
private Method method_f5;
private MethodLocator methodLocator;
protected void setUp() throws Exception {
method_f2 = Service.class.getMethod("f2", String.class, Model.class);
method_f3 = Service.class.getMethod("f3", String.class, List.class);
method_f4 = Service.class.getMethod("f4", List.class);
method_f5 = Service.class.getMethod("f4", User[].class);
Reported by PMD.
Line: 29
return method_f2;
}
if (types.length == 1 && types[0].equals("java.util.List")) {
return method_f4;
}
if (types.length == 1 && types[0].equals("com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_0.User[]")) {
return method_f5;
Reported by PMD.
Line: 33
return method_f4;
}
if (types.length == 1 && types[0].equals("com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_0.User[]")) {
return method_f5;
}
if (types[1].equals("java.util.List")) {
return method_f3;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/util/AntiCollisionHashMapTest.java
71 issues
Line: 15
import java.util.Map;
public class AntiCollisionHashMapTest extends TestCase {
public void test_0() throws Exception {
AntiCollisionHashMap m = new AntiCollisionHashMap(3, 0.75f);
for (int i = 0; i < 100; ++i) {
m.put(i, i);
}
Reported by PMD.
Line: 15
import java.util.Map;
public class AntiCollisionHashMapTest extends TestCase {
public void test_0() throws Exception {
AntiCollisionHashMap m = new AntiCollisionHashMap(3, 0.75f);
for (int i = 0; i < 100; ++i) {
m.put(i, i);
}
Reported by PMD.
Line: 15
import java.util.Map;
public class AntiCollisionHashMapTest extends TestCase {
public void test_0() throws Exception {
AntiCollisionHashMap m = new AntiCollisionHashMap(3, 0.75f);
for (int i = 0; i < 100; ++i) {
m.put(i, i);
}
Reported by PMD.
Line: 15
import java.util.Map;
public class AntiCollisionHashMapTest extends TestCase {
public void test_0() throws Exception {
AntiCollisionHashMap m = new AntiCollisionHashMap(3, 0.75f);
for (int i = 0; i < 100; ++i) {
m.put(i, i);
}
Reported by PMD.
Line: 23
}
AntiCollisionHashMap m2 = new AntiCollisionHashMap(m);
assertEquals(m.size(), m2.size());
AntiCollisionHashMap m3 = new AntiCollisionHashMap(3, 0.75f);
m3.putAll(m);
assertEquals(m.size(), m2.size());
Reported by PMD.
Line: 27
AntiCollisionHashMap m3 = new AntiCollisionHashMap(3, 0.75f);
m3.putAll(m);
assertEquals(m.size(), m2.size());
AntiCollisionHashMap m4 = (AntiCollisionHashMap) m.clone();
m4.hashCode();
m4.size();
m4.isEmpty();
Reported by PMD.
Line: 30
assertEquals(m.size(), m2.size());
AntiCollisionHashMap m4 = (AntiCollisionHashMap) m.clone();
m4.hashCode();
m4.size();
m4.isEmpty();
m4.values().iterator();
m4.keySet().iterator();
m4.values().contains(1);
Reported by PMD.
Line: 31
AntiCollisionHashMap m4 = (AntiCollisionHashMap) m.clone();
m4.hashCode();
m4.size();
m4.isEmpty();
m4.values().iterator();
m4.keySet().iterator();
m4.values().contains(1);
m4.values().contains(null);
Reported by PMD.
Line: 32
AntiCollisionHashMap m4 = (AntiCollisionHashMap) m.clone();
m4.hashCode();
m4.size();
m4.isEmpty();
m4.values().iterator();
m4.keySet().iterator();
m4.values().contains(1);
m4.values().contains(null);
m4.values().iterator().next();
Reported by PMD.
Line: 33
m4.hashCode();
m4.size();
m4.isEmpty();
m4.values().iterator();
m4.keySet().iterator();
m4.values().contains(1);
m4.values().contains(null);
m4.values().iterator().next();
m4.values().remove(1);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2700/Issue2784.java
70 issues
Line: 12
import java.util.Date;
public class Issue2784 extends TestCase {
public void test_for_issue() throws Exception {
Model m = new Model();
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
Reported by PMD.
Line: 12
import java.util.Date;
public class Issue2784 extends TestCase {
public void test_for_issue() throws Exception {
Model m = new Model();
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
Reported by PMD.
Line: 14
public class Issue2784 extends TestCase {
public void test_for_issue() throws Exception {
Model m = new Model();
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Reported by PMD.
Line: 16
Model m = new Model();
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
Reported by PMD.
Line: 17
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
}
Reported by PMD.
Line: 17
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
}
Reported by PMD.
Line: 17
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
}
Reported by PMD.
Line: 17
m.time = java.time.LocalDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"time\":"
+ m.time.atZone(JSON.defaultTimeZone.toZoneId()).toInstant().toEpochMilli()
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
}
Reported by PMD.
Line: 21
+ "}", str);
Model m1 = JSON.parseObject(str, Model.class);
assertEquals(m.time, m1.time);
}
public void test_for_issue_1() throws Exception {
Model m = new Model();
m.ztime = ZonedDateTime.now();
Reported by PMD.
Line: 24
assertEquals(m.time, m1.time);
}
public void test_for_issue_1() throws Exception {
Model m = new Model();
m.ztime = ZonedDateTime.now();
String str = JSON.toJSONString(m);
assertEquals("{\"ztime\":"
+ m.ztime.toInstant().toEpochMilli()
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/StackTraceElementDeserializer.java
67 issues
Line: 12
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
public class StackTraceElementDeserializer implements ObjectDeserializer {
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
Reported by PMD.
Line: 12
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
public class StackTraceElementDeserializer implements ObjectDeserializer {
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
Reported by PMD.
Line: 12
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
public class StackTraceElementDeserializer implements ObjectDeserializer {
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
Line: 17
public final static StackTraceElementDeserializer instance = new StackTraceElementDeserializer();
@SuppressWarnings({ "unchecked", "unused" })
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
return null;
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/Base64.java
67 issues
Line: 11
* @author Mikael Grev Date: 2004-aug-02 Time: 11:31:11
* @deprecated internal api, don't use.
*/
public class Base64 {
public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 11
* @author Mikael Grev Date: 2004-aug-02 Time: 11:31:11
* @deprecated internal api, don't use.
*/
public class Base64 {
public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 11
* @author Mikael Grev Date: 2004-aug-02 Time: 11:31:11
* @deprecated internal api, don't use.
*/
public class Base64 {
public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 17
public static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
for (int i = 0, iS = CA.length; i < iS; i++)
IA[CA[i]] = i;
IA['='] = 0;
}
/**
Reported by PMD.
Line: 33
* @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(char[] chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
Reported by PMD.
Line: 33
* @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(char[] chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
Reported by PMD.
Line: 33
* @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(char[] chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
Reported by PMD.
Line: 33
* @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(char[] chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
Reported by PMD.
Line: 59
// Decode all but the last 0 - 2 bytes.
int d = 0;
for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
// Assemble three bytes into an int from four "valid" characters.
int i = IA[chars[sIx++]] << 18 | IA[chars[sIx++]] << 12 | IA[chars[sIx++]] << 6 | IA[chars[sIx++]];
// Add the bytes
bytes[d++] = (byte) (i >> 16);
Reported by PMD.
Line: 69
bytes[d++] = (byte) i;
// If line separator, jump over it.
if (sepCnt > 0 && ++cc == 19) {
sIx += 2;
cc = 0;
}
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/FieldSerializer.java
67 issues
Line: 32
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class FieldSerializer implements Comparable<FieldSerializer> {
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
Reported by PMD.
Line: 32
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class FieldSerializer implements Comparable<FieldSerializer> {
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
Reported by PMD.
Line: 32
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class FieldSerializer implements Comparable<FieldSerializer> {
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
Reported by PMD.
Line: 34
*/
public class FieldSerializer implements Comparable<FieldSerializer> {
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
Reported by PMD.
Line: 35
public class FieldSerializer implements Comparable<FieldSerializer> {
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
Reported by PMD.
Line: 36
public final FieldInfo fieldInfo;
protected final boolean writeNull;
protected int features;
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
Reported by PMD.
Line: 38
protected final boolean writeNull;
protected int features;
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
protected BeanContext fieldContext;
Reported by PMD.
Line: 39
protected int features;
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
protected BeanContext fieldContext;
private String format;
Reported by PMD.
Line: 40
private final String double_quoted_fieldPrefix;
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
protected BeanContext fieldContext;
private String format;
protected boolean writeEnumUsingToString = false;
Reported by PMD.
Line: 42
private String single_quoted_fieldPrefix;
private String un_quoted_fieldPrefix;
protected BeanContext fieldContext;
private String format;
protected boolean writeEnumUsingToString = false;
protected boolean writeEnumUsingName = false;
protected boolean disableCircularReferenceDetect = false;
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/MiscCodec.java
67 issues
Line: 199
}
@SuppressWarnings("unchecked")
public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
JSONLexer lexer = parser.lexer;
if (clazz == InetSocketAddress.class) {
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
Reported by PMD.
Line: 236
continue;
}
break;
}
parser.accept(JSONToken.RBRACE);
return (T) new InetSocketAddress(address, port);
Reported by PMD.
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.serializer;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
Reported by PMD.
Line: 56
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
Reported by PMD.
Line: 56
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
Reported by PMD.
Line: 56
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
Reported by PMD.
Line: 56
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
Reported by PMD.
Line: 57
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
static {
Reported by PMD.
Line: 57
* @author wenshao[szujobs@hotmail.com]
*/
public class MiscCodec implements ObjectSerializer, ObjectDeserializer {
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
static {
Reported by PMD.
Line: 60
private static boolean FILE_RELATIVE_PATH_SUPPORT = false;
public final static MiscCodec instance = new MiscCodec();
private static Method method_paths_get;
private static boolean method_paths_get_error = false;
static {
FILE_RELATIVE_PATH_SUPPORT = "true".equals(IOUtils.getStringProperty("fastjson.deserializer.fileRelativePathSupport"));
}
Reported by PMD.
src/test/java/com/alibaba/json/test/TestASM.java
66 issues
Line: 101
mw.visitEnd();
byte[] code = cw.toByteArray();
FileOutputStream fos = new FileOutputStream("Example.class");
fos.write(code);
fos.close();
MyClassLoader loader = new MyClassLoader(com.alibaba.fastjson.serializer.ObjectSerializer.class.getClassLoader());
Reported by PMD.
Line: 50
public void test_asm() throws Exception {
String text = JSON.toJSONString(EishayEncode.mediaContent);
System.out.println(text);
}
public void test_1() throws Exception {
ClassWriter cw = new ClassWriter();
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "DateSerializer", "java/lang/Object", new String[] { "com/alibaba/fastjson/serializer/ObjectSerializer" });
Reported by PMD.
Line: 116
Entity obj = new Entity();
methods[0].invoke(instance, serializer, obj);
System.out.println(out.toString());
}
String getCastType(Class<?> returnType) {
if (returnType.isPrimitive()) {
return getWrapperType(returnType);
Reported by PMD.
Line: 239
public static class Foo {
public void execute() {
System.out.println("Hello World");
}
}
}
Reported by PMD.
Line: 17
import com.alibaba.fastjson.serializer.SerializeWriter;
import com.alibaba.json.test.benchmark.encode.EishayEncode;
public class TestASM extends TestCase implements Opcodes {
// public void test_0() throws Exception {
//
// ClassWriter cw = new ClassWriter(0);
// cw.visit(V1_1, ACC_PUBLIC, "Example", null, "java/lang/Object", null);
Reported by PMD.
Line: 17
import com.alibaba.fastjson.serializer.SerializeWriter;
import com.alibaba.json.test.benchmark.encode.EishayEncode;
public class TestASM extends TestCase implements Opcodes {
// public void test_0() throws Exception {
//
// ClassWriter cw = new ClassWriter(0);
// cw.visit(V1_1, ACC_PUBLIC, "Example", null, "java/lang/Object", null);
Reported by PMD.
Line: 48
// exampleClass.getMethods()[0].invoke(null, new Object[] { null });
// }
public void test_asm() throws Exception {
String text = JSON.toJSONString(EishayEncode.mediaContent);
System.out.println(text);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 48
// exampleClass.getMethods()[0].invoke(null, new Object[] { null });
// }
public void test_asm() throws Exception {
String text = JSON.toJSONString(EishayEncode.mediaContent);
System.out.println(text);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 53
System.out.println(text);
}
public void test_1() throws Exception {
ClassWriter cw = new ClassWriter();
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "DateSerializer", "java/lang/Object", new String[] { "com/alibaba/fastjson/serializer/ObjectSerializer" });
MethodVisitor mw = new MethodWriter(cw, ACC_PUBLIC, "<init>", "()V", null, null);
mw.visitVarInsn(ALOAD, 0);
Reported by PMD.
Line: 53
System.out.println(text);
}
public void test_1() throws Exception {
ClassWriter cw = new ClassWriter();
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "DateSerializer", "java/lang/Object", new String[] { "com/alibaba/fastjson/serializer/ObjectSerializer" });
MethodVisitor mw = new MethodWriter(cw, ACC_PUBLIC, "<init>", "()V", null, null);
mw.visitVarInsn(ALOAD, 0);
Reported by PMD.
src/main/java/com/alibaba/fastjson/util/RyuDouble.java
62 issues
Line: 22
/**
* An implementation of Ryu for double.
*/
public final class RyuDouble {
private static final int[][] POW5_SPLIT = new int[326][4];
private static final int[][] POW5_INV_SPLIT = new int[291][4];
static {
BigInteger mask = BigInteger.ONE.shiftLeft(31).subtract(BigInteger.ONE);
Reported by PMD.
Line: 22
/**
* An implementation of Ryu for double.
*/
public final class RyuDouble {
private static final int[][] POW5_SPLIT = new int[326][4];
private static final int[][] POW5_INV_SPLIT = new int[291][4];
static {
BigInteger mask = BigInteger.ONE.shiftLeft(31).subtract(BigInteger.ONE);
Reported by PMD.
Line: 22
/**
* An implementation of Ryu for double.
*/
public final class RyuDouble {
private static final int[][] POW5_SPLIT = new int[326][4];
private static final int[][] POW5_INV_SPLIT = new int[291][4];
static {
BigInteger mask = BigInteger.ONE.shiftLeft(31).subtract(BigInteger.ONE);
Reported by PMD.
Line: 22
/**
* An implementation of Ryu for double.
*/
public final class RyuDouble {
private static final int[][] POW5_SPLIT = new int[326][4];
private static final int[][] POW5_INV_SPLIT = new int[291][4];
static {
BigInteger mask = BigInteger.ONE.shiftLeft(31).subtract(BigInteger.ONE);
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
Line: 74
return new String(result, 0, len);
}
public static int toString(double value, char[] result, int off) {
final long DOUBLE_MANTISSA_MASK = 4503599627370495L; // (1L << 52) - 1;
final int DOUBLE_EXPONENT_MASK = 2047; // (1 << 11) - 1;
final int DOUBLE_EXPONENT_BIAS = 1023; // (1 << (11 - 1)) - 1;
final long LOG10_5_NUMERATOR = 6989700L; // (long) (10000000L * Math.log10(5));
final long LOG10_2_NUMERATOR = 3010299L; // (long) (10000000L * Math.log10(2));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/DefaultExtJSONParser_parseArray.java
60 issues
Line: 68
public void test_5() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1,2,3,null]");
Object[] array = parser.parseArray(new Type[] { Integer.class, BigDecimal.class, Long.class, String.class });
Assert.assertEquals(new Integer(1), array[0]);
Assert.assertEquals(new BigDecimal("2"), array[1]);
Assert.assertEquals(new Long(3), array[2]);
Assert.assertEquals(null, array[3]);
}
Reported by PMD.
Line: 70
Object[] array = parser.parseArray(new Type[] { Integer.class, BigDecimal.class, Long.class, String.class });
Assert.assertEquals(new Integer(1), array[0]);
Assert.assertEquals(new BigDecimal("2"), array[1]);
Assert.assertEquals(new Long(3), array[2]);
Assert.assertEquals(null, array[3]);
}
public void test_error() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{}");
Reported by PMD.
Line: 137
DefaultJSONParser parser = new DefaultJSONParser("[1,2,3]");
Object[] array = parser.parseArray(new Type[] { Integer[].class });
Integer[] values = (Integer[]) array[0];
Assert.assertEquals(new Integer(1), values[0]);
Assert.assertEquals(new Integer(2), values[1]);
Assert.assertEquals(new Integer(3), values[2]);
}
public void test_11() throws Exception {
Reported by PMD.
Line: 138
Object[] array = parser.parseArray(new Type[] { Integer[].class });
Integer[] values = (Integer[]) array[0];
Assert.assertEquals(new Integer(1), values[0]);
Assert.assertEquals(new Integer(2), values[1]);
Assert.assertEquals(new Integer(3), values[2]);
}
public void test_11() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1]");
Reported by PMD.
Line: 139
Integer[] values = (Integer[]) array[0];
Assert.assertEquals(new Integer(1), values[0]);
Assert.assertEquals(new Integer(2), values[1]);
Assert.assertEquals(new Integer(3), values[2]);
}
public void test_11() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1]");
Object[] array = parser.parseArray(new Type[] { String.class });
Reported by PMD.
Line: 151
public void test_12() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("['1']");
Object[] array = parser.parseArray(new Type[] { int.class });
Assert.assertEquals(new Integer(1), array[0]);
}
public void test_13() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("['1']");
Object[] array = parser.parseArray(new Type[] { Integer.class });
Reported by PMD.
Line: 157
public void test_13() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("['1']");
Object[] array = parser.parseArray(new Type[] { Integer.class });
Assert.assertEquals(new Integer(1), array[0]);
}
public void test_14() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[]");
Object[] array = parser.parseArray(new Type[] {});
Reported by PMD.
Line: 180
parser.config(Feature.AllowISO8601DateFormat, false);
Object[] array = parser.parseArray(new Type[] { new TypeReference<List<Integer>>() {
}.getType() });
Assert.assertEquals(new Integer(1), ((List<Integer>) (array[0])).get(0));
}
public void test_17() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[]");
Object[] array = parser.parseArray(new Type[] { Integer[].class });
Reported by PMD.
Line: 21
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.JSONToken;
public class DefaultExtJSONParser_parseArray extends TestCase {
public void test_0() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1,2,,,3]");
List list = new ArrayList();
parser.parseArray(int.class, list);
Reported by PMD.
Line: 23
public class DefaultExtJSONParser_parseArray extends TestCase {
public void test_0() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1,2,,,3]");
List list = new ArrayList();
parser.parseArray(int.class, list);
Assert.assertEquals("[1, 2, 3]", list.toString());
}
Reported by PMD.