The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Issue798.java
3 issues
Line: 10
* Created by wenshao on 16/8/29.
*/
public class Issue798 extends TestCase {
public void test_for_issue() throws Exception {
Model model = new Model();
model.value = " 主要学校:密歇根大学 安娜堡分校、东密西根大学、 克莱利学院�、康考迪亚学院 �、瓦什特洛社区学院� ";
String json = JSON.toJSONString(model);
Model model2 = JSON.parseObject(json, Model.class);
Reported by PMD.
Line: 16
String json = JSON.toJSONString(model);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(model.value, model2.value);
}
public static class Model {
public String value;
}
Reported by PMD.
Line: 20
}
public static class Model {
public String value;
}
}
Reported by PMD.
src/main/java/com/alibaba/fastjson/serializer/SerializerFeature.java
3 issues
Line: 177
return (features & mask) != 0 || (featuresB & mask) != 0;
}
public static int config(int features, SerializerFeature feature, boolean state) {
if (state) {
features |= feature.mask;
} else {
features &= ~feature.mask;
}
Reported by PMD.
Line: 177
return (features & mask) != 0 || (featuresB & mask) != 0;
}
public static int config(int features, SerializerFeature feature, boolean state) {
if (state) {
features |= feature.mask;
} else {
features &= ~feature.mask;
}
Reported by PMD.
Line: 187
return features;
}
public static int of(SerializerFeature[] features) {
if (features == null) {
return 0;
}
int value = 0;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue89.java
3 issues
Line: 11
public class Issue89 extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parse("{\"a\":з」∠)_,\"}");
} catch (Exception ex) {
error = ex;
Reported by PMD.
Line: 15
Exception error = null;
try {
JSON.parse("{\"a\":з」∠)_,\"}");
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
}
Reported by PMD.
Line: 12
public class Issue89 extends TestCase {
public void test_for_issue() throws Exception {
Exception error = null;
try {
JSON.parse("{\"a\":з」∠)_,\"}");
} catch (Exception ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue894.java
3 issues
Line: 11
* Created by wenshao on 10/03/2017.
*/
public class Issue894 extends TestCase {
public void test_for_issue() throws Exception {
String str = String.valueOf(Double.MAX_VALUE);
Throwable error = null;
try {
JSON.parseObject(str, short.class);
} catch (JSONException ex) {
Reported by PMD.
Line: 19
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
}
Reported by PMD.
Line: 13
public class Issue894 extends TestCase {
public void test_for_issue() throws Exception {
String str = String.valueOf(Double.MAX_VALUE);
Throwable error = null;
try {
JSON.parseObject(str, short.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue900.java
3 issues
Line: 11
* Created by wenshao on 2016/11/17.
*/
public class Issue900 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class, Feature.SupportNonPublicField);
assertEquals(123, model.id);
}
public static class Model {
Reported by PMD.
Line: 13
public class Issue900 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class, Feature.SupportNonPublicField);
assertEquals(123, model.id);
}
public static class Model {
private int id;
}
Reported by PMD.
Line: 17
}
public static class Model {
private int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue900_1.java
3 issues
Line: 12
* Created by wenshao on 2016/11/18.
*/
public class Issue900_1 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class);
assertEquals(123, model.id);
}
@JSONType(parseFeatures = Feature.SupportNonPublicField)
Reported by PMD.
Line: 14
public class Issue900_1 extends TestCase {
public void test_for_issue() throws Exception {
Model model = JSON.parseObject("{\"id\":123}", Model.class);
assertEquals(123, model.id);
}
@JSONType(parseFeatures = Feature.SupportNonPublicField)
public static class Model {
private int id;
Reported by PMD.
Line: 19
@JSONType(parseFeatures = Feature.SupportNonPublicField)
public static class Model {
private int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue942.java
3 issues
Line: 13
* Created by wenshao on 19/12/2016.
*/
public class Issue942 extends TestCase {
public void test_for_issue() throws Exception {
final String pattern = "yyyy-MM-dd HH:mm:ss";
LocalDateTime dateTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
Reported by PMD.
Line: 21
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
String text = JSON.toJSONStringWithDateFormat(dateTime, pattern);
assertEquals(JSON.toJSONString(formatter.format(dateTime)), text);
}
}
Reported by PMD.
Line: 21
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
String text = JSON.toJSONStringWithDateFormat(dateTime, pattern);
assertEquals(JSON.toJSONString(formatter.format(dateTime)), text);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FluentSetterTest.java
3 issues
Line: 11
public class FluentSetterTest extends TestCase {
public void test_fluent() throws Exception {
B b = new B();
b.setId(1001);
b.setValue(1002);
String text = JSON.toJSONString(b);
Reported by PMD.
Line: 20
Assert.assertEquals("{\"id\":1001,\"value\":1002}", text);
B b1 = JSON.parseObject(text, B.class);
Assert.assertEquals(b.getId(), b1.getId());
Assert.assertEquals(b.getValue(), b1.getValue());
}
public static class A {
Reported by PMD.
Line: 21
B b1 = JSON.parseObject(text, B.class);
Assert.assertEquals(b.getId(), b1.getId());
Assert.assertEquals(b.getValue(), b1.getValue());
}
public static class A {
private int id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FloatFieldTest.java
3 issues
Line: 15
user.setValue(1001F);
String text = JSON.toJSONString(user);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertTrue(user1.getValue() == user.getValue());
}
Reported by PMD.
Line: 10
public class FloatFieldTest extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(1001F);
String text = JSON.toJSONString(user);
System.out.println(text);
Reported by PMD.
Line: 19
User user1 = JSON.parseObject(text, User.class);
Assert.assertTrue(user1.getValue() == user.getValue());
}
public static class User {
private float value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FileFieldTest.java
3 issues
Line: 14
public class FileFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 28
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.