I have multiple projects which include the same build file (parts) but all fail in the instrumentation task. The same projects run perfectly with emma-eclipse-plugin. Whenever I'm starting them from ant and console I get:
emma-compile:
[instr] processing instrumentation path ...
BUILD FAILED
com.vladium.emma.EMMARuntimeException: [UNEXPECTED_FAILURE] unexpected failure java.lang.ArrayIndexOutOfBoundsException: 164, please submit a bug report to: 'http://sourceforge.net/projects/emma'
at com.vladium.emma.instr.InstrProcessorST._run(InstrProcessorST.java:784)
at com.vladium.emma.Processor.run(Processor.java:88)
at com.vladium.emma.instr.instrTask.execute(instrTask.java:77)
at com.vladium.emma.emmaTask.execute(emmaTask.java:58)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 164
at com.vladium.emma.instr.InstrVisitor$Block.emit(InstrVisitor.java:1484)
at com.vladium.emma.instr.InstrVisitor.visit(InstrVisitor.java:1163)
at com.vladium.jcd.cls.attribute.CodeAttribute_info.accept(CodeAttribute_info.java:137)
at com.vladium.emma.instr.InstrVisitor.visit(InstrVisitor.java:465)
at com.vladium.emma.instr.InstrVisitor.visit(InstrVisitor.java:274)
at com.vladium.emma.instr.InstrVisitor.process(InstrVisitor.java:118)
at com.vladium.emma.instr.InstrProcessorST.handleFile(InstrProcessorST.java:471)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:193)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumerate(IPathEnumerator.java:97)
at com.vladium.emma.instr.InstrProcessorST._run(InstrProcessorST.java:715)
... 19 more
Total time: 1 second
the task definition is derived from the example in the user-guide:
<project name="emma">
<!-- directory that contains emma.jar and emma_ant.jar: -->
<path id="emma.lib" >
<pathelement location="${lib.build}/emma.jar" />
<pathelement location="${lib.build}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<!-- output directory used for EMMA work files and coverage reports: -->
<property name="coverage.dir" value="${output.dir}/coverage" />
<property name="instr.classes.dir" value="${output.dir}/classes-instrumented" />
<target name="emma-prepare">
<mkdir dir="${instr.classes.dir}" />
</target>
<target name="emma-compile" depends="emma-prepare, test-compile" description="turns on EMMA instrumentation/reporting" >
<property name="emma.enabled" value="true" />
<!-- EMMA instr class output directory: -->
<emma enabled="${emma.enabled}" >
<instr instrpathref="test.classpath"
destdir="${instr.classes.dir}"
metadatafile="${coverage.dir}/metadata.emma"
merge="true"
/>
</emma>
</target>
</project>
I've tried it with both available versions:
emma-stable-2.1.5320-lib.zip
emma-2.0.5312-lib-zip
MacOSX 10.6, Java 1.6.0_07-b06-153, 64 bit.
Can this bug be related to 2119913?