The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1300/Issue1300.java
10 issues
Line: 14
* Created by wenshao on 01/07/2017.
*/
public class Issue1300 extends TestCase {
public void testFullJSON() {
JSONObject data = new JSONObject();
data.put("name", "string");
data.put("code", 1);
data.put("pinyin", "pinyin");
City object = TypeUtils.castToJavaBean(data, City.class);
Reported by PMD.
Line: 14
* Created by wenshao on 01/07/2017.
*/
public class Issue1300 extends TestCase {
public void testFullJSON() {
JSONObject data = new JSONObject();
data.put("name", "string");
data.put("code", 1);
data.put("pinyin", "pinyin");
City object = TypeUtils.castToJavaBean(data, City.class);
Reported by PMD.
Line: 18
JSONObject data = new JSONObject();
data.put("name", "string");
data.put("code", 1);
data.put("pinyin", "pinyin");
City object = TypeUtils.castToJavaBean(data, City.class);
assertEquals("string", object.name);
assertEquals(1, object.code);
assertEquals("pinyin", object.pinyin);
}
Reported by PMD.
Line: 20
data.put("code", 1);
data.put("pinyin", "pinyin");
City object = TypeUtils.castToJavaBean(data, City.class);
assertEquals("string", object.name);
assertEquals(1, object.code);
assertEquals("pinyin", object.pinyin);
}
public void testEmptyJSON() {
Reported by PMD.
Line: 21
data.put("pinyin", "pinyin");
City object = TypeUtils.castToJavaBean(data, City.class);
assertEquals("string", object.name);
assertEquals(1, object.code);
assertEquals("pinyin", object.pinyin);
}
public void testEmptyJSON() {
City object = TypeUtils.castToJavaBean(new JSONObject(), City.class);
Reported by PMD.
Line: 22
City object = TypeUtils.castToJavaBean(data, City.class);
assertEquals("string", object.name);
assertEquals(1, object.code);
assertEquals("pinyin", object.pinyin);
}
public void testEmptyJSON() {
City object = TypeUtils.castToJavaBean(new JSONObject(), City.class);
Assert.assertEquals(null, object.name);
Reported by PMD.
Line: 25
assertEquals("pinyin", object.pinyin);
}
public void testEmptyJSON() {
City object = TypeUtils.castToJavaBean(new JSONObject(), City.class);
Assert.assertEquals(null, object.name);
Assert.assertEquals(0, object.code);
}
Reported by PMD.
Line: 33
public static class City implements Parcelable {
public final int code;
public final String name;
public final String pinyin;
@JSONCreator
public City(@JSONField(name = "code") int code,
Reported by PMD.
Line: 34
public static class City implements Parcelable {
public final int code;
public final String name;
public final String pinyin;
@JSONCreator
public City(@JSONField(name = "code") int code,
@JSONField(name = "name") String name,
Reported by PMD.
Line: 35
public static class City implements Parcelable {
public final int code;
public final String name;
public final String pinyin;
@JSONCreator
public City(@JSONField(name = "code") int code,
@JSONField(name = "name") String name,
@JSONField(name = "pinyin") String pinyin) {
Reported by PMD.
src/test/java/com/alibaba/fastjson/codegen/ClassGen.java
10 issues
Line: 6
import java.io.IOException;
import java.lang.reflect.Type;
public abstract class ClassGen {
protected Class<?> clazz;
protected Type type;
protected Appendable out;
Reported by PMD.
Line: 8
public abstract class ClassGen {
protected Class<?> clazz;
protected Type type;
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
Reported by PMD.
Line: 9
public abstract class ClassGen {
protected Class<?> clazz;
protected Type type;
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
Reported by PMD.
Line: 10
protected Class<?> clazz;
protected Type type;
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
public ClassGen(Class<?> clazz, Appendable out){
Reported by PMD.
Line: 12
protected Type type;
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
public ClassGen(Class<?> clazz, Appendable out){
this(clazz, null, out);
}
Reported by PMD.
Line: 12
protected Type type;
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
public ClassGen(Class<?> clazz, Appendable out){
this(clazz, null, out);
}
Reported by PMD.
Line: 13
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
public ClassGen(Class<?> clazz, Appendable out){
this(clazz, null, out);
}
Reported by PMD.
Line: 13
protected Appendable out;
private String indent = "\t";
private int indentCount = 0;
public ClassGen(Class<?> clazz, Appendable out){
this(clazz, null, out);
}
Reported by PMD.
Line: 44
protected void printPackage() throws IOException {
print("package ");
print(clazz.getPackage().getName());
println(";");
}
protected void beginClass(String className) throws IOException {
print("public class ");
Reported by PMD.
Line: 102
protected void printClassName(Class<?> clazz) throws IOException {
String name = clazz.getName();
name = name.replace('$', '.');
print(name);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1200/Issue1271.java
10 issues
Line: 19
final AtomicInteger count = new AtomicInteger(0);
ExtraProcessor extraProcessor = new ExtraProcessor() {
public void processExtra(Object object, String key, Object value) {
System.out.println("setter not found, class " + object.getClass().getName() + ", property " + key);
count.incrementAndGet();
}
};
Reported by PMD.
Line: 12
* Created by kimmking on 15/06/2017.
*/
public class Issue1271 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"a\":1,\"b\":2}";
final AtomicInteger count = new AtomicInteger(0);
ExtraProcessor extraProcessor = new ExtraProcessor() {
Reported by PMD.
Line: 12
* Created by kimmking on 15/06/2017.
*/
public class Issue1271 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"a\":1,\"b\":2}";
final AtomicInteger count = new AtomicInteger(0);
ExtraProcessor extraProcessor = new ExtraProcessor() {
Reported by PMD.
Line: 19
final AtomicInteger count = new AtomicInteger(0);
ExtraProcessor extraProcessor = new ExtraProcessor() {
public void processExtra(Object object, String key, Object value) {
System.out.println("setter not found, class " + object.getClass().getName() + ", property " + key);
count.incrementAndGet();
}
};
Reported by PMD.
Line: 26
A a = JSON.parseObject(json,A.class,extraProcessor);
assertEquals(1,a.a);
assertEquals(1, count.intValue());
B b = JSON.parseObject(json,B.class,extraProcessor);
assertEquals(1,b.a);
assertEquals(2, count.intValue());
Reported by PMD.
Line: 27
A a = JSON.parseObject(json,A.class,extraProcessor);
assertEquals(1,a.a);
assertEquals(1, count.intValue());
B b = JSON.parseObject(json,B.class,extraProcessor);
assertEquals(1,b.a);
assertEquals(2, count.intValue());
Reported by PMD.
Line: 30
assertEquals(1, count.intValue());
B b = JSON.parseObject(json,B.class,extraProcessor);
assertEquals(1,b.a);
assertEquals(2, count.intValue());
}
public static class A {
Reported by PMD.
Line: 31
B b = JSON.parseObject(json,B.class,extraProcessor);
assertEquals(1,b.a);
assertEquals(2, count.intValue());
}
public static class A {
public int a;
Reported by PMD.
Line: 36
}
public static class A {
public int a;
}
public static class B {
private int a;
Reported by PMD.
Line: 36
}
public static class A {
public int a;
}
public static class B {
private int a;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_NonStringKeyMap.java
10 issues
Line: 22
vo.getMap().put(1L, new VAL());
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parse(text);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 33
submap.put("subkey", "subvalue");
map.put(submap, "value");
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
System.out.println(jsonString);
Object object = JSON.parse(jsonString);
System.out.println(object.toString());
}
public static class VO {
Reported by PMD.
Line: 35
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
System.out.println(jsonString);
Object object = JSON.parse(jsonString);
System.out.println(object.toString());
}
public static class VO {
private Map<Long, VAL> map = new HashMap<Long, VAL>();
Reported by PMD.
Line: 13
import junit.framework.TestCase;
public class Bug_for_NonStringKeyMap extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_NonStringKeyMap.");
}
public void test_bug() throws Exception {
VO vo = new VO();
Reported by PMD.
Line: 14
public class Bug_for_NonStringKeyMap extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_NonStringKeyMap.");
}
public void test_bug() throws Exception {
VO vo = new VO();
vo.getMap().put(1L, new VAL());
Reported by PMD.
Line: 17
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_NonStringKeyMap.");
}
public void test_bug() throws Exception {
VO vo = new VO();
vo.getMap().put(1L, new VAL());
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
Line: 17
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_NonStringKeyMap.");
}
public void test_bug() throws Exception {
VO vo = new VO();
vo.getMap().put(1L, new VAL());
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
Line: 27
JSON.parse(text);
}
public void test_1() throws Exception {
Map<Map<String, String>, String> map = new HashMap<Map<String, String>, String>();
Map<String, String> submap = new HashMap<String, String>();
submap.put("subkey", "subvalue");
map.put(submap, "value");
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 27
JSON.parse(text);
}
public void test_1() throws Exception {
Map<Map<String, String>, String> map = new HashMap<Map<String, String>, String>();
Map<String, String> submap = new HashMap<String, String>();
submap.put("subkey", "subvalue");
map.put(submap, "value");
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 35
String jsonString = JSON.toJSONString(map, SerializerFeature.WriteClassName);
System.out.println(jsonString);
Object object = JSON.parse(jsonString);
System.out.println(object.toString());
}
public static class VO {
private Map<Long, VAL> map = new HashMap<Long, VAL>();
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/EnumerationSerializer.java
10 issues
Line: 21
}
Type elementType = null;
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
}
Reported by PMD.
Line: 22
Type elementType = null;
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
}
Reported by PMD.
Line: 24
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
}
Enumeration<?> e = (Enumeration<?>) object;
Reported by PMD.
Line: 38
out.append('[');
while (e.hasMoreElements()) {
Object item = e.nextElement();
if (i++ != 0) {
out.append(',');
}
if (item == null) {
out.writeNull();
Reported by PMD.
Line: 47
continue;
}
ObjectSerializer itemSerializer = serializer.getObjectWriter(item.getClass());
itemSerializer.write(serializer, item, i - 1, elementType, 0);
}
out.append(']');
} finally {
serializer.context = context;
Reported by PMD.
Line: 48
}
ObjectSerializer itemSerializer = serializer.getObjectWriter(item.getClass());
itemSerializer.write(serializer, item, i - 1, elementType, 0);
}
out.append(']');
} finally {
serializer.context = context;
}
Reported by PMD.
Line: 20
return;
}
Type elementType = null;
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
Reported by PMD.
Line: 20
return;
}
Type elementType = null;
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
Reported by PMD.
Line: 24
if (out.isEnabled(SerializerFeature.WriteClassName)) {
if (fieldType instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) fieldType;
elementType = param.getActualTypeArguments()[0];
}
}
Enumeration<?> e = (Enumeration<?>) object;
Reported by PMD.
Line: 34
serializer.setContext(context, object, fieldName, 0);
try {
int i = 0;
out.append('[');
while (e.hasMoreElements()) {
Object item = e.nextElement();
if (i++ != 0) {
out.append(',');
Reported by PMD.
src/test/java/com/alibaba/json/bvtVO/IncomingDataPoint.java
10 issues
Line: 19
orders = {"metric", "timestamp", "value", "tags", "tsuid", "granularity", "aggregator"},
asm = true
)
public class IncomingDataPoint {
/** The incoming metric name */
private String metric;
/** The incoming timestamp in Unix epoch seconds or milliseconds */
private long timestamp;
Reported by PMD.
Line: 33
private Map<String, String> tags;
/** TSUID for the data point */
private String tsuid;
private String granularity;
private String aggregator;
Reported by PMD.
Line: 56
public IncomingDataPoint(final String metric,
final long timestamp,
final String value,
final HashMap<String, String> tags,
final String granularity,
final String aggregator) {
this.metric = metric;
this.granularity = granularity;
this.timestamp = timestamp;
Reported by PMD.
Line: 88
*/
@Override
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
Reported by PMD.
Line: 89
@Override
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
Reported by PMD.
Line: 90
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
Reported by PMD.
Line: 91
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
Reported by PMD.
Line: 92
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
Reported by PMD.
Line: 96
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
}
return buf.toString();
}
Reported by PMD.
Line: 96
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
}
return buf.toString();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SpecialTest.java
10 issues
Line: 16
count++;
}
}
System.out.println(count);
}
final static long flags;
static {
long val = 0L;
Reported by PMD.
Line: 5
import com.alibaba.fastjson.serializer.SerializerFeature;
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
Reported by PMD.
Line: 7
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
Reported by PMD.
Line: 28
}
static boolean isSpecial(char ch) {
if (ch <= 31) {
return true;
}
if (ch > '\\') { // 92
return false;
Reported by PMD.
Line: 32
return true;
}
if (ch > '\\') { // 92
return false;
}
return ((1L << (ch - 31)) & flags) != 0;
}
Reported by PMD.
Line: 44
// return false;
// }
if (ch == ' ') { // 32
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
Reported by PMD.
Line: 48
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
}
if (ch > '#' // 35
&& ch != '\\' // 92
Reported by PMD.
Line: 58
return false;
}
if (ch <= 0x1F // 31
|| ch == '\\' // 92
|| ch == '"' // 34
) {
return true;
}
Reported by PMD.
Line: 9
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
Reported by PMD.
Line: 13
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
}
System.out.println(count);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue1017.java
10 issues
Line: 13
* Created by wenshao on 11/02/2017.
*/
public class Issue1017 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
Reported by PMD.
Line: 13
* Created by wenshao on 11/02/2017.
*/
public class Issue1017 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
Reported by PMD.
Line: 17
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
Reported by PMD.
Line: 18
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
Reported by PMD.
Line: 18
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
Reported by PMD.
Line: 19
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
Reported by PMD.
Line: 19
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
Reported by PMD.
Line: 20
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
Reported by PMD.
Line: 20
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
Reported by PMD.
Line: 23
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
return pictureList;
}
public User setPictureList(List<String> pictureList) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_Set2.java
10 issues
Line: 26
set.add(new B1());
a.setList(set);
String text = JSON.toJSONString(a, SerializerFeature.WriteClassName);
System.out.println(text);
// Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set2$A\",\"list\":[{},{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set2$B1\"}]}",
// text);
ParserConfig parserConfig = new ParserConfig();
parserConfig.addAccept("com.alibaba.json.bvt");
Reported by PMD.
Line: 15
import com.alibaba.fastjson.serializer.SerializerFeature;
public class WriteClassNameTest_Set2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set2");
}
public void test_list() throws Exception {
A a = new A();
Reported by PMD.
Line: 16
public class WriteClassNameTest_Set2 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set2");
}
public void test_list() throws Exception {
A a = new A();
Set<B> set = new LinkedHashSet<B>();
Reported by PMD.
Line: 19
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Set2");
}
public void test_list() throws Exception {
A a = new A();
Set<B> set = new LinkedHashSet<B>();
set.add(new B());
set.add(new B1());
a.setList(set);
Reported by PMD.
Line: 34
parserConfig.addAccept("com.alibaba.json.bvt");
A a1 = (A) JSON.parseObject(text, Object.class, parserConfig);
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
Reported by PMD.
Line: 34
parserConfig.addAccept("com.alibaba.json.bvt");
A a1 = (A) JSON.parseObject(text, Object.class, parserConfig);
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
Reported by PMD.
Line: 35
A a1 = (A) JSON.parseObject(text, Object.class, parserConfig);
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
Reported by PMD.
Line: 35
A a1 = (A) JSON.parseObject(text, Object.class, parserConfig);
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
Reported by PMD.
Line: 36
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
private Set<B> list;
Reported by PMD.
Line: 36
Assert.assertEquals(2, a1.getList().size());
Assert.assertTrue("B", new ArrayList<B>(a1.getList()).get(0) instanceof B || new ArrayList<B>(a1.getList()).get(0) instanceof B1);
Assert.assertTrue("B1", new ArrayList<B>(a1.getList()).get(1) instanceof B || new ArrayList<B>(a1.getList()).get(1) instanceof B1);
}
private static class A {
private Set<B> list;
Reported by PMD.
src/test/java/com/alibaba/json/bvtVO/IncomingDataPoint_double.java
10 issues
Line: 19
orders = {"metric", "timestamp", "value", "tags", "tsuid", "granularity", "aggregator"},
asm = true
)
public class IncomingDataPoint_double {
/** The incoming metric name */
private String metric;
/** The incoming timestamp in Unix epoch seconds or milliseconds */
private long timestamp;
Reported by PMD.
Line: 33
private Map<String, String> tags;
/** TSUID for the data point */
private String tsuid;
private String granularity;
private String aggregator;
Reported by PMD.
Line: 56
public IncomingDataPoint_double(final String metric,
final long timestamp,
final double value,
final HashMap<String, String> tags,
final String granularity,
final String aggregator) {
this.metric = metric;
this.granularity = granularity;
this.timestamp = timestamp;
Reported by PMD.
Line: 88
*/
@Override
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
Reported by PMD.
Line: 89
@Override
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
Reported by PMD.
Line: 90
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
Reported by PMD.
Line: 91
final StringBuilder buf = new StringBuilder();
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
Reported by PMD.
Line: 92
buf.append(" metric=").append(this.metric);
buf.append(" granularity=").append(this.granularity);
buf.append(" aggregator=").append(this.aggregator);
buf.append(" ts=").append(this.timestamp);
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
Reported by PMD.
Line: 96
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
}
return buf.toString();
}
Reported by PMD.
Line: 96
buf.append(" value=").append(this.value);
if (this.tags != null) {
for (Map.Entry<String, String> entry : this.tags.entrySet()) {
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
}
}
return buf.toString();
}
Reported by PMD.