The following issues were found
src/main/java/com/alibaba/fastjson/serializer/SerializeWriter.java
225 issues
Line: 266
* @param off the start offset in the data
* @param len the number of chars that are written
*/
public void write(char c[], int off, int len) {
if (off < 0 //
|| off > c.length //
|| len < 0 //
|| off + len > c.length //
|| off + len < 0) {
Reported by PMD.
Line: 266
* @param off the start offset in the data
* @param len the number of chars that are written
*/
public void write(char c[], int off, int len) {
if (off < 0 //
|| off > c.length //
|| len < 0 //
|| off + len > c.length //
|| off + len < 0) {
Reported by PMD.
Line: 345
* @param off Offset from which to start reading characters
* @param len Number of characters to be written
*/
public void write(String str, int off, int len) {
int newcount = count + len;
if (newcount > buf.length) {
if (writer == null) {
expandCapacity(newcount);
} else {
Reported by PMD.
Line: 345
* @param off Offset from which to start reading characters
* @param len Number of characters to be written
*/
public void write(String str, int off, int len) {
int newcount = count + len;
if (newcount > buf.length) {
if (writer == null) {
expandCapacity(newcount);
} else {
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.util.IOUtils;
import com.alibaba.fastjson.util.RyuDouble;
Reported by PMD.
Line: 36
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class SerializeWriter extends Writer {
private final static ThreadLocal<char[]> bufLocal = new ThreadLocal<char[]>();
private final static ThreadLocal<byte[]> bytesBufLocal = new ThreadLocal<byte[]>();
private static final char[] VALUE_TRUE = ":true".toCharArray();
private static final char[] VALUE_FALSE = ":false".toCharArray();
private static int BUFFER_THRESHOLD = 1024 * 128;
Reported by PMD.
Line: 36
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class SerializeWriter extends Writer {
private final static ThreadLocal<char[]> bufLocal = new ThreadLocal<char[]>();
private final static ThreadLocal<byte[]> bytesBufLocal = new ThreadLocal<byte[]>();
private static final char[] VALUE_TRUE = ":true".toCharArray();
private static final char[] VALUE_FALSE = ":false".toCharArray();
private static int BUFFER_THRESHOLD = 1024 * 128;
Reported by PMD.
Line: 36
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class SerializeWriter extends Writer {
private final static ThreadLocal<char[]> bufLocal = new ThreadLocal<char[]>();
private final static ThreadLocal<byte[]> bytesBufLocal = new ThreadLocal<byte[]>();
private static final char[] VALUE_TRUE = ":true".toCharArray();
private static final char[] VALUE_FALSE = ":false".toCharArray();
private static int BUFFER_THRESHOLD = 1024 * 128;
Reported by PMD.
Line: 36
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class SerializeWriter extends Writer {
private final static ThreadLocal<char[]> bufLocal = new ThreadLocal<char[]>();
private final static ThreadLocal<byte[]> bytesBufLocal = new ThreadLocal<byte[]>();
private static final char[] VALUE_TRUE = ":true".toCharArray();
private static final char[] VALUE_FALSE = ":false".toCharArray();
private static int BUFFER_THRESHOLD = 1024 * 128;
Reported by PMD.
Line: 36
/**
* @author wenshao[szujobs@hotmail.com]
*/
public final class SerializeWriter extends Writer {
private final static ThreadLocal<char[]> bufLocal = new ThreadLocal<char[]>();
private final static ThreadLocal<byte[]> bytesBufLocal = new ThreadLocal<byte[]>();
private static final char[] VALUE_TRUE = ":true".toCharArray();
private static final char[] VALUE_FALSE = ":false".toCharArray();
private static int BUFFER_THRESHOLD = 1024 * 128;
Reported by PMD.
src/test/java/com/alibaba/fastjson/parser/JSONScannerTest.java
213 issues
Line: 20
package com.alibaba.fastjson.parser;
import com.alibaba.fastjson.parser.JSONScanner;
import com.diffblue.deeptestutils.Reflector;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Reported by PMD.
Line: 34
import java.util.Locale;
public class JSONScannerTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
/* testedClasses: JSONScanner */
Reported by PMD.
Line: 34
import java.util.Locale;
public class JSONScannerTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
/* testedClasses: JSONScanner */
Reported by PMD.
Line: 57
char[] dest = { '\u0000' };
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Reported by PMD.
Line: 58
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
Reported by PMD.
Line: 58
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
Reported by PMD.
Line: 59
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
Reported by PMD.
Line: 60
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
}
Reported by PMD.
Line: 99
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
Reported by PMD.
Line: 100
// Act
Class<?> c = Reflector.forName("com.alibaba.fastjson.parser.JSONScanner");
Method m = c.getDeclaredMethod("charArrayCompare", Reflector.forName("java.lang.String"), Reflector.forName("int"), Reflector.forName("char []"));
m.setAccessible(true);
boolean retval = (Boolean)m.invoke(null, src, offset, dest);
// Assert result
Assert.assertEquals(false, retval);
Reported by PMD.
src/test/java/com/alibaba/json/test/Base64.java
199 issues
Line: 73
* Time: 11:31:11
*/
public class Base64
{
private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
private static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 73
* Time: 11:31:11
*/
public class Base64
{
private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
private static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 73
* Time: 11:31:11
*/
public class Base64
{
private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
private static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
Reported by PMD.
Line: 74
*/
public class Base64
{
private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
private static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
for (int i = 0, iS = CA.length; i < iS; i++)
Reported by PMD.
Line: 79
private 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: 95
* little faster.
* @return A BASE64 encoded array. Never <code>null</code>.
*/
public final static char[] encodeToChar(byte[] bytes, boolean lineSep)
{
// Check special case
int bytes_len = bytes != null ? bytes.length : 0;
if (bytes_len == 0)
return new char[0];
Reported by PMD.
Line: 95
* little faster.
* @return A BASE64 encoded array. Never <code>null</code>.
*/
public final static char[] encodeToChar(byte[] bytes, boolean lineSep)
{
// Check special case
int bytes_len = bytes != null ? bytes.length : 0;
if (bytes_len == 0)
return new char[0];
Reported by PMD.
Line: 108
char[] chars = new char[chars_len];
// Encode even 24-bits
for (int s = 0, d = 0, cc = 0; s < eLen;) {
// Copy next three bytes into lower 24 bits of int, paying attension to sign.
int i = (bytes[s++] & 0xff) << 16 | (bytes[s++] & 0xff) << 8 | (bytes[s++] & 0xff);
// Encode the int into four chars
chars[d++] = CA[(i >>> 18) & 0x3f];
Reported by PMD.
Line: 110
// Encode even 24-bits
for (int s = 0, d = 0, cc = 0; s < eLen;) {
// Copy next three bytes into lower 24 bits of int, paying attension to sign.
int i = (bytes[s++] & 0xff) << 16 | (bytes[s++] & 0xff) << 8 | (bytes[s++] & 0xff);
// Encode the int into four chars
chars[d++] = CA[(i >>> 18) & 0x3f];
chars[d++] = CA[(i >>> 12) & 0x3f];
chars[d++] = CA[(i >>> 6) & 0x3f];
Reported by PMD.
Line: 110
// Encode even 24-bits
for (int s = 0, d = 0, cc = 0; s < eLen;) {
// Copy next three bytes into lower 24 bits of int, paying attension to sign.
int i = (bytes[s++] & 0xff) << 16 | (bytes[s++] & 0xff) << 8 | (bytes[s++] & 0xff);
// Encode the int into four chars
chars[d++] = CA[(i >>> 18) & 0x3f];
chars[d++] = CA[(i >>> 12) & 0x3f];
chars[d++] = CA[(i >>> 6) & 0x3f];
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/ParserConfig.java
184 issues
Line: 361
}
public ParserConfig(boolean fieldBase){
this(null, null, fieldBase);
}
public ParserConfig(ClassLoader parentClassLoader){
this(null, parentClassLoader, false);
}
Reported by PMD.
Line: 365
}
public ParserConfig(ClassLoader parentClassLoader){
this(null, parentClassLoader, false);
}
public ParserConfig(ASMDeserializerFactory asmFactory){
this(asmFactory, null, false);
}
Reported by PMD.
Line: 369
}
public ParserConfig(ASMDeserializerFactory asmFactory){
this(asmFactory, null, false);
}
private ParserConfig(ASMDeserializerFactory asmFactory, ClassLoader parentClassLoader, boolean fieldBased){
this.fieldBased = fieldBased;
if (asmFactory == null && !ASMUtils.IS_ANDROID) {
Reported by PMD.
Line: 487
deserializers.put(JSONPObject.class, new JSONPDeserializer());
}
private static String[] splitItemsFormProperty(final String property ){
if (property != null && property.length() > 0) {
return property.split(",");
}
return null;
}
Reported by PMD.
Line: 372
this(asmFactory, null, false);
}
private ParserConfig(ASMDeserializerFactory asmFactory, ClassLoader parentClassLoader, boolean fieldBased){
this.fieldBased = fieldBased;
if (asmFactory == null && !ASMUtils.IS_ANDROID) {
try {
if (parentClassLoader == null) {
asmFactory = new ASMDeserializerFactory(new ASMClassLoader());
Reported by PMD.
Line: 372
this(asmFactory, null, false);
}
private ParserConfig(ASMDeserializerFactory asmFactory, ClassLoader parentClassLoader, boolean fieldBased){
this.fieldBased = fieldBased;
if (asmFactory == null && !ASMUtils.IS_ANDROID) {
try {
if (parentClassLoader == null) {
asmFactory = new ASMDeserializerFactory(new ASMClassLoader());
Reported by PMD.
Line: 620
return JavaObjectDeserializer.instance;
}
public ObjectDeserializer getDeserializer(Class<?> clazz, Type type) {
ObjectDeserializer deserializer = get(type);
if (deserializer == null && type instanceof ParameterizedTypeImpl) {
Type innerType = TypeReference.intern((ParameterizedTypeImpl) type);
deserializer = get(innerType);
}
Reported by PMD.
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.parser;
import java.io.*;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.lang.reflect.*;
Reported by PMD.
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.parser;
import java.io.*;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.lang.reflect.*;
Reported by PMD.
Line: 67
/**
* @author wenshao[szujobs@hotmail.com]
*/
public class ParserConfig {
public static final String DENY_PROPERTY_INTERNAL = "fastjson.parser.deny.internal";
public static final String DENY_PROPERTY = "fastjson.parser.deny";
public static final String AUTOTYPE_ACCEPT = "fastjson.parser.autoTypeAccept";
public static final String AUTOTYPE_SUPPORT_PROPERTY = "fastjson.parser.autoTypeSupport";
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/deserializer/ASMDeserializerFactory.java
182 issues
Line: 1
package com.alibaba.fastjson.parser.deserializer;
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
Reported by PMD.
Line: 1
package com.alibaba.fastjson.parser.deserializer;
import static com.alibaba.fastjson.util.ASMUtils.desc;
import static com.alibaba.fastjson.util.ASMUtils.type;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 42
import com.alibaba.fastjson.parser.SymbolTable;
import com.alibaba.fastjson.util.*;
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
Reported by PMD.
Line: 44
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
final static String JSONLexerBase = type(JSONLexerBase.class);
Reported by PMD.
Line: 45
public class ASMDeserializerFactory implements Opcodes {
public final ASMClassLoader classLoader;
protected final AtomicLong seed = new AtomicLong();
final static String DefaultJSONParser = type(DefaultJSONParser.class);
final static String JSONLexerBase = type(JSONLexerBase.class);
public ASMDeserializerFactory(ClassLoader parentClassLoader){
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/JodaCodec.java
173 issues
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
Line: 204
return null;
}
protected LocalDateTime parseDateTime(String text, DateTimeFormatter formatter) {
if (formatter == null) {
if (text.length() == 19) {
char c4 = text.charAt(4);
char c7 = text.charAt(7);
char c10 = text.charAt(10);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/number/NumberValueTest_error_13.java
166 issues
Line: 379
public static class Model {
public byte v0;
public short v1;
public int v2;
public long v3;
public Byte v4;
public Short v5;
Reported by PMD.
Line: 372
"}");
for(String key : object.keySet()) {
System.out.println("key = " + key);
System.out.println("vaue = " + object.getJSONObject(key).getIntValue("max_value"));
}
}
public static class Model {
Reported by PMD.
Line: 373
for(String key : object.keySet()) {
System.out.println("key = " + key);
System.out.println("vaue = " + object.getJSONObject(key).getIntValue("max_value"));
}
}
public static class Model {
public byte v0;
Reported by PMD.
Line: 1
package com.alibaba.json.bvt.parser.number;
import com.alibaba.fastjson.*;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import org.junit.Assert;
import java.math.BigDecimal;
import java.math.BigInteger;
Reported by PMD.
Line: 13
import java.sql.Timestamp;
import java.util.concurrent.TimeUnit;
public class NumberValueTest_error_13 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"v0\":49e99999999}", Model.class);
Reported by PMD.
Line: 13
import java.sql.Timestamp;
import java.util.concurrent.TimeUnit;
public class NumberValueTest_error_13 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"v0\":49e99999999}", Model.class);
Reported by PMD.
Line: 15
public class NumberValueTest_error_13 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"v0\":49e99999999}", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 15
public class NumberValueTest_error_13 extends TestCase {
public void test_0() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"v0\":49e99999999}", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 22
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
assertTrue(error.getCause() instanceof ArithmeticException);
}
public void test_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 23
error = ex;
}
assertNotNull(error);
assertTrue(error.getCause() instanceof ArithmeticException);
}
public void test_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/SerializeConfig.java
164 issues
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.serializer;
import com.alibaba.fastjson.*;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.parser.deserializer.Jdk8DateCodec;
Reported by PMD.
Line: 51
*
* @author wenshao[szujobs@hotmail.com]
*/
public class SerializeConfig {
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
Reported by PMD.
Line: 51
*
* @author wenshao[szujobs@hotmail.com]
*/
public class SerializeConfig {
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
Reported by PMD.
Line: 51
*
* @author wenshao[szujobs@hotmail.com]
*/
public class SerializeConfig {
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
Reported by PMD.
Line: 51
*
* @author wenshao[szujobs@hotmail.com]
*/
public class SerializeConfig {
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
Reported by PMD.
Line: 51
*
* @author wenshao[szujobs@hotmail.com]
*/
public class SerializeConfig {
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
Reported by PMD.
Line: 55
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
private static boolean oracleJdbcError = false;
private static boolean springfoxError = false;
private static boolean guavaError = false;
Reported by PMD.
Line: 56
public final static SerializeConfig globalInstance = new SerializeConfig();
private static boolean awtError = false;
private static boolean jdk8Error = false;
private static boolean oracleJdbcError = false;
private static boolean springfoxError = false;
private static boolean guavaError = false;
private static boolean jodaError = false;
Reported by PMD.
Line: 57
private static boolean awtError = false;
private static boolean jdk8Error = false;
private static boolean oracleJdbcError = false;
private static boolean springfoxError = false;
private static boolean guavaError = false;
private static boolean jodaError = false;
Reported by PMD.
Line: 58
private static boolean awtError = false;
private static boolean jdk8Error = false;
private static boolean oracleJdbcError = false;
private static boolean springfoxError = false;
private static boolean guavaError = false;
private static boolean jodaError = false;
private boolean asm = !ASMUtils.IS_ANDROID;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/LocalDateTimeTest5.java
162 issues
Line: 13
import junit.framework.TestCase;
public class LocalDateTimeTest5 extends TestCase {
private static Random random = new Random();
private Locale origin;
private TimeZone original = TimeZone.getDefault();
Reported by PMD.
Line: 17
private static Random random = new Random();
private Locale origin;
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 18
private static Random random = new Random();
private Locale origin;
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
int index = random.nextInt(zoneIds.length);
Reported by PMD.
Line: 18
private static Random random = new Random();
private Locale origin;
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
int index = random.nextInt(zoneIds.length);
Reported by PMD.
Line: 19
private Locale origin;
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
int index = random.nextInt(zoneIds.length);
TimeZone timeZone = TimeZone.getTimeZone(zoneIds[index]);
Reported by PMD.
Line: 19
private Locale origin;
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
int index = random.nextInt(zoneIds.length);
TimeZone timeZone = TimeZone.getTimeZone(zoneIds[index]);
Reported by PMD.
Line: 21
private TimeZone original = TimeZone.getDefault();
private String[] zoneIds = TimeZone.getAvailableIDs();
@Override
protected void setUp() throws Exception {
int index = random.nextInt(zoneIds.length);
TimeZone timeZone = TimeZone.getTimeZone(zoneIds[index]);
TimeZone.setDefault(timeZone);
JSON.defaultTimeZone = timeZone; // While running mvn tests defaultTimeZone might already be initialized
Reported by PMD.
Line: 30
origin = Locale.getDefault();
}
@Override
protected void tearDown() throws Exception {
TimeZone.setDefault(original);
JSON.defaultTimeZone = original;
Locale.setDefault(origin);
}
Reported by PMD.
Line: 37
Locale.setDefault(origin);
}
public void test_for_long() throws Exception {
long millis = 1322874196000L;
// using localDataTime instance so that different timeZones are tested
LocalDateTime localDateTime = LocalDateTime.ofInstant(
Instant.ofEpochMilli(millis), TimeZone.getDefault().toZoneId());
VO vo = JSON.parseObject("{\"date\":" + millis + "}", VO.class);
Reported by PMD.
Line: 37
Locale.setDefault(origin);
}
public void test_for_long() throws Exception {
long millis = 1322874196000L;
// using localDataTime instance so that different timeZones are tested
LocalDateTime localDateTime = LocalDateTime.ofInstant(
Instant.ofEpochMilli(millis), TimeZone.getDefault().toZoneId());
VO vo = JSON.parseObject("{\"date\":" + millis + "}", VO.class);
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/AwtCodec.java
146 issues
Line: 84
}
protected char writeClassName(SerializeWriter out, Class<?> clazz, char sep) {
if (out.isEnabled(SerializerFeature.WriteClassName)) {
out.write('{');
out.writeFieldName(JSON.DEFAULT_TYPE_KEY);
out.writeString(clazz.getName());
sep = ',';
Reported by PMD.
Line: 18
import com.alibaba.fastjson.parser.ParseContext;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
public class AwtCodec implements ObjectSerializer, ObjectDeserializer {
public final static AwtCodec instance = new AwtCodec();
public static boolean support(Class<?> clazz) {
return clazz == Point.class //
Reported by PMD.
Line: 18
import com.alibaba.fastjson.parser.ParseContext;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
public class AwtCodec implements ObjectSerializer, ObjectDeserializer {
public final static AwtCodec instance = new AwtCodec();
public static boolean support(Class<?> clazz) {
return clazz == Point.class //
Reported by PMD.
Line: 18
import com.alibaba.fastjson.parser.ParseContext;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
public class AwtCodec implements ObjectSerializer, ObjectDeserializer {
public final static AwtCodec instance = new AwtCodec();
public static boolean support(Class<?> clazz) {
return clazz == Point.class //
Reported by PMD.
Line: 18
import com.alibaba.fastjson.parser.ParseContext;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
public class AwtCodec implements ObjectSerializer, ObjectDeserializer {
public final static AwtCodec instance = new AwtCodec();
public static boolean support(Class<?> clazz) {
return clazz == Point.class //
Reported by PMD.
Line: 53
sep = writeClassName(out, Font.class, sep);
out.writeFieldValue(sep, "name", font.getName());
out.writeFieldValue(',', "style", font.getStyle());
out.writeFieldValue(',', "size", font.getSize());
} else if (object instanceof Rectangle) {
Rectangle rectangle = (Rectangle) object;
Reported by PMD.
Line: 54
sep = writeClassName(out, Font.class, sep);
out.writeFieldValue(sep, "name", font.getName());
out.writeFieldValue(',', "style", font.getStyle());
out.writeFieldValue(',', "size", font.getSize());
} else if (object instanceof Rectangle) {
Rectangle rectangle = (Rectangle) object;
sep = writeClassName(out, Rectangle.class, sep);
Reported by PMD.
Line: 55
out.writeFieldValue(sep, "name", font.getName());
out.writeFieldValue(',', "style", font.getStyle());
out.writeFieldValue(',', "size", font.getSize());
} else if (object instanceof Rectangle) {
Rectangle rectangle = (Rectangle) object;
sep = writeClassName(out, Rectangle.class, sep);
Reported by PMD.
Line: 70
sep = writeClassName(out, Color.class, sep);
out.writeFieldValue(sep, "r", color.getRed());
out.writeFieldValue(',', "g", color.getGreen());
out.writeFieldValue(',', "b", color.getBlue());
if (color.getAlpha() > 0) {
out.writeFieldValue(',', "alpha", color.getAlpha());
}
Reported by PMD.
Line: 71
sep = writeClassName(out, Color.class, sep);
out.writeFieldValue(sep, "r", color.getRed());
out.writeFieldValue(',', "g", color.getGreen());
out.writeFieldValue(',', "b", color.getBlue());
if (color.getAlpha() > 0) {
out.writeFieldValue(',', "alpha", color.getAlpha());
}
} else {
Reported by PMD.