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

Investigate BOM in NUnit XML's

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      From e-mail:

      """
      I've recently updated to the NUnit 3.x console runner, and it seems that the new version of NUnit runner inserts a BOM character at the strat of the XML output.
      (https://en.wikipedia.org/wiki/Byte_order_mark)

      This is breaking the NUnit plugin because the SAXParser doesn't like the BOM character at the start of the XML file.

      Here is a screenshot of the exception in Jenkins:
      Inline images 1

      I have attached an exmaple NUnit test result which contains the BOM character - it breaks the current plugin.

      If you view the XML using a hex viewer (e.g. NotePad++ with Hex plugin), you can see the offending character:
      Inline images 2

      A possible solution to fix this issue
      (with code stolen from here: http://www.rgagnon.com/javadetails/java-handle-utf8-file-with-bom.html)

      Add some kind of method to NUnitArchiver.java that checks for the BOM in the FileInputStream and removes it if found.

      I have attached an example solution.

      I know that GitHub is designed to allow for pull requests for strangers like me to fix the issues, but I ama C# guy, not a Java guy (and I don't know how to manipulate FileInputStream objects properly!)

      If you geta chance, pleae could you fix this issue

      Many thanks
      Kalen
      """

        Attachments

        1. buildlogs.txt
          6 kB
        2. image.png
          image.png
          193 kB
        3. image.png_3
          131 kB
        4. NUnitArchiver_with_suggested_fix.java
          4 kB
        5. TestResult.xml
          7 kB
        6. TestResults.with.BOM.character.xml
          19 kB

          Activity

          Hide
          coldflu Cold Flu added a comment -

          Alex Earl Please see the two attached documents: TestResult.xml and buildlogs.txt

          Show
          coldflu Cold Flu added a comment - Alex Earl Please see the two attached documents:  TestResult.xml  and  buildlogs.txt
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java
          src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java
          src/test/resources/hudson/plugins/nunit/NUnit-issue33493.xml
          http://jenkins-ci.org/commit/nunit-plugin/3794df722384744e213d1524d545b0f9cb120159
          Log:
          Fix JENKINS-33493

          Use BOMInputStream to detect and bypass any BOM at the beginning of the file.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/nunit/NUnitReportTransformer.java src/test/java/hudson/plugins/nunit/NUnitReportTransformerTest.java src/test/resources/hudson/plugins/nunit/NUnit-issue33493.xml http://jenkins-ci.org/commit/nunit-plugin/3794df722384744e213d1524d545b0f9cb120159 Log: Fix JENKINS-33493 Use BOMInputStream to detect and bypass any BOM at the beginning of the file.
          Hide
          slide_o_mix Alex Earl added a comment -

          Will be fixed in 0.20

          Show
          slide_o_mix Alex Earl added a comment - Will be fixed in 0.20
          Hide
          coldflu Cold Flu added a comment -

          Alex Earl When is the release of 0.20?

          Show
          coldflu Cold Flu added a comment - Alex Earl When is the release of 0.20?
          Hide
          coldflu Cold Flu added a comment -

          Hi Alex Earl I sent you an email.

          Show
          coldflu Cold Flu added a comment - Hi Alex Earl I sent you an email.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              kinow Bruno P. Kinoshita
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: