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

findAll{it.name() returns an error

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.3.9, 2.4.0-rc-2
    • Fix Version/s: None
    • Component/s: XML Processing
    • Labels:
      None

      Description

      After a node was added ore changed, findAll

      {it.name() ==.... does not work anymore. -> "groovy.lang.MissingMethodException: No signature of method: java.lang.String.name() is applicable for argument types: () values: [] Possible solutions: take(int), any(), any(groovy.lang.Closure), wait(), dump(), next() error at line: 46" The same code works with groovy 1.8.xxx Example: {code:Java}

      // node where new node have to be inserted into
      def rootNode = records.'**'.findAll

      {it.name() == parentNode1}[0]
      if (parentNode2 != '') {rootNode = rootNode.findAll{it.name() == parentNode2}[0]}
      if (parentNode3 != '') {rootNode = rootNode.findAll{it.name() == parentNode3}[0]}
      if (parentNode4 != '') {rootNode = rootNode.findAll{it.name() == parentNode4}[0]}
      if (parentNode5 != '') {rootNode = rootNode.findAll{it.name() == parentNode5}[0]}
      def childNode = rootNode.children()
      def count = childNode.size()

      if (insertPosition == ''){insertPosition = count}

      if (childNode.find{it.name() == szAttribute})
      {
      rootNode.findAll{it.name() == szAttribute}[0].setValue(szValue)
      AttrModiState = 'MODIFIED'
      }
      else
      { childNode.add(insertPosition.toInteger(), new XmlParser(false,false).parseText('<'+szAttribute+'>'+szValue+'</'+szAttribute+'>')) AttrModiState = 'INSERTED' }
      
      

      rootNode = records.'**'.findAll{it.name() == parentNode1}

      [0] --> line where error occurs

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              uniquare Blaha Horst

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment