mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-29 14:10:25 +08:00
bug fixed for issue #3460, JSONValidator.supportMultiValue default false
This commit is contained in:
@@ -16,7 +16,7 @@ public abstract class JSONValidator implements Cloneable, Closeable {
|
||||
protected Type type;
|
||||
|
||||
protected int count = 0;
|
||||
protected boolean supportMultiValue = true;
|
||||
protected boolean supportMultiValue = false;
|
||||
|
||||
public static JSONValidator fromUtf8(byte[] jsonBytes) {
|
||||
return new UTF8Validator(jsonBytes);
|
||||
@@ -38,8 +38,9 @@ public abstract class JSONValidator implements Cloneable, Closeable {
|
||||
return supportMultiValue;
|
||||
}
|
||||
|
||||
public void setSupportMultiValue(boolean supportMultiValue) {
|
||||
public JSONValidator setSupportMultiValue(boolean supportMultiValue) {
|
||||
this.supportMultiValue = supportMultiValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.alibaba.json.bvt.issue_3400;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONValidator;
|
||||
import com.alibaba.json.bvt.issue_3200.Issue3293;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
/**
|
||||
* Description: <br>
|
||||
*
|
||||
* @author byw
|
||||
* @create 2020/9/20
|
||||
*/
|
||||
public class Issue3460 extends TestCase {
|
||||
|
||||
public void test_for_issue() throws Exception {
|
||||
String body = "11{\"time\":" + System.currentTimeMillis() + "}";
|
||||
|
||||
assertFalse(
|
||||
JSONValidator.from(body)
|
||||
.validate());
|
||||
|
||||
assertTrue(
|
||||
JSONValidator.from(body)
|
||||
.setSupportMultiValue(true)
|
||||
.validate());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user