Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.8.6, 2.0-beta-3
-
Component/s: JSON
-
Labels:None
-
Environment:Ubuntu Linux 11.10 32-bit,
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
OpenJDK Server VM (build 20.0-b11, mixed mode)
-
Number of attachments :
Description
Whenever I try to deserialize a JSON Object with a String that ends with a correctly escaped backslash "
", it throws an exception:
Caught: groovy.json.JsonException: Expected a value on line: 1, column: 25.
But got an unterminated object.
groovy.json.JsonException: Expected a value on line: 1, column: 25.
But got an unterminated object.
at JsonSlurperBug.run(JsonSlurperBug.groovy:9)
I've attached a small repro.
Activity
Guillaume Laforge
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Guillaume Laforge [ guillaume ] |
Guillaume Laforge
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.6 [ 18245 ] | |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
This is worse than it appears - if you have an element after the offending escaped backslash, the parseText statement hangs (indefinitely? I've waited 20 minutes)
{"InstallLocation":"C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5","a":"b"}works:
throws exception:
{"InstallLocation":"C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\"}hangs:
{"InstallLocation":"C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\","a":"b"}Windows 7 x64, groovy-all-1.8.4, Java 1.6.0.24, IntelliJ Idea 10.5.4