Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
bug fixed for validate, fix #3343
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Jul 14, 2020
1 parent d3f332d commit 66c3d70
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/alibaba/fastjson/JSONValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ private boolean any() {
case '"':
next();
for (;;) {
if (eof) {
return false;
}

if (ch == '\\') {
next();
if (ch == 'u') {
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/com/alibaba/json/bvt/issue_3300/Issue3343.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.alibaba.json.bvt.issue_3300;

import com.alibaba.fastjson.JSONValidator;
import junit.framework.TestCase;

public class Issue3343 extends TestCase {
public void test_for_issue() throws Exception {
assertFalse(
JSONValidator.from("{\"name\":\"999}")
.validate());

assertTrue(
JSONValidator.from("false")
.validate());
assertEquals(JSONValidator.Type.Value,
JSONValidator.from("false")
.getType());

assertTrue(
JSONValidator.from("999").validate());
assertEquals(JSONValidator.Type.Value,
JSONValidator.from("999")
.getType());
}
}

0 comments on commit 66c3d70

Please sign in to comment.