Cobertura generates 0 byte classes when run during reporting since release of 
maven 2.0.2
-----------------------------------------------------------------------------------------

         Key: MOJO-299
         URL: http://jira.codehaus.org/browse/MOJO-299
     Project: Mojo
        Type: Bug

  Components: cobertura  
    Versions: 2.0    
 Environment: runnon mac OSX 10.4.5 with java 1.4.2
    Reporter: Dave Sag
 Attachments: coberturaTest.zip

Cobertura was working fine with maven 2.0 but since the release of maven 2.0.2 
Cobertura still instruments the code fine in the build phase and the tests run, 
but when iIthen go to generate the site I get the following:

(disco-davesag) [13:51:18] ~/checkouts/EPO/coberturaTest$ mvn site
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building Dummy project to demonstrate a bug in the cobertura plugin
[INFO]    task-segment: [site]
[INFO] 
----------------------------------------------------------------------------
[INFO] artifact org.apache.maven.plugins:maven-site-plugin: checking for 
updates from snapshots
[INFO] snapshot org.apache.maven.plugins:maven-site-plugin:2.0-SNAPSHOT: 
checking for updates from snapshots
[WARNING] POM for 'log4j:log4j:pom:1.2.12' is invalid. It will be ignored for 
artifact resolution. Reason: Not a v4.0.0 POM.
[INFO] Setting property: classpath.resource.loader.class => 
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] ************************************************************** 
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: 
org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class 
org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: 
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class 
org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any 
resource loader.
[INFO] Velocimacro : error using  VM library template VM_global_library.vm : 
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource 'VM_global_library.vm'
[INFO] Velocimacro :  VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT 
replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be  
global in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] artifact org.codehaus.mojo:surefire-report-maven-plugin: checking for 
updates from snapshots
[INFO] snapshot 
org.codehaus.mojo:surefire-report-maven-plugin:2.0-beta-2-SNAPSHOT: checking 
for updates from snapshots
[INFO] artifact org.apache.maven.plugins:maven-project-info-reports-plugin: 
checking for updates from snapshots
[INFO] Preparing cobertura:cobertura
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [cobertura:instrument {execution: instrument-classes}]
[INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 2 classes.
Instrumenting 4 classes to 
/Users/davesag/checkouts/EPO/coberturaTest/target/generated-classes/cobertura
Cobertura: Saved information on 2 classes.
Instrument time: 359ms

[INFO] Instrumentation was successful.
[INFO] [cobertura:instrument]
[INFO] Cobertura 1.7 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 2 classes.
Instrumenting 4 classes to 
/Users/davesag/checkouts/EPO/coberturaTest/target/generated-classes/cobertura
[cobertura] WARN  [main] net.sourceforge.cobertura.instrument.Main - Unable to 
instrument file 
/Users/davesag/checkouts/EPO/coberturaTest/target/generated-classes/cobertura/com/davesag/Something.class
java.lang.ArrayIndexOutOfBoundsException: 8
        at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:286)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:364)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:382)
        at 
net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:440)
        at net.sourceforge.cobertura.instrument.Main.main(Main.java:462)
[cobertura] WARN  [main] net.sourceforge.cobertura.instrument.Main - Unable to 
instrument file 
/Users/davesag/checkouts/EPO/coberturaTest/target/generated-classes/cobertura/com/davesag/Thing.class
java.lang.ArrayIndexOutOfBoundsException: 8
        at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at org.objectweb.asm.ClassReader.<init>(Unknown Source)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:286)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:364)
        at 
net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:382)
        at 
net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:440)
        at net.sourceforge.cobertura.instrument.Main.main(Main.java:462)
Cobertura: Saved information on 2 classes.
Instrument time: 441ms

[INFO] Instrumentation was successful.
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Setting reports dir: 
/Users/davesag/checkouts/EPO/coberturaTest/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
java.lang.ClassFormatError: com/davesag/Thing (Truncated class file)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at 
org.codehaus.surefire.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:61)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:1655)
        at java.lang.Class.getMethod0(Class.java:1901)
        at java.lang.Class.getMethod(Class.java:984)
        at 
org.codehaus.surefire.battery.JUnitBattery.<init>(JUnitBattery.java:126)
        at 
org.codehaus.surefire.Surefire.instantiateBatteries(Surefire.java:318)
        at org.codehaus.surefire.Surefire.run(Surefire.java:130)
        at org.codehaus.surefire.Surefire.run(Surefire.java:77)
        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:324)
        at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
        at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:303)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:859)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:731)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:522)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        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:324)
        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)
RUN ABORTED
java.lang.ClassFormatError
org.codehaus.surefire.Runner
An exception or error caused a run to abort.
com/davesag/Thing (Truncated class file)

Results :
[surefire] Tests run: 0, Failures: 0, Errors: 1

[INFO] 
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] There are some test failure.
[INFO] 
----------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] 
----------------------------------------------------------------------------
[INFO] Total time: 39 seconds
[INFO] Finished at: Fri Feb 17 13:52:07 CET 2006
[INFO] Final Memory: 10M/21M
[INFO] 
----------------------------------------------------------------------------


see test project attached.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to