alibaba / alibaba/fastjson2

[BUG]

Open
#1,251 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

scala 2.11
fastjson 2.0.23

测试代码
```scala
object Test {
def main(args: Array[String]): Unit = {
val s =
"""
|[fd listen socket: /tmp/dev_dc1_pubvsnutlog2v1.2.23.sock]
|""".stripMargin
println(JSON.isValidArray(s))
val validator = JSONValidator.from(s)
println(validator.getType)
JSON.parseArray(s)
}
}
```

结果:
true
Array
Exception in thread "main" com.alibaba.fastjson.JSONException: syntax error : s
at com.alibaba.fastjson.JSON.parseArray(JSON.java:1976)
at Test$.main(Test.scala:22)
at Test.main(Test.scala)
Caused by: com.alibaba.fastjson2.JSONException: syntax error : s
at com.alibaba.fastjson2.JSONReader.readBoolValue(JSONReader.java:1773)
at com.alibaba.fastjson2.reader.ObjectReaderImplObject.readObject(ObjectReaderImplObject.java:275)
at com.alibaba.fastjson2.JSONReader.read(JSONReader.java:1376)
at com.alibaba.fastjson.JSON.parseArray(JSON.java:1967)
... 2 more

Process finished with exit code 1

两种判断方式都有问题

Contributor guide

Open the contributing guide

Research direction

Reproduce the Scala 2.11 case using the Test.scala example and fastjson 2.0.23. Start with JSON.isValidArray and JSON.parseArray in JSON.java, then follow the JSONReader and ObjectReaderImplObject stack frames; done means the validation and parsing behavior is consistent for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, scala
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.