This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2641 from JacceYang/fix_issue2638
fix issue 2638[解析非法字符串JSON.parseObject("}",JaveBean.class ) 没有抛出异常,测试"] " 可以抛出]
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/test/java/com/alibaba/fastjson/deserializer/issue2638/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.alibaba.fastjson.deserializer.issue2638; | ||
|
||
class Person { | ||
private String name; | ||
private Integer age; | ||
|
||
public Person(){} | ||
|
||
public Person(String name, Integer age) { | ||
super(); | ||
this.name = name; | ||
this.age = age; | ||
} | ||
public String getName() { | ||
return name; | ||
} | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
public Integer getAge() { | ||
return age; | ||
} | ||
public void setAge(Integer age) { | ||
this.age = age; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/com/alibaba/fastjson/deserializer/issue2638/TestIssue2638.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.alibaba.fastjson.deserializer.issue2638; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @Author:JacceYang chaoyang_sjtu@126.com | ||
* @Description: | ||
* @Data:Initialized in 7:54 PM 2019/8/17 | ||
**/ | ||
public class TestIssue2638 { | ||
|
||
@Test | ||
public void testBug2638() { | ||
String str="}"; | ||
JSON.parseObject(str,Person.class); | ||
} | ||
} |