Export to GitHub

undercover - issue #2

IndexOutOfBoundsException


Posted on Oct 16, 2009 by Happy Horse

executing undercover 0.8.1 on Mac OS X with mvn undercover:undercover-maven-plugin:undercover or mvn site

gives

java.lang.IndexOutOfBoundsException: Index: 90, Size: 86 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at undercover.report.SourceItem.addUpLineCoverage(SourceItem.java:103) at undercover.report.SourceItem.addBlock(SourceItem.java:53) at undercover.report.ReportDataBuilder.visit(ReportDataBuilder.java:134) at undercover.data.BlockMeta.accept(BlockMeta.java:18) at undercover.data.MethodMeta.accept(MethodMeta.java:26) at undercover.data.ClassMeta.accept(ClassMeta.java:53) at undercover.data.MetaData.accept(MetaData.java:51) at undercover.report.ReportDataBuilder.build(ReportDataBuilder.java:57) at undercover.maven.ReportMojo.executeReport(ReportMojo.java:149) at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:90) at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:65) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java: 678) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExec utor.java:553) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:5 23) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecy cleExecutor.java:371) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecu tor.java:332) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Comment #1

Posted on Nov 12, 2009 by Massive Cat

Could you send me a debug log? I added debug messages and deployed 0.9-SNAPSHOST to snapshot repository. Try "mvn -X undercover:undercover-maven-plugin:undercover" with 0.9-SNAPSHOT and post(or send me) the log.

Comment #2

Posted on Nov 12, 2009 by Massive Cat

(No comment was entered for this change.)

Comment #3

Posted on Nov 12, 2009 by Happy Horse

It seems I cannot reproduce this problem. I don't remember the exact revision of my code in which I got this error, and I can't get this stacktrace with neither 0.9-SNAPSHOT nor 0.8.1 now.

Comment #4

Posted on Nov 12, 2009 by Massive Cat

It's strange error. The error can appear when the source file doesn't match to the classfile.

Comment #5

Posted on Nov 13, 2009 by Happy Horse

I must have mentioned that it appear in scala project.

Comment #6

Posted on Mar 3, 2010 by Grumpy Camel

I tried undercover today with the Scala compiler and library, and i hit this bug. Here's what I did (I instrumented only the library)

  • check out the scala trunk from svn (http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk)
  • copy the .jars to lib/undercover/*.jar
  • modify build.xml (see below)
  • run "ant quick-instrumented.lib"
  • run the interpreter using the instrumented library: java -Dundercover.coveragedata.saveOnExit=true -Dundercover.coveragedata.file=undercover.cd -cp build/quick/classes/compiler:build/quick-instrumented/classes/library/classes:lib/fjbg.jar:lib/undercover/undercover-0.8.2.jar:lib/undercover/asm-all-3.2.jar:lib/undercover/commons-lang-2.5.jar scala.tools.nsc.MainGenericRunner

  • run "ant undercover-report", see the stack trace.

When I remove the "sourcepath" in "undercover-report" there's no crash.

Sorry about the lengthy procedure, but i'd be interested if you can reproduce it.

Thanks: Lukas Rytz

Comment #7

Posted on Sep 23, 2010 by Massive Rhino

I have the same problem with a Scala project. The log is attached.

Attachments

Comment #8

Posted on Oct 12, 2010 by Massive Cat

Thank you for your reporting this problem victorbilyk, rytz.epfl, py4fun.

I guess the problem is caused by the Scala compiler. The Scala compiler puts none-existing line numbers on the bytecode. For example, py4fun's Options.scala file has only 28 lines. But the bytecode says the equals method of the Options class appears on line 19 and 41.

I fixed the problem. Try 0.8.3-SNAPSHOT on the snapshot repository.

Comment #9

Posted on Dec 12, 2010 by Massive Cat

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium