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

groovy.util.Node plus operator assuming all children are not strings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4
    • 1.8.6, 2.0-beta-3
    • XML Processing
    • None
    • linux, eclipse,

    Description

      The attached code triggers a class cast exception because in the groovy.util.Node plus operator, lines 179-180
      https://github.com/groovy/groovy-core/blob/fc33b105f172629fc99d5b62da9e3c1adafff85c/src/main/groovy/util/Node.java

      it is assumed that all children are nodes, but the parser does not seem to create textnodes but keeping them as string, either that or some strange conversion is happening because in 179 a class cast exception is raised for a java.lang.String to groovy.util.Node illegal conversion.

      The proof of concept is the attached junit code. If the commented line is uncommented, the cast exception appears. If the text in the xml is removed, the failure does not show.

      XMLParser is being used.

      Attachments

        1. XMLParserFailure.groovy
          0.6 kB
          Jorge Gomez

        Activity

          People

            paulk Paul King
            escalope Jorge Gomez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: