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

Plugin can't handle UTF-8 with BOM marker (OpenCover and Cobertura)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • coverage-plugin
    • None
    • Coverage Plugin Version 1.9.0

      I am generating test reports using coverlet. I tried openCover and cobertura as output formats.

      Sadly, in both cases an UTF-8 BOM encoded file is created (which I can't control).

       

      This is the resulting log.

       
      [Coverage] [-ERROR-] Errors during parsing
      [Coverage] [-ERROR-] Parsing of file 'My\Path\coverage.opencover.xml' failed due to an exception:
      [Coverage] [-ERROR-] javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
      Message: Content ist nicht zulässig in Prolog. (Translation: Content is not allowed in polog)
      [Coverage] [-ERROR-] at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
      [Coverage] [-ERROR-] at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
      [Coverage] [-ERROR-] at edu.hm.hafner.coverage.parser.OpenCoverParser.parseReport(OpenCoverParser.java:97)
      [Coverage] [-ERROR-] [wrapped] edu.hm.hafner.util.SecureXmlParserFactory$ParsingException: Exception occurred during parsing
      XMLStreamException: ParseError at [row,col]:[1,1]
      Message: Content ist nicht zulässig in Prolog.
      javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
      Message: Content ist nicht zulässig in Prolog.
      at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
      at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
      at edu.hm.hafner.coverage.parser.OpenCoverParser.parseReport(OpenCoverParser.java:97)
      at edu.hm.hafner.coverage.CoverageParser.parse(CoverageParser.java:80)
       

      The file itself looks normal at the beginning:

      <?xml version="1.0" encoding="utf-8"?>
      <coverage line-rate="0.0204" branch-rate="0.028300000000000002" version="1.9" timestamp="1706036193" lines-covered="359" lines-valid="17587" branches-covered="111" branches-valid="3920">
        <sources>
          <source>C:\my\workspace\</source>
        </sources>
        <packages>

            drulli Ulli Hafner
            smdoble Do
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: