The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_vikingschow.java
2 issues
Line: 9
import com.alibaba.json.bvtVO.OfferRankResultVO;
public class Bug_for_vikingschow extends TestCase {
public void test_for_vikingschow() throws Exception {
OfferRankResultVO vo = new OfferRankResultVO();
String text = JSON.toJSONString(vo);
JSON.parseObject(text, OfferRankResultVO.class);
}
}
Reported by PMD.
Line: 9
import com.alibaba.json.bvtVO.OfferRankResultVO;
public class Bug_for_vikingschow extends TestCase {
public void test_for_vikingschow() throws Exception {
OfferRankResultVO vo = new OfferRankResultVO();
String text = JSON.toJSONString(vo);
JSON.parseObject(text, OfferRankResultVO.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_wsky.java
2 issues
Line: 10
public class Bug_for_wsky extends TestCase {
public void test_writeMapNull() throws Exception {
JSON.parseObject(JSON.toJSONString(new MethodReturn(), SerializerFeature.WriteMapNullValue), MethodReturn.class);
}
public static class MethodReturn {
Reported by PMD.
Line: 10
public class Bug_for_wsky extends TestCase {
public void test_writeMapNull() throws Exception {
JSON.parseObject(JSON.toJSONString(new MethodReturn(), SerializerFeature.WriteMapNullValue), MethodReturn.class);
}
public static class MethodReturn {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/basicType/BigInteger_BrowserCompatible.java
2 issues
Line: 12
import java.util.Map;
public class BigInteger_BrowserCompatible extends TestCase {
public void test_for_issue() throws Exception {
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("id1", 9223370018640066466L);
map.put("id2", new BigInteger("9223370018640066466"));
assertEquals("{\"id1\":\"9223370018640066466\",\"id2\":\"9223370018640066466\"}",
JSON.toJSONString(map, SerializerFeature.BrowserCompatible)
Reported by PMD.
Line: 16
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("id1", 9223370018640066466L);
map.put("id2", new BigInteger("9223370018640066466"));
assertEquals("{\"id1\":\"9223370018640066466\",\"id2\":\"9223370018640066466\"}",
JSON.toJSONString(map, SerializerFeature.BrowserCompatible)
);
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issue2898/TestIssue2898.java
2 issues
Line: 19
ExtClassLoader classLoader = new ExtClassLoader();
Class clazz = classLoader.loadClass("DataClassPropsGeneric");
Object d = JSON.parseObject(s, clazz);
System.out.println(d);
Assert.assertNotNull(d);
}
public static class ExtClassLoader extends ClassLoader {
Reported by PMD.
Line: 30
{
byte[] bytes;
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(
"kotlin/DataClassPropsGeneric.clazz");
bytes = IOUtils.toByteArray(is);
is.close();
super.defineClass("DataClassPropsGeneric", bytes, 0, bytes.length);
Reported by PMD.
src/main/java/com/alibaba/fastjson/parser/JSONLexer.java
2 issues
Line: 16
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.fastjson.parser;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Locale;
import java.util.TimeZone;
Reported by PMD.
Line: 23
import java.util.Locale;
import java.util.TimeZone;
public interface JSONLexer {
char EOI = 0x1A;
int NOT_MATCH = -1;
int NOT_MATCH_NAME = -2;
int UNKNOWN = 0;
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issue2711/PageRequest.java
2 issues
Line: 5
import com.alibaba.fastjson.annotation.JSONField;
public class PageRequest<T> {
@JSONField(unwrapped = true)
T data;
int from = 0;
int size = 10;
Reported by PMD.
Line: 8
public class PageRequest<T> {
@JSONField(unwrapped = true)
T data;
int from = 0;
int size = 10;
public T getData() {
return data;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/AppendableFieldTest.java
2 issues
Line: 12
public class AppendableFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 22
Assert.assertEquals("{\"value\":null}", text);
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Assert.assertTrue(!mapping.isAsmEnable());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/bug2019/Bug20190729_01.java
2 issues
Line: 9
public class Bug20190729_01 extends TestCase
{
public void test_for_issue() throws Exception {
JSONObject object = new JSONObject();
object.put("bucketId", 123);
JSON.toJavaObject(object, BucketInfo.class);
}
Reported by PMD.
Line: 9
public class Bug20190729_01 extends TestCase
{
public void test_for_issue() throws Exception {
JSONObject object = new JSONObject();
object.put("bucketId", 123);
JSON.toJavaObject(object, BucketInfo.class);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_yaoming_1.java
2 issues
Line: 10
public class Bug_for_yaoming_1 extends TestCase {
public void test_0 () throws Exception {
JSON.parseObject("{}", AccessHttpConfigModel.class);
}
}
Reported by PMD.
Line: 10
public class Bug_for_yaoming_1 extends TestCase {
public void test_0 () throws Exception {
JSON.parseObject("{}", AccessHttpConfigModel.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/deserializer/issue1463/TestIssue1463.java
2 issues
Line: 19
*/
public class TestIssue1463 {
private Person wenshao;
@Before
public void setUp() {
wenshao = new Person("wenshao", 18);
}
Reported by PMD.
Line: 31
String str = doubleDeserialization(wenshao);
try {
wenshao = JSON.parseObject(str, Person.class);
} catch (Throwable ex) {
Assert.assertEquals(ex.getCause() instanceof NullPointerException, false);
}
}
private String doubleDeserialization(Person person) {
Reported by PMD.