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

Merge issue when two files with the same name exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • coverage-plugin
    • None
    • coverage plugin: 1.15.0
      Container: jenkins/inbound-agent:3248.v65ecb_254c298-1

      My test runner creates multiple cobertura output files, one for each assembly.

      I tried to shrink down the cobertura output as much as I could while still getting the error.
      Here are two cobertura outputs. They now look similar because I truncated all the differences. One comes from AssemblyA and one from AssemblyB.

      This scenario results in the error below.

      If I go ahead and remove the class element for NamespaceA or NamespaceB the plugin is happy. If both are included it crashes.
      If I rename MyClass to MyClass1 for NamespaceA the plugin works as expected.

      <?xml version="1.0" encoding="utf-8" standalone="no"?>
      <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
      <coverage line-rate="0.02" branch-rate="0.02" lines-covered="417" lines-valid="18516" branches-covered="112" branches-valid="5820" complexity="19" version="8.8.0.0" timestamp="1715002690">
        <sources>
          <source>D:\</source>
        </sources>
        <packages>
          <package name="Domain" line-rate="0.04" branch-rate="0.03" complexity="1.95">
            <classes>
              <class name="Domain.NamespaceA.MyClass" filename="/src/Domain/NamespaceA/MyClass.cs" line-rate="0" branch-rate="0" complexity="4">
                <methods>
                  <method name="Method" signature="System.Void ()" line-rate="0" branch-rate="0" complexity="4">
                    <lines>
                      <line number="17" hits="0" branch="true" condition-coverage="0% (0/6)">
                        <conditions>
                          <condition number="3339" type="jump" coverage="0%" />
                        </conditions>
                      </line>
                    </lines>
                  </method>
                </methods>
                <lines>
                  <line number="17" hits="0" branch="true" condition-coverage="0% (0/6)">
                    <conditions>
                      <condition number="3339" type="jump" coverage="0%" />
                    </conditions>
                  </line>
                </lines>
              </class>
              <class name="Domain.NamespaceB.MyClass" filename="/src/Domain/NamespaceB/MyClass.cs" line-rate="1" branch-rate="0.6" complexity="3">
                <methods>
                  <method name="Method" signature="System.Void ()" line-rate="1" branch-rate="0.5" complexity="3">
                    <lines>
                      <line number="17" hits="2" branch="true" condition-coverage="50% (2/4)">
                        <conditions>
                          <condition number="1779" type="jump" coverage="50%" />
                        </conditions>
                      </line>
                    </lines>
                  </method>
                </methods>
                <lines>
                  <line number="17" hits="2" branch="true" condition-coverage="50% (2/4)">
                    <conditions>
                      <condition number="1779" type="jump" coverage="50%" />
                    </conditions>
                  </line>
                </lines>
              </class>
            </classes>
          </package>
        </packages>
      </coverage>
      

       

      <?xml version="1.0" encoding="utf-8" standalone="no"?>
      <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
      <coverage line-rate="0" branch-rate="0" lines-covered="93" lines-valid="36985" branches-covered="18" branches-valid="11402" complexity="61" version="8.8.0.0" timestamp="1718963829">
        <sources>
          <source>D:\</source>
        </sources>
        <packages>
          <package name="Domain" line-rate="0" branch-rate="0" complexity="1.95">
            <classes>
              <class name="Domain.NamespaceA.MyClass" filename="/src/Domain/NamespaceA/MyClass.cs" line-rate="0" branch-rate="0" complexity="4">
                <methods>
                  <method name="Validate" signature="System.Void ()" line-rate="0" branch-rate="0" complexity="4">
                    <lines>
                      <line number="17" hits="0" branch="true" condition-coverage="0% (0/6)">
                        <conditions>
                          <condition number="3339" type="jump" coverage="0%" />
                        </conditions>
                      </line>
                    </lines>
                  </method>
                </methods>
                <lines>
                  <line number="17" hits="0" branch="true" condition-coverage="0% (0/6)">
                    <conditions>
                      <condition number="3339" type="jump" coverage="0%" />
                    </conditions>
                  </line>
                </lines>
              </class>
              <class name="Domain.NamespaceB.MyClass" filename="/src/Domain/NamespaceB/MyClass.cs" line-rate="0" branch-rate="0" complexity="3">
                <methods>
                  <method name="Validate" signature="System.Void ()" line-rate="0" branch-rate="0" complexity="3">
                    <lines>
                      <line number="17" hits="0" branch="true" condition-coverage="0% (0/4)">
                        <conditions>
                          <condition number="1779" type="jump" coverage="0%" />
                        </conditions>
                      </line>
                    </lines>
                  </method>
                </methods>
                <lines>
                  <line number="17" hits="0" branch="true" condition-coverage="0% (0/4)">
                    <conditions>
                      <condition number="1779" type="jump" coverage="0%" />
                    </conditions>
                  </line>
                </lines>
              </class>
            </classes>
          </package>
        </packages>
      </coverage>
      

       

      This will result in this error:

      java.lang.IllegalArgumentException: Cannot merge coverage information for line 17 in [FILE] MyClass.cs <0>
      	at edu.hm.hafner.coverage.FileNode.mergeCounters(FileNode.java:167)
      	at edu.hm.hafner.coverage.FileNode.mergeNode(FileNode.java:139)
      	at edu.hm.hafner.coverage.Node.lambda$mergeNode$13(Node.java:769)
      	at java.base/java.util.ArrayList.forEach(Unknown Source)
      	at edu.hm.hafner.coverage.Node.mergeNode(Node.java:765)
      	at edu.hm.hafner.coverage.Node.lambda$mergeNode$13(Node.java:769)
      	at java.base/java.util.ArrayList.forEach(Unknown Source)
      	at edu.hm.hafner.coverage.Node.mergeNode(Node.java:765)
      	at edu.hm.hafner.coverage.Node.merge(Node.java:744)
      	at java.base/java.util.stream.ReduceOps$2ReducingSink.accept(Unknown Source)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
      	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
      	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
      	at java.base/java.util.stream.ReferencePipeline.reduce(Unknown Source)
      	at edu.hm.hafner.coverage.Node.merge(Node.java:711)
      	at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.aggregateResults(CoverageRecorder.java:547)
      	at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:417)
      	at io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:406)
      	at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:365)
      	at io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:333)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.base/java.lang.Thread.run(Unknown Source)
      

            drulli Ulli Hafner
            kert K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: