groovy
  1. groovy
  2. GROOVY-5224

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.4
    • Fix Version/s: 1.8.6, 2.0-beta-3
    • Component/s: XML Processing
    • Labels:
      None
    • Environment:
      linux, eclipse,
    • Testcase included:
      yes
    • Number of attachments :
      1

      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.

        Activity

          People

          • Assignee:
            Paul King
            Reporter:
            Jorge Gomez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: