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

DGM#denormalize - Mac style line breaks and empty string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-1
    • 1.6-rc-2, 1.5.8, 1.7-beta-1
    • groovy-jdk
    • None
    • Groovy 1.5.8, 1.6, trunk.

    Description

      DGM#denormalize, in contrast to DGM#normalize, does not handle Mac style line breaks correctly. It throws an IndexOutOfBoundsException with empty strings.

      Attached a patch that solves this. It does not need an import of PlatformLineWriter and throws no IOException anymore.

      The patch also contains an alternative implementation of DGM#normalize it has speedup factors of 0.66 to 8 compared with the current implementation. However I don't know if it would have any practical worth to replace the current implementation.

      The second patch adds tests to DefaultGroovyMethodsTest.

      Additionally, I would like to discuss if DGM#normalize should really remove the last trailing linefeed.

      Attachments

        1. patch-DGMTest-trunk.txt
          3 kB
          Alexander Veit
        2. patch-DGM-trunk.txt
          3 kB
          Alexander Veit

        Issue Links

          Activity

            People

              Unassigned Unassigned
              veita Alexander Veit
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: