[ https://issues.apache.org/jira/browse/GROOVY-11123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jörg Eichhorn updated GROOVY-11123: ----------------------------------- Description: Reproducer: {code:java} reader = new StringReader('-123.456e78') lexer = new groovy.json.JsonLexer(reader) lexer.nextToken() {code} Expected: {code:java} -123.456e78 {code} Actual: {code:java} null {code} I found JsonLexerTest.groovy contains tests for plain numbers which are _surrounded by spaces_ but I wonder why this should be required? At least it's unexpected for users like the developers of [REST-assured|https://rest-assured.io/] who pass json content from http responses without added spaces into JsonLexer (they use [their own slurper|https://github.com/rest-assured/rest-assured/blob/master/json-path/src/main/groovy/io/restassured/internal/path/json/ConfigurableJsonSlurper.groovy]). This makes REST-assured fail to support plain number responses. One more note: Groovy's own JsonSlurper successfully parses the above example, so the behaviour is inconsistent at least. was: Reproducer: {code:java} reader = new StringReader('-123.456e78') lexer = new groovy.json.JsonLexer(reader) lexer.nextToken() {code} Expected: {code:java} -123.456e78 {code} Actual: {code:java} null {code} I found JsonLexerTest.groovy contains tests for plain numbers which are _surrounded by spaces_ but I wonder why this should be required? At least it's unexpected for users like the developers of [REST-assured|https://rest-assured.io/] which pass json content from http responses without added spaces into JsonLexer (they use [their own slurper|https://github.com/rest-assured/rest-assured/blob/master/json-path/src/main/groovy/io/restassured/internal/path/json/ConfigurableJsonSlurper.groovy]). This makes REST-assured fail to support plain number responses. One more note: Groovy's own JsonSlurper successfully parses the above example, so the behaviour is inconsistent at least. > JsonLexer fails to parse number without trailing space > ------------------------------------------------------ > > Key: GROOVY-11123 > URL: https://issues.apache.org/jira/browse/GROOVY-11123 > Project: Groovy > Issue Type: Bug > Components: JSON > Affects Versions: 4.0.11, 4.0.12, 4.0.13 > Reporter: Jörg Eichhorn > Priority: Major > > Reproducer: > > {code:java} > reader = new StringReader('-123.456e78') > lexer = new groovy.json.JsonLexer(reader) > lexer.nextToken() > {code} > Expected: > {code:java} > -123.456e78 > {code} > Actual: > {code:java} > null > {code} > > I found JsonLexerTest.groovy contains tests for plain numbers which are > _surrounded by spaces_ but I wonder why this should be required? > At least it's unexpected for users like the developers of > [REST-assured|https://rest-assured.io/] who pass json content from http > responses without added spaces into JsonLexer (they use [their own > slurper|https://github.com/rest-assured/rest-assured/blob/master/json-path/src/main/groovy/io/restassured/internal/path/json/ConfigurableJsonSlurper.groovy]). > This makes REST-assured fail to support plain number responses. > One more note: Groovy's own JsonSlurper successfully parses the above > example, so the behaviour is inconsistent at least. -- This message was sent by Atlassian Jira (v8.20.10#820010)