Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12516

java.io.IOException @ hudson.plugins.dry.parser.DuplicationParserRegistry.parse(DuplicationParserRegistry.java:80)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: dry-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      CPD is looking at .sh files and DRY's processing of the CPD results blew up.

      Looking at CPDs XML Renderer, it attempts to escape anything that would prematurely end the CDATA

      buffer.append(StringUtil.replaceString(codeFragment, "]]>", "]]>")).append(PMD.EOL + "]]>" + PMD.EOL + "</codefragment>" + PMD.
      EOL);

      Is it possible that DRY is choking in its attempt to process the contents of the CDATA block. the codefragments have hundreds of
      \
      >>
      >
      #
      &&
      >&

      that could confuse XML if not all escaped!

      21:57:45 java.io.IOException: No parser found for duplicated code results file cpd-sh.xml
      21:57:45 at hudson.plugins.dry.parser.DuplicationParserRegistry.parse(DuplicationParserRegistry.java:80)
      21:57:45 at hudson.plugins.analysis.core.FilesParser.parseFile(FilesParser.java:358)
      21:57:45 at hudson.plugins.analysis.core.FilesParser.parseFiles(FilesParser.java:317)
      21:57:45 at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:266)
      21:57:45 at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:31)
      21:57:45 at hudson.FilePath.act(FilePath.java:783)
      21:57:45 at hudson.FilePath.act(FilePath.java:765)
      21:57:45 at hudson.plugins.dry.DryPublisher.perform(DryPublisher.java:171)
      21:57:45 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:338)
      21:57:45 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      21:57:45 at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:695)
      21:57:45 at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:670)
      21:57:45 at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:648)
      21:57:45 at hudson.model.Build$RunnerImpl.post2(Build.java:162)
      21:57:45 at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:617)
      21:57:45 at hudson.model.Run.run(Run.java:1429)
      21:57:45 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      21:57:45 at hudson.model.ResourceController.execute(ResourceController.java:88)
      21:57:45 at hudson.model.Executor.run(Executor.java:238)

        Attachments

          Activity

          Hide
          drulli Ulli Hafner added a comment -

          Can you please attach the xml file? Is it valid XML?

          Show
          drulli Ulli Hafner added a comment - Can you please attach the xml file? Is it valid XML?
          Hide
          moncreaff Greg Moncreaff added a comment -

          Here is a slimmed down example that manifests the misbehavior:

          $ cat cpd-sh6.xml
          <?xml version="1.0" encoding="ANSI_X3.4-1968"?>
          <pmd-cpd>
          <duplication lines="68" tokens="1586">
          <file line="19" path="csci07/csc60/remote_copy.sh"/>
          <file line="19" path="csci08/csc90/remote_copy.sh"/>
          <codefragment>
          <![CDATA[
          #

          1. ERROR HANDLING: N/A
            #
          2. REMARKS: N/A
            #
          3. ****************************** END HEADER *************************************
            #
          1. ***************************** BEGIN PDL ***************************************
            #
          2. ****************************** END PDL ****************************************
            #
          1. ***************************** BEGIN CODE **************************************
          2. **
          3. *******************************************************************************
          1. *******************************************************************************
          2. *******************************************************************************

          if [ $# -lt 3 ]
          then
          exit 1
          fi

          1. *******************************************************************************
          2. initialize local variables
          3. shift input parameter (twice) to leave only files to copy
          4. *******************************************************************************

          files=""
          shift
          shift

          1. *******************************************************************************
          2. *******************************************************************************

          for i in $*
          do
          files="$files $directory/$i"
          done

          ]]>
          </codefragment>
          </duplication>
          </pmd-cpd>

          Also note that there are CTRL-L (looks like ^L in vi) between comment blocks back from the days people would review these with more.

          Show
          moncreaff Greg Moncreaff added a comment - Here is a slimmed down example that manifests the misbehavior: $ cat cpd-sh6.xml <?xml version="1.0" encoding="ANSI_X3.4-1968"?> <pmd-cpd> <duplication lines="68" tokens="1586"> <file line="19" path="csci07/csc60/remote_copy.sh"/> <file line="19" path="csci08/csc90/remote_copy.sh"/> <codefragment> <![CDATA[ # ERROR HANDLING: N/A # REMARKS: N/A # ****************************** END HEADER ************************************* # ***************************** BEGIN PDL *************************************** # ****************************** END PDL **************************************** # ***************************** BEGIN CODE ************************************** ** ******************************************************************************* ******************************************************************************* ******************************************************************************* if [ $# -lt 3 ] then exit 1 fi ******************************************************************************* initialize local variables shift input parameter (twice) to leave only files to copy ******************************************************************************* files="" shift shift ******************************************************************************* ******************************************************************************* for i in $* do files="$files $directory/$i" done ]]> </codefragment> </duplication> </pmd-cpd> Also note that there are CTRL-L (looks like ^L in vi) between comment blocks back from the days people would review these with more.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          pom.xml
          src/main/java/hudson/plugins/dry/parser/cpd/CpdParser.java
          src/test/java/hudson/plugins/dry/parser/cpd/CpdParserTest.java
          src/test/resources/hudson/plugins/dry/parser/cpd/issue12516.xml
          http://jenkins-ci.org/commit/dry-plugin/c26adbd5955801c6080c8ba46d10ceb3b041e595
          Log:
          [FIXED JENKINS-12516] Upgrade to Digester 3.2 which is more robust in
          parsing CDATA elements.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: pom.xml src/main/java/hudson/plugins/dry/parser/cpd/CpdParser.java src/test/java/hudson/plugins/dry/parser/cpd/CpdParserTest.java src/test/resources/hudson/plugins/dry/parser/cpd/issue12516.xml http://jenkins-ci.org/commit/dry-plugin/c26adbd5955801c6080c8ba46d10ceb3b041e595 Log: [FIXED JENKINS-12516] Upgrade to Digester 3.2 which is more robust in parsing CDATA elements.
          Hide
          dogfood dogfood added a comment -

          Integrated in plugins_dry #315
          [FIXED JENKINS-12516] Upgrade to Digester 3.2 which is more robust in (Revision c26adbd5955801c6080c8ba46d10ceb3b041e595)

          Result = SUCCESS
          Ulli Hafner :
          Files :

          • src/test/resources/hudson/plugins/dry/parser/cpd/issue12516.xml
          • src/test/java/hudson/plugins/dry/parser/cpd/CpdParserTest.java
          • src/main/java/hudson/plugins/dry/parser/cpd/CpdParser.java
          • pom.xml
          Show
          dogfood dogfood added a comment - Integrated in plugins_dry #315 [FIXED JENKINS-12516] Upgrade to Digester 3.2 which is more robust in (Revision c26adbd5955801c6080c8ba46d10ceb3b041e595) Result = SUCCESS Ulli Hafner : Files : src/test/resources/hudson/plugins/dry/parser/cpd/issue12516.xml src/test/java/hudson/plugins/dry/parser/cpd/CpdParserTest.java src/main/java/hudson/plugins/dry/parser/cpd/CpdParser.java pom.xml

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              moncreaff Greg Moncreaff
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: