• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • pmd-plugin
    • Windows 7 Premium, JDK 6(lastest update)

      When running the pmd plugin as a action post build the pluging fails parsing the pmd report output with the following error message:

      org.xml.sax.SAXParseException; systemId: http://www.w3.org/TR/html4/loose.dtd; lineNumber: 31; columnNumber: 3; La declaraciĆ³n para la entidad "HTML.Version" debe finalizar en '>'.
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.commons.digester3.Digester.parse(Digester.java:1642)
      at org.apache.commons.digester3.Digester.parse(Digester.java:1701)
      at hudson.plugins.pmd.parser.PmdParser.parse(PmdParser.java:70)
      at hudson.plugins.analysis.core.AbstractAnnotationParser.parse(AbstractAnnotationParser.java:53)
      at hudson.plugins.analysis.core.FilesParser.parseFile(FilesParser.java:306)
      at hudson.plugins.analysis.core.FilesParser.parseFiles(FilesParser.java:264)
      at hudson.plugins.analysis.core.FilesParser.parserCollectionOfFiles(FilesParser.java:215)
      at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:184)
      at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:31)
      at hudson.FilePath.act(FilePath.java:909)
      at hudson.FilePath.act(FilePath.java:882)
      at hudson.plugins.pmd.PmdPublisher.perform(PmdPublisher.java:139)
      at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:144)
      at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:333)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:754)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:707)
      at hudson.model.Run.execute(Run.java:1629)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:246)

      The text "La declaraciĆ³n para la entidad "HTML.Version" debe finalizar en '>'" means in english:"The declaration for the entity "HTML.Version" must end with '>'"

          [JENKINS-19666] PMD Plugins Fails parsing loose.dtd

          The Saxparser seems to be reading from this DTD: http://www.w3.org/TR/html401/loose.dtd, which if you go and check seems to have a weird syntax <!ENTITY % HTML.Version "//W3C//DTD HTML 4.01 Transitional//EN" I think it should be <!- ENTITY % HTML.Version "-//W3C//DTD HTML 4.01 Transitional//EN"

          Julian Borrero added a comment - The Saxparser seems to be reading from this DTD: http://www.w3.org/TR/html401/loose.dtd , which if you go and check seems to have a weird syntax <!ENTITY % HTML.Version " //W3C//DTD HTML 4.01 Transitional//EN" I think it should be <! - ENTITY % HTML.Version "-//W3C//DTD HTML 4.01 Transitional//EN"

          Ulli Hafner added a comment -

          Can you please add the pmd.xml file?

          Ulli Hafner added a comment - Can you please add the pmd.xml file?

          I'm running a Jenkins job which calls an Ant build.xml file, a fragment of this file relevant to the issue is this:

          <target name="clean-pmd-report-directory" description="clean up the directory used to store the pmd report output">
          <!-- borrar la carpeta ${build} -->
          <delete dir="${report.pmd.dir}"/>
          <mkdir dir="${report.pmd.dir}" />
          </target>

          <target name="pmd" depends="clean-pmd-report-directory">
          <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
          <pmd shortFilenames="true">
          <sourceLanguage name="java" version="1.6"/>
          <ruleset>java-unusedcode</ruleset>

          <formatter type="xml" toFile="${report.pmd.dir}/pmd_report.xml" />
          <fileset dir="${src}">
          <include name="*/.java"/>
          </fileset>
          </pmd>

          <xslt in="${report.pmd.dir}/pmd_report.xml"
          style="${pmd.home.dir}/etc/xslt/pmd-report-per-class.xslt"
          out="${report.pmd.dir}/pmd_report.html"
          />
          </target>

          Julian Borrero added a comment - I'm running a Jenkins job which calls an Ant build.xml file, a fragment of this file relevant to the issue is this: <target name="clean-pmd-report-directory" description="clean up the directory used to store the pmd report output"> <!-- borrar la carpeta ${build} --> <delete dir="${report.pmd.dir}"/> <mkdir dir="${report.pmd.dir}" /> </target> <target name="pmd" depends="clean-pmd-report-directory"> <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/> <pmd shortFilenames="true"> <sourceLanguage name="java" version="1.6"/> <ruleset>java-unusedcode</ruleset> <formatter type="xml" toFile="${report.pmd.dir}/pmd_report.xml" /> <fileset dir="${src}"> <include name="* / .java"/> </fileset> </pmd> <xslt in="${report.pmd.dir}/pmd_report.xml" style="${pmd.home.dir}/etc/xslt/pmd-report-per-class.xslt" out="${report.pmd.dir}/pmd_report.html" /> </target>

          Ulli Hafner added a comment -

          No, I need the results file....

          Ulli Hafner added a comment - No, I need the results file....

          xml file generated by the pmd Ant task.

          Julian Borrero added a comment - xml file generated by the pmd Ant task.

          Ulli Hafner added a comment -

          Hmm, I can parse the file without any problems. Did you specify the correct pattern? I wonder where that DTD is referenced...

          Ulli Hafner added a comment - Hmm, I can parse the file without any problems. Did you specify the correct pattern? I wonder where that DTD is referenced...

          the xslt used by pmd to convert the xml of the output to html, here it's referenced the dtd:

          <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
          doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>

          Julian Borrero added a comment - the xslt used by pmd to convert the xml of the output to html, here it's referenced the dtd: <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes"/>

          Ulli Hafner added a comment -

          But what pattern did you specify? Did you specify the xslt as results file? You need to specify **/pmd_report.xml.

          Ulli Hafner added a comment - But what pattern did you specify? Did you specify the xslt as results file? You need to specify **/pmd_report.xml.

          Ulli the pattern I just specified it's report/pmd/pmd_report.xml and now it worked!

          [PMD] Collecting PMD analysis files...
          [PMD] Finding all files that match the pattern report/pmd/pmd_report.xml
          [PMD] Parsing 1 files in C:\Program Files (x86)\Jenkins\workspace\xxxxxxx
          [PMD] Successfully parsed file C:\Program Files (x86)\Jenkins\workspace\xxxxxxx\report\pmd\pmd_report.xml of module with 3380 warnings.
          [PMD] Computing warning deltas based on reference build #4

          Julian Borrero added a comment - Ulli the pattern I just specified it's report/pmd/pmd_report.xml and now it worked! [PMD] Collecting PMD analysis files... [PMD] Finding all files that match the pattern report/pmd/pmd_report.xml [PMD] Parsing 1 files in C:\Program Files (x86)\Jenkins\workspace\xxxxxxx [PMD] Successfully parsed file C:\Program Files (x86)\Jenkins\workspace\xxxxxxx\report\pmd\pmd_report.xml of module with 3380 warnings. [PMD] Computing warning deltas based on reference build #4

            drulli Ulli Hafner
            saija Julian Borrero
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: