title: SonarQube Cannot Read the lcov.info for JavaScript
body: <p>I am using karma-coverage together with isparta-loader in my JavaScript unit test to generate the <code>lcov.info</code> file.</p>
  
  <p>However, when I run the SonarQube analysis using <a href="http://docs.sonarqube.org/display/PLUG/JavaScript+Plugin" rel="nofollow noreferrer">JavaScript Plugin</a>, the test coverage report is not generated. If the <code>lcov.info</code> contains data for 1 file, the coverage report is not failing, but if the <code>lcov.info</code> contains data for 2 files or more, then it always fail at:</p>
  
  <blockquote>
    <p>13:43:27.635 INFO  - Store results in database
        13:43:27.649 DEBUG - Execute org.sonar.batch.phases.GraphPersister
        13:43:27.714 DEBUG - Execute org.sonar.batch.index.SourcePersister
        13:43:29.852 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@6b1e6f8b[id=7859,key=func.salesorder
        NG,qualifier=TRK], with key batch-func.salesorderNG
        INFO: ------------------------------------------------------------------------
        INFO: EXECUTION FAILURE
        INFO: ------------------------------------------------------------------------
        Total time: 4:14.804s
        Final Memory: 23M/828M
        INFO: --------------------------------------------------------------------</p>
    
    <p>ERROR: Error during Sonar runner execution<br>
        org.sonar.runner.impl.RunnerException: Unable to execute Sonar
                at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
                at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
                at java.security.AccessController.doPrivileged(Native Method)
                at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
                at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
                at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
                at org.sonar.runner.api.Runner.execute(Runner.java:100)
                at org.sonar.runner.Main.executeTask(Main.java:70)
                at org.sonar.runner.Main.execute(Main.java:59)
                at org.sonar.runner.Main.main(Main.java:53) Caused by: java.lang.IllegalStateException: Unable to save file sources
                at org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:84)
                at org.sonar.batch.phases.DatabaseModePhaseExecutor.executePersisters(DatabaseModePhaseExecutor.java:165)
                at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:133)
                at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
                at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
                at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
                at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
                at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
                at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
                at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
                at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
                at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
                at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
                at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
                at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
                at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
                at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
                at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
                at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
                at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
                ... 9 more Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
                at java.util.ArrayList.elementData(Unknown Source)
                at java.util.ArrayList.get(Unknown Source)
                at com.google.protobuf.RepeatedFieldBuilder.getBuilder(RepeatedFieldBuilder.java:245)
                at org.sonar.server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911)
                at org.sonar.batch.index.SourceDataFactory.applyLineMeasure(SourceDataFactory.java:183)
                at org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117)
                at org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76)
                at org.sonar.batch.index.SourcePersister.computeData(SourcePersister.java:152)
                at org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93)
                at org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81)
                ... 33 more</p>
  </blockquote>
  
  <p>The <code>lcov.info</code> shows the following information:</p>
  
  <pre><code>SF:D:\SOC\src\UI\UI.ng\js\general\services\tabStateService.js
  FN:3,_interopRequireDefault
  FN:11,(anonymous_2)
  FN:14,tabStateService
  FN:17,moveNext
  FNF:4
  FNH:4
  FNDA:1,_interopRequireDefault
  FNDA:1,(anonymous_2)
  FNDA:21,tabStateService
  FNDA:2,moveNext
  DA:0,1
  DA:1,1
  DA:4,1
  DA:5,1
  DA:8,1
  DA:9,21
  DA:10,21
  DA:12,2
  LF:8
  LH:8
  BRDA:3,1,0,0
  BRDA:3,1,1,1
  BRDA:3,2,0,1
  BRDA:3,2,1,1
  BRF:4
  BRH:4
  end_of_record
  TN:
  SF:D:\SOC\src\UI\UI.ng\js\general\services\pagingService.js
  FN:5,(anonymous_1)
  FN:8,pagingService
  FN:14,getPagingParams
  FN:20,calculateSkip
  FNF:4
  FNH:4
  FNDA:1,(anonymous_1)
  FNDA:23,pagingService
  FNDA:11,getPagingParams
  FNDA:7,calculateSkip
  DA:1,1
  DA:3,1
  DA:4,1
  DA:7,1
  DA:9,23
  DA:13,1
  DA:14,11
  DA:15,2
  DA:16,9
  DA:17,7
  DA:18,2
  DA:21,1
  DA:22,7
  LF:13
  LH:13
  BRDA:15,1,0,2
  BRDA:15,1,1,9
  BRDA:15,2,0,11
  BRDA:15,2,1,9
  BRDA:16,3,0,7
  BRDA:16,3,1,2
  BRDA:16,4,0,9
  BRDA:16,4,1,7
  BRF:8
  BRH:8
  end_of_record
  </code></pre>