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

Investigate BOM in NUnit XML's

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • nunit-plugin
    • None

      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
      """

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

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

              Created:
              Updated:
              Resolved: