Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6922

JsonSlurper loses trailing 0's in numbers (regression in Groovy 2.3)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0, 2.4.3
    • 2.4.6
    • JSON
    • None

    Description

      In previous versions of Grails before JsonSlurper was significantly changed, this test passed. However, it fails in Groovy 2.3.x (tested up to 2.3.3).

      void testParseNumWithDecimals() {
         def i = parser.parseText('123.40')
         BigDecimal i2 = 123.40G
         assert i instanceof BigDecimal
         assert i == i2
      }
      

      This test should be added to https://github.com/groovy/groovy-core/blob/GROOVY_2_3_X/subprojects/groovy-json/src/test/groovy/groovy/json/JsonSlurperTest.groovy

      In Groovy 2.3.3, the assertion fails as i = 123.4G, not 123.40G.

      Attachments

        Issue Links

          Activity

            People

              pascalschumacher Pascal Schumacher
              candrews Craig
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: