Empty StringBuilder causes No state found: INIT EOF
See original GitHub issueHi guys
I was doing unit test on my application and I discovered that sending a empty StringBuilder causes a crash. I think that you be good to detect it before start the parsing and then, return a empty JsonObject
or JsonArray
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Reading a web page in Java IOException Premature EOF
This may be because you are reading the content line by line and for the last line the file may be missing a...
Read more >StringBuilder (Java Platform SE 8 ) - Oracle Help Center
A mutable sequence of characters. This class provides an API compatible with StringBuffer , but with no guarantee of synchronization.
Read more >How to Check if StringBuilder Is Empty - Code Maze
Check if StringBuilder Is Empty Using the Length Property The StringBuilder class has a property named Length that shows how many Char objects ......
Read more >Bug descriptions — spotbugs 4.7.3 documentation
This implementation of equals(Object) violates the contract defined by java.lang.Object.equals() because it does not check for null being passed as the argument ...
Read more >java.io.EOFException - How to solve EOFException - 2022
In this tutorial we will discuss about the EOFException in Java. This exception indicates the the end of file (EOF), or the end...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Almost every parser of JSON will throw unexpected end of input. A JSON parser will look for a valid start token, such as
STRING
,TRUE
,FALSE
,OPEN_BRACE
,OPEN_BRACKET
orQUOTE
. But, in that case, after trying all these, the found token wasEOF
, therefore it was unexpected.It’s default behavior, as you can see on Chrome default JavaScript implementation.
The behavior is correct, @ppamorim. According to any JSON RFC specification, the first entry must be a JSON-valid expression. Empty string is a syntax error. No matches for
"
,{
,[
,\d
,true
,false
or any other valid start token.