[ 
https://issues.apache.org/jira/browse/GROOVY-7234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-7234.
---------------------------------
    Resolution: Fixed

> NullPointer Exception introduced in  2.3.1 and greater with JsonSlurper
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-7234
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7234
>             Project: Groovy
>          Issue Type: Bug
>          Components: JSON
>    Affects Versions: 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 
> 2.3.9, 2.4.0-rc-1
>         Environment: OS: Ubuntu 14.04 LTS
> Java: JDK 1.7.0_65, vendor: Oracle Corporation 24.65-b04
> Gradle 2.2.1
> OS: Ubuntu 12.04 LTS
> Java version: JDK 1.7.0_72, vendor: Oracle Corporation
> Gradle 2.2.1
>            Reporter: Sam Gleske
>            Priority: Major
>
> When traversing a HashMap that was created from a parsed JSON file my unit 
> tests start failing on Groovy versions 2.3.1 and later.  There seems to be 
> some sort of regression introduced.
> To explore and debug this problem you may view my travis builds testing the 
> latest versions of Groovy from 1.8.9 through 2.3.9.
> https://travis-ci.org/samrocketman/jervis/builds/45526838
> If you would like to check out and debug the problem yourself you can do the 
> following:
> git clone https://github.com/samrocketman/jervis.git
> cd jervis
> git checkout 2590bf2be5f8f2aaa1a25bcd63912506059da8c7
> #passing build
> GROOVY_VERSION="2.3.0" ./gradlew check
> #first failing build
> GROOVY_VERSION="2.3.1" ./gradlew check
> gradlew check will automatically download Gradle 2.2.1, download the version 
> of Groovy requested, assemble dependencies, compile, and execute unit tests.
> [EDIT by blackdrag]
> the issue can be reduced to this test{code:Java}
> import groovy.json.JsonSlurper
> def jsonSlurper = new JsonSlurper() 
> def object = jsonSlurper.parseText('{ "o": {"name":"John Doe" }}')
> assert object instanceof Map
> assert object.o instanceof Map
> assert object.o.name == "John Doe"
> assert object.o[null] == null
> {code}
> the code is confirmed to work on 1.8.9 and in several versions of 2.0, 2.1 
> and 2.2. It seems to start failing in 2.3 (first tested version was 2.3.1)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to