The following issues were found
src/test/java/com/alibaba/json/test/performance/case1/GenerateTest.java
3 issues
Line: 20
json.put("f" + i, i);
}
String text = JSON.toJSONString(json, false);
System.out.println(text);
FileUtils.writeStringToFile(new File("d:/int_array_1000.json"), text);
}
}
Reported by PMD.
Line: 14
public class GenerateTest extends TestCase {
public void testGenInt() throws Exception {
JSONObject json = new JSONObject(true);
for (int i = 0; i < 100; ++i) {
json.put("f" + i, i);
}
String text = JSON.toJSONString(json, false);
Reported by PMD.
Line: 14
public class GenerateTest extends TestCase {
public void testGenInt() throws Exception {
JSONObject json = new JSONObject(true);
for (int i = 0; i < 100; ++i) {
json.put("f" + i, i);
}
String text = JSON.toJSONString(json, false);
Reported by PMD.
src/test/java/com/alibaba/json/test/benchmark/decode/GroupDecode.java
3 issues
Line: 13
public class GroupDecode extends BenchmarkCase {
private String text;
public GroupDecode(){
super("GroupDecode");
try {
Reported by PMD.
Line: 20
try {
String resource = "json/group.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
text = IOUtils.toString(is);
is.close();
} catch (IOException ex) {
ex.printStackTrace();
}
Reported by PMD.
Line: 24
text = IOUtils.toString(is);
is.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
@Override
public void execute(Codec codec) throws Exception {
Reported by PMD.
src/test/java/com/alibaba/json/test/benchmark/decode/IntArray1000Decode.java
3 issues
Line: 8
public class IntArray1000Decode extends BenchmarkCase {
private String text;
public IntArray1000Decode(){
super("IntArray1000Decode");
StringBuilder buf = new StringBuilder();
Reported by PMD.
Line: 8
public class IntArray1000Decode extends BenchmarkCase {
private String text;
public IntArray1000Decode(){
super("IntArray1000Decode");
StringBuilder buf = new StringBuilder();
Reported by PMD.
Line: 18
buf.append('[');
for (int i = 0; i < 1000; ++i) {
if (i != 0) {
buf.append(",");
}
buf.append(i);
}
buf.append(']');
this.text = buf.toString();
Reported by PMD.
src/test/java/com/alibaba/json/test/entity/case1/Long_100_Entity.java
3 issues
Line: 1
package com.alibaba.json.test.entity.case1;
public class Long_100_Entity {
private long f0;
private long f1;
private long f2;
private long f3;
private long f4;
Reported by PMD.
Line: 3
package com.alibaba.json.test.entity.case1;
public class Long_100_Entity {
private long f0;
private long f1;
private long f2;
private long f3;
private long f4;
Reported by PMD.
Line: 3
package com.alibaba.json.test.entity.case1;
public class Long_100_Entity {
private long f0;
private long f1;
private long f2;
private long f3;
private long f4;
Reported by PMD.
src/test/java/oracle/sql/DATE.java
3 issues
Line: 8
public class DATE {
private Date date;
public DATE(Timestamp date){
long time = date.getTime();
time = (time / 1000) * 1000;
this.date = new Date(time);
Reported by PMD.
Line: 8
public class DATE {
private Date date;
public DATE(Timestamp date){
long time = date.getTime();
time = (time / 1000) * 1000;
this.date = new Date(time);
Reported by PMD.
Line: 8
public class DATE {
private Date date;
public DATE(Timestamp date){
long time = date.getTime();
time = (time / 1000) * 1000;
this.date = new Date(time);
Reported by PMD.
src/test/java/com/alibaba/json/test/benchmark/decode/StringArray1000Decode.java
3 issues
Line: 8
public class StringArray1000Decode extends BenchmarkCase {
private String text;
public StringArray1000Decode(){
super("StringArray1000Decode");
StringBuilder buf = new StringBuilder();
Reported by PMD.
Line: 8
public class StringArray1000Decode extends BenchmarkCase {
private String text;
public StringArray1000Decode(){
super("StringArray1000Decode");
StringBuilder buf = new StringBuilder();
Reported by PMD.
Line: 18
buf.append('[');
for (int i = 0; i < 1000; ++i) {
if (i != 0) {
buf.append(",");
}
buf.append('"' + Integer.toHexString(i * 100) + '"');
}
buf.append(']');
this.text = buf.toString();
Reported by PMD.
src/test/java/com/alibaba/json/test/JSONLibXmlTest.java
3 issues
Line: 24
json.put("items", items);
String text = xmlSerializer.write(json);
System.out.println(text);
}
}
Reported by PMD.
Line: 9
import net.sf.json.xml.XMLSerializer;
public class JSONLibXmlTest extends TestCase {
public void test_xml() throws Exception {
XMLSerializer xmlSerializer = new XMLSerializer();
JSONObject json = new JSONObject();
json.put("id", 123);
json.put("name", "jobs");
Reported by PMD.
Line: 9
import net.sf.json.xml.XMLSerializer;
public class JSONLibXmlTest extends TestCase {
public void test_xml() throws Exception {
XMLSerializer xmlSerializer = new XMLSerializer();
JSONObject json = new JSONObject();
json.put("id", 123);
json.put("name", "jobs");
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_string_special.java
3 issues
Line: 14
public class WriteAsArray_string_special extends TestCase {
public void test_0() throws Exception {
Model model = new Model();
model.name = "a\\bc";
String text = JSON.toJSONString(model, SerializerFeature.BeanToArray);
Assert.assertEquals("[\"a\\\\bc\"]", text);
Reported by PMD.
Line: 24
Assert.assertEquals(model.name, model2.name);
}
public void test_1() throws Exception {
Model model = new Model();
model.name = "a\\bc\"";
String text = JSON.toJSONString(model, SerializerFeature.BeanToArray);
Assert.assertEquals("[\"a\\\\bc\\\"\"]", text);
Reported by PMD.
Line: 36
public static class Model {
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_string_special_Reader.java
3 issues
Line: 17
public class WriteAsArray_string_special_Reader extends TestCase {
public void test_0() throws Exception {
Model model = new Model();
model.name = "a\\bc";
String text = JSON.toJSONString(model, SerializerFeature.BeanToArray);
Assert.assertEquals("[\"a\\\\bc\"]", text);
Reported by PMD.
Line: 30
reader.close();
}
public void test_1() throws Exception {
Model model = new Model();
model.name = "a\\bc\"";
String text = JSON.toJSONString(model, SerializerFeature.BeanToArray);
Assert.assertEquals("[\"a\\\\bc\\\"\"]", text);
Reported by PMD.
Line: 45
public static class Model {
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/test/a/IncomingDataPointBenchmark.java
3 issues
Line: 24
JSON.parseArray(json, IncomingDataPoint.class);
}
long millis = System.currentTimeMillis() - start;
System.out.println("millis : " + millis);
}
}
Reported by PMD.
Line: 9
/**
* Created by wenshao on 04/08/2017.
*/
public class IncomingDataPointBenchmark {
static String json = "[[\"DataAdaptor.LbMultiGroupPersonalityDataAdaptor.stddev.aggregate_sum\",\"1501812639932\",\"95.52667633256902\",{\"appName\":\"aladdin\",\"hostIdc\":\"et2\",\"hostunit\":\"CENTER\",\"nodegroup\":\"aladdin_prehost\",\"idc\":\"ET2\",\"agg_version\":\"100\",\"group\":\"DEFAULT\"},\"\",\"\",\"\"]]";
public static void main(String[] args) throws Exception {
for (int i = 0; i < 10; ++i) {
perf();
Reported by PMD.
Line: 12
public class IncomingDataPointBenchmark {
static String json = "[[\"DataAdaptor.LbMultiGroupPersonalityDataAdaptor.stddev.aggregate_sum\",\"1501812639932\",\"95.52667633256902\",{\"appName\":\"aladdin\",\"hostIdc\":\"et2\",\"hostunit\":\"CENTER\",\"nodegroup\":\"aladdin_prehost\",\"idc\":\"ET2\",\"agg_version\":\"100\",\"group\":\"DEFAULT\"},\"\",\"\",\"\"]]";
public static void main(String[] args) throws Exception {
for (int i = 0; i < 10; ++i) {
perf();
}
}
Reported by PMD.