The following issues were found
src/test/java/com/alibaba/fastjson/validate/JSONValidateTest_file.java
26 issues
Line: 20
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
Reported by PMD.
Line: 54
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
Reader is = new InputStreamReader(new FileInputStream(file), "UTF8");
JSONValidator validator = JSONValidator.from(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
Reported by PMD.
Line: 26
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
public void test_for_file2() throws Exception {
File file = new File("/Users/wenshao/Downloads/000002_0.json");
Reported by PMD.
Line: 44
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
public void test_for_fileReader() throws Exception {
Reported by PMD.
Line: 60
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
}
}
Reported by PMD.
Line: 15
public class JSONValidateTest_file extends TestCase
{
public void test_for_file() throws Exception {
for (int i = 0; i < 10; ++i) {
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
Reported by PMD.
Line: 19
for (int i = 0; i < 10; ++i) {
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
Reported by PMD.
Line: 20
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
Reported by PMD.
Line: 20
long start = System.currentTimeMillis();
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
Reported by PMD.
Line: 22
File file = new File("/Users/wenshao/Downloads/000002_0.json");
FileInputStream is = new FileInputStream(file);
JSONValidator validator = JSONValidator.fromUtf8(is);
assertTrue(validator.validate());
validator.close();
// 642 335 796
System.out.println("millis " + (System.currentTimeMillis() - start));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/support/jaxrs/mock/testcase/FastJsonProviderTest.java
26 issues
Line: 77
Response response = client.path("/fastjson/test1").accept("application/json").type("application/json; charset=UTF-8").post(json.toJSONString());
System.out.println(response.readEntity(String.class));
}
@Test
public void test1() throws Exception {
Reported by PMD.
Line: 93
Response response = client.path("/fastjson/test1").replaceQuery("pretty").accept("application/json").type("application/json; charset=UTF-8").post(json.toJSONString());
System.out.println(response.readEntity(String.class));
}
@Test
public void test2() throws Exception {
Reported by PMD.
Line: 105
Response response = client.path("/fastjson/test2").accept("application/json").type("application/json; charset=UTF-8").post(jsonStr);
System.out.println(response.readEntity(String.class));
}
}
Reported by PMD.
Line: 40
@ContextConfiguration(classes = Application.class)
public class FastJsonProviderTest {
public final String REST_SERVICE_URL = "http://localhost:8088/rest";
static {
Server server = new Server(8088);
Reported by PMD.
Line: 40
@ContextConfiguration(classes = Application.class)
public class FastJsonProviderTest {
public final String REST_SERVICE_URL = "http://localhost:8088/rest";
static {
Server server = new Server(8088);
Reported by PMD.
Line: 59
try {
server.start();
// server.join();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
Reported by PMD.
Line: 60
server.start();
// server.join();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void test0() throws Exception {
Reported by PMD.
Line: 65
}
@Test
public void test0() throws Exception {
JSONObject json = new JSONObject();
json.put("id", 123);
Reported by PMD.
Line: 75
WebClient client = WebClient.create(REST_SERVICE_URL);
Response response = client.path("/fastjson/test1").accept("application/json").type("application/json; charset=UTF-8").post(json.toJSONString());
System.out.println(response.readEntity(String.class));
}
@Test
Reported by PMD.
Line: 75
WebClient client = WebClient.create(REST_SERVICE_URL);
Response response = client.path("/fastjson/test1").accept("application/json").type("application/json; charset=UTF-8").post(json.toJSONString());
System.out.println(response.readEntity(String.class));
}
@Test
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_yannywang.java
26 issues
Line: 17
public class Bug_for_yannywang extends TestCase {
public void test_for_wangran() throws Exception {
String resource = "json/yannywang.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
String text = IOUtils.toString(is);
VirtualTopic topic = JSON.parseObject(text, VirtualTopic.class);
Reported by PMD.
Line: 19
public void test_for_wangran() throws Exception {
String resource = "json/yannywang.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
String text = IOUtils.toString(is);
VirtualTopic topic = JSON.parseObject(text, VirtualTopic.class);
{
Reported by PMD.
Line: 19
public void test_for_wangran() throws Exception {
String resource = "json/yannywang.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
String text = IOUtils.toString(is);
VirtualTopic topic = JSON.parseObject(text, VirtualTopic.class);
{
Reported by PMD.
Line: 19
public void test_for_wangran() throws Exception {
String resource = "json/yannywang.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
String text = IOUtils.toString(is);
VirtualTopic topic = JSON.parseObject(text, VirtualTopic.class);
{
Reported by PMD.
Line: 25
VirtualTopic topic = JSON.parseObject(text, VirtualTopic.class);
{
QueueEntity qe = topic.getQueueMap().get(12109);
Assert.assertNotNull(qe);
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
Reported by PMD.
Line: 28
QueueEntity qe = topic.getQueueMap().get(12109);
Assert.assertNotNull(qe);
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
for (PhysicalQueue q : qe.getPhysicalQueueMap().values()) {
q.getInRate();
Assert.assertEquals(qe, q.getQueue());
Reported by PMD.
Line: 29
Assert.assertNotNull(qe);
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
for (PhysicalQueue q : qe.getPhysicalQueueMap().values()) {
q.getInRate();
Assert.assertEquals(qe, q.getQueue());
}
Reported by PMD.
Line: 29
Assert.assertNotNull(qe);
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
for (PhysicalQueue q : qe.getPhysicalQueueMap().values()) {
q.getInRate();
Assert.assertEquals(qe, q.getQueue());
}
Reported by PMD.
Line: 31
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
for (PhysicalQueue q : qe.getPhysicalQueueMap().values()) {
q.getInRate();
Assert.assertEquals(qe, q.getQueue());
}
Assert.assertEquals(qe.getPhysicalQueueMap(), qe.getPqMap());
Reported by PMD.
Line: 31
Assert.assertNotNull(qe.getPhysicalQueueMap());
Assert.assertEquals(1, qe.getPhysicalQueueMap().size());
for (PhysicalQueue q : qe.getPhysicalQueueMap().values()) {
q.getInRate();
Assert.assertEquals(qe, q.getQueue());
}
Assert.assertEquals(qe.getPhysicalQueueMap(), qe.getPqMap());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/list/ListStringFieldTest_dom_hashSet.java
26 issues
Line: 19
public class ListStringFieldTest_dom_hashSet extends TestCase {
public void test_list() throws Exception {
String text = "{\"values\":[\"a\",null,\"b\",\"ab\\\\c\"]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Reported by PMD.
Line: 24
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains(null));
Assert.assertTrue(model.values.contains("ab\\c"));
}
Reported by PMD.
Line: 25
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains(null));
Assert.assertTrue(model.values.contains("ab\\c"));
}
Reported by PMD.
Line: 26
Assert.assertEquals(4, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains(null));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
Reported by PMD.
Line: 27
Assert.assertEquals(4, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains(null));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Reported by PMD.
Line: 28
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains(null));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Model model = JSON.parseObject(text, Model.class);
Reported by PMD.
Line: 31
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertNull(model.values);
}
Reported by PMD.
Line: 37
Assert.assertNull(model.values);
}
public void test_empty() throws Exception {
String text = "{\"values\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(0, model.values.size());
}
Reported by PMD.
Line: 40
public void test_empty() throws Exception {
String text = "{\"values\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(0, model.values.size());
}
public void test_map_empty() throws Exception {
String text = "{\"model\":{\"values\":[]}}";
Map<String, Model> map = JSON.parseObject(text, new TypeReference<Map<String, Model>>() {
Reported by PMD.
Line: 43
Assert.assertEquals(0, model.values.size());
}
public void test_map_empty() throws Exception {
String text = "{\"model\":{\"values\":[]}}";
Map<String, Model> map = JSON.parseObject(text, new TypeReference<Map<String, Model>>() {
});
Model model = (Model) map.get("model");
Assert.assertEquals(0, model.values.size());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/list/ListStringFieldTest_dom_treeSet.java
26 issues
Line: 16
public class ListStringFieldTest_dom_treeSet extends TestCase {
public void test_list() throws Exception {
String text = "{\"values\":[\"a\",\"b\",\"ab\\\\c\"]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(3, model.values.size());
Reported by PMD.
Line: 21
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(3, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains("ab\\c"));
}
Reported by PMD.
Line: 22
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(3, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
Reported by PMD.
Line: 23
Assert.assertEquals(3, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Reported by PMD.
Line: 24
Assert.assertEquals(3, model.values.size());
Assert.assertTrue(model.values.contains("a"));
Assert.assertTrue(model.values.contains("b"));
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Model model = JSON.parseObject(text, Model.class);
Reported by PMD.
Line: 27
Assert.assertTrue(model.values.contains("ab\\c"));
}
public void test_null() throws Exception {
String text = "{\"values\":null}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertNull(model.values);
}
Reported by PMD.
Line: 33
Assert.assertNull(model.values);
}
public void test_empty() throws Exception {
String text = "{\"values\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(0, model.values.size());
}
Reported by PMD.
Line: 36
public void test_empty() throws Exception {
String text = "{\"values\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(0, model.values.size());
}
public void test_map_empty() throws Exception {
String text = "{\"model\":{\"values\":[]}}";
Map<String, Model> map = JSON.parseObject(text, new TypeReference<Map<String, Model>>() {
Reported by PMD.
Line: 39
Assert.assertEquals(0, model.values.size());
}
public void test_map_empty() throws Exception {
String text = "{\"model\":{\"values\":[]}}";
Map<String, Model> map = JSON.parseObject(text, new TypeReference<Map<String, Model>>() {
});
Model model = (Model) map.get("model");
Assert.assertEquals(0, model.values.size());
Reported by PMD.
Line: 44
Map<String, Model> map = JSON.parseObject(text, new TypeReference<Map<String, Model>>() {
});
Model model = (Model) map.get("model");
Assert.assertEquals(0, model.values.size());
}
public void test_notMatch() throws Exception {
String text = "{\"value\":[]}";
Model model = JSON.parseObject(text, Model.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1500/Issue1584.java
26 issues
Line: 16
import java.util.Map;
public class Issue1584 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
String json = "{\"k\":1,\"v\":\"A\"}";
{
Reported by PMD.
Line: 16
import java.util.Map;
public class Issue1584 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
String json = "{\"k\":1,\"v\":\"A\"}";
{
Reported by PMD.
Line: 23
{
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
Reported by PMD.
Line: 24
{
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
Line: 25
Map.Entry entry = JSON.parseObject(json, Map.Entry.class, config);
Object key = entry.getKey();
Object value = entry.getValue();
assertTrue(key.equals("v") || key.equals("k"));
if (key.equals("v")) {
assertEquals("A", value);
} else {
assertEquals(1, value);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/annotation/DeserializeUsingTest.java
26 issues
Line: 18
*/
public class DeserializeUsingTest extends TestCase {
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
Reported by PMD.
Line: 18
*/
public class DeserializeUsingTest extends TestCase {
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
Reported by PMD.
Line: 21
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 21
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 21
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 21
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 21
public void test_deserializeUsing() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 22
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 22
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
Line: 22
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Teacher teacher = JSON.parseObject(jsonStr, Teacher.class);
assertEquals(SubjectEnum.CHINESE.ordinal(), teacher.getSubjectList().get(0).intValue());
assertEquals(SubjectEnum.MATH.ordinal(), teacher.getSubjectList().get(1).intValue());
}
public void test_deserializeUsing2() throws Exception {
String jsonStr = "{'subjectList':['CHINESE','MATH']}";
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/autoType/AutoTypeTest3_deny.java
26 issues
Line: 8
import junit.framework.TestCase;
public class AutoTypeTest3_deny extends TestCase {
public void test_for_x() throws Exception {
Exception error = null;
try {
String json = "{\"@type\":\"java.util.logging.FileHandler\",\"pattern\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
Reported by PMD.
Line: 12
Exception error = null;
try {
String json = "{\"@type\":\"java.util.logging.FileHandler\",\"pattern\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 13
try {
String json = "{\"@type\":\"java.util.logging.FileHandler\",\"pattern\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 16
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
public void test_for_jar() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 19
assertNotNull(error);
}
public void test_for_jar() throws Exception {
Exception error = null;
try {
String json = "{\"@type\":\"java.util.jar.JarFile.JarFile\",\"name\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
Reported by PMD.
Line: 23
Exception error = null;
try {
String json = "{\"@type\":\"java.util.jar.JarFile.JarFile\",\"name\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 24
try {
String json = "{\"@type\":\"java.util.jar.JarFile.JarFile\",\"name\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 27
} catch (Exception ex) {
error = ex;
}
assertNotNull(error);
}
public void test_for_array() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 30
assertNotNull(error);
}
public void test_for_array() throws Exception {
Exception error = null;
try {
String json = "{\"@type\":\"[java.util.jar.JarFile.JarFile\",\"name\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
Reported by PMD.
Line: 34
Exception error = null;
try {
String json = "{\"@type\":\"[java.util.jar.JarFile.JarFile\",\"name\":\"xxx.txt\"}";
Object obj = JSON.parse(json, Feature.SupportAutoType);
} catch (Exception ex) {
ex.printStackTrace();
error = ex;
}
assertNotNull(error);
Reported by PMD.
src/test/java/com/alibaba/json/test/Bug_0_Test.java
26 issues
Line: 56
com.alibaba.fastjson.JSON.parse(text);
}
long nano = System.nanoTime() - startNano;
System.out.println(NumberFormat.getInstance().format(nano));
}
private void f_jackson() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 68
JsonNode body = node.get(1);
}
long nano = System.nanoTime() - startNano;
System.out.println(NumberFormat.getInstance().format(nano));
}
}
Reported by PMD.
Line: 31
public class Bug_0_Test extends TestCase {
private String text;
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
Reported by PMD.
Line: 32
public class Bug_0_Test extends TestCase {
private String text;
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
Reported by PMD.
Line: 32
public class Bug_0_Test extends TestCase {
private String text;
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
Reported by PMD.
Line: 34
private String text;
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
// text =
Reported by PMD.
Line: 35
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
// text =
// "[{\"S\":321061,\"T\":\"GetAttributeResp\"},{\"ERROR\":null,\"TS\":0,\"VAL\":{\"SqlList\":[{\"BatchSizeMax\":0,\"BatchSizeTotal\":0,\"ConcurrentMax\":1,\"DataSource\":\"jdbc:wrap-jdbc:filters=default,encoding:name=ds-offer:jdbc:mysql://172.29.61.63:8066/amoeba\",\"EffectedRowCount\":0,\"ErrorCount\":0,\"ExecuteCount\":5,\"FetchRowCount\":5,\"File\":null,\"ID\":2001,\"LastError\":null,\"LastTime\":1292742908178,\"MaxTimespan\":16,\"MaxTimespanOccurTime\":1292742668191,\"Name\":null,\"RunningCount\":0,\"SQL\":\"SELECT @@SQL_MODE\",\"TotalTime\":83}]}}]";
Reported by PMD.
Line: 35
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
// text =
// "[{\"S\":321061,\"T\":\"GetAttributeResp\"},{\"ERROR\":null,\"TS\":0,\"VAL\":{\"SqlList\":[{\"BatchSizeMax\":0,\"BatchSizeTotal\":0,\"ConcurrentMax\":1,\"DataSource\":\"jdbc:wrap-jdbc:filters=default,encoding:name=ds-offer:jdbc:mysql://172.29.61.63:8066/amoeba\",\"EffectedRowCount\":0,\"ErrorCount\":0,\"ExecuteCount\":5,\"FetchRowCount\":5,\"File\":null,\"ID\":2001,\"LastError\":null,\"LastTime\":1292742908178,\"MaxTimespan\":16,\"MaxTimespanOccurTime\":1292742668191,\"Name\":null,\"RunningCount\":0,\"SQL\":\"SELECT @@SQL_MODE\",\"TotalTime\":83}]}}]";
Reported by PMD.
Line: 35
private int COUNT = 1000;
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
// text =
// "[{\"S\":321061,\"T\":\"GetAttributeResp\"},{\"ERROR\":null,\"TS\":0,\"VAL\":{\"SqlList\":[{\"BatchSizeMax\":0,\"BatchSizeTotal\":0,\"ConcurrentMax\":1,\"DataSource\":\"jdbc:wrap-jdbc:filters=default,encoding:name=ds-offer:jdbc:mysql://172.29.61.63:8066/amoeba\",\"EffectedRowCount\":0,\"ErrorCount\":0,\"ExecuteCount\":5,\"FetchRowCount\":5,\"File\":null,\"ID\":2001,\"LastError\":null,\"LastTime\":1292742908178,\"MaxTimespan\":16,\"MaxTimespanOccurTime\":1292742668191,\"Name\":null,\"RunningCount\":0,\"SQL\":\"SELECT @@SQL_MODE\",\"TotalTime\":83}]}}]";
Reported by PMD.
Line: 37
protected void setUp() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/Bug_0_Test.json");
text = IOUtils.toString(is);
is.close();
// text =
// "[{\"S\":321061,\"T\":\"GetAttributeResp\"},{\"ERROR\":null,\"TS\":0,\"VAL\":{\"SqlList\":[{\"BatchSizeMax\":0,\"BatchSizeTotal\":0,\"ConcurrentMax\":1,\"DataSource\":\"jdbc:wrap-jdbc:filters=default,encoding:name=ds-offer:jdbc:mysql://172.29.61.63:8066/amoeba\",\"EffectedRowCount\":0,\"ErrorCount\":0,\"ExecuteCount\":5,\"FetchRowCount\":5,\"File\":null,\"ID\":2001,\"LastError\":null,\"LastTime\":1292742908178,\"MaxTimespan\":16,\"MaxTimespanOccurTime\":1292742668191,\"Name\":null,\"RunningCount\":0,\"SQL\":\"SELECT @@SQL_MODE\",\"TotalTime\":83}]}}]";
}
Reported by PMD.
src/test/java/cn/com/tx/domain/pagination/Pagination.java
26 issues
Line: 7
import java.util.ArrayList;
import java.util.List;
public class Pagination<T> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5038839734218582220L;
Reported by PMD.
Line: 7
import java.util.ArrayList;
import java.util.List;
public class Pagination<T> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5038839734218582220L;
Reported by PMD.
Line: 7
import java.util.ArrayList;
import java.util.List;
public class Pagination<T> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5038839734218582220L;
Reported by PMD.
Line: 14
*/
private static final long serialVersionUID = 5038839734218582220L;
private int totalResult = 0;
private int totalPage = 1;
private int pageIndex = 1;
Reported by PMD.
Line: 22
private int maxLength = 5;
private int fromIndex = 0;
private int toIndex = 0;
private List<T> list = new ArrayList<T>();
Reported by PMD.
Line: 24
private int fromIndex = 0;
private int toIndex = 0;
private List<T> list = new ArrayList<T>();
public Pagination(){
Reported by PMD.
Line: 87
}
public int getPrevPage() {
if (this.pageIndex > 1) {
return this.pageIndex - 1;
}
return this.pageIndex;
}
Reported by PMD.
Line: 134
* @param pageIndex
* @param maxLength
*/
public Pagination(int totalResult, int pageIndex, int maxLength) {
if (maxLength > 0) {
this.maxLength = maxLength;
}
if (totalResult > 0) {
this.totalResult = totalResult;
Reported by PMD.
Line: 134
* @param pageIndex
* @param maxLength
*/
public Pagination(int totalResult, int pageIndex, int maxLength) {
if (maxLength > 0) {
this.maxLength = maxLength;
}
if (totalResult > 0) {
this.totalResult = totalResult;
Reported by PMD.
Line: 134
* @param pageIndex
* @param maxLength
*/
public Pagination(int totalResult, int pageIndex, int maxLength) {
if (maxLength > 0) {
this.maxLength = maxLength;
}
if (totalResult > 0) {
this.totalResult = totalResult;
Reported by PMD.