GithubHelp home page GithubHelp logo

cobertura / cobertura Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christ66/cobertura

1.0K 1.0K 276.0 27.82 MB

Cobertura

License: GNU General Public License v2.0

Shell 0.19% Java 85.86% HTML 8.16% JavaScript 1.54% CSS 1.14% PHP 1.73% Groovy 1.08% Batchfile 0.28% Hack 0.02%

cobertura's Introduction

COBERTURA

Build Status

ABOUT

Cobertura is a free Java code coverage reporting tool. It is based on jcoverage 1.0.5. See the Cobertura web page and wiki for more details.

Since 2.0.0, Cobertura versions follow the Semantic versioning guidelines.

DOWNLOAD

You can download Cobertura from The Central Repository. That includes the distributions for stand-alone command line usage.

To use it as Maven dependency, you can use the following snippet:

<dependency>
    <groupId>net.sourceforge.cobertura</groupId>
    <artifactId>cobertura</artifactId>
    <version>2.1.1</version>
    <scope>test</scope>
</dependency>

COPYRIGHT

Code in the net.sourceforge.cobertura.javancss package is Copyright (C) 2000 Chr. Clemens Lee

See the included file "LICENSE.txt"

LICENSE

Cobertura is free software. Most of it is licensed under the GNU GPL, and you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Please review the file LICENSE.txt included in this distribution for further details. Parts of Cobertura are licensed under the Apache Software License, Version 1.1.

WARRANTY

Cobertura is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

CONVENTIONS

Before committing

  • check all tests pass
  • build the project, so that all code gets uniformly indented. A Maven plugin ensures this.

MAVEN MIGRATION NOTES

  • How do we get a good blame while all files were moved?

Use "git blame --follow" nameOfFile.java

Cobertura is built on Travis-CI.

cobertura's People

Contributors

alexkamp avatar archmageirvine avatar bigbade avatar christ66 avatar cobexer avatar dennisl avatar dependabot[bot] avatar herenyi avatar jad007 avatar jmrozanec avatar lennartj avatar mkordas avatar msiemczyk avatar neerajsb avatar nhnb avatar nikolajbrinch avatar nishkamravi2 avatar pkozelka avatar polinar68 avatar punkchameleon avatar raghavgautam avatar ritzmann avatar romani avatar rsm-sme avatar singingbush avatar soosterwaal avatar stevesaliman avatar sullis avatar tiffloon avatar vkovalchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cobertura's Issues

cobertura-instrument.sh from cobertura binary files references missing jar files

This has been the case for every release since 2.0.0.

cobertura-instrument.sh references the files lib/asm-3.3.1.jar, lib/asm-tree-3.3.1.jar etc., which don't exist.

Instead cobertura ships with asm-4.1.jar, asm-tree-4.1.jar and so on. Changing the references in the script to she shipped libraries will lead to compatibility errors:

Exception in thread "main" java.lang.NoClassDefFoundError: org/objectweb/asm/util/CheckClassAdapter

So it looks like Cobertura needs an older version of ASM (3.3.1) when it in fact ships with one too new for it to actually work with.

Cobertura 2.0.1 doesn't work with JDK6

Good afternoon,

I'm the maintainer of the Gradle Cobertura plugin (https://github.com/stevesaliman/gradle-cobertura-plugin), and I'm trying to upgrade it to use Cobertura 2.0. I've run into a few issues when I use JDK6.

Cobertura 2.0 has a dependency on ASM 3.3.1, where ClassVisitor (the base class for DetectIgnoredCodeClassVisitor) is an interface. This leads to IncompatibleClassChangeError errors when I try to instrument. Cobertura 2.0.1 appears to fix this problem by updating the ASM dependency to 4.1, but since cobertura was compiled with a jdkVersion set to 1.7, I get Unsupported major.minor version 51.0 errors when I try to instrument.

If I build 2.0.2-SNAPSHOT, changing the jdkVersion to 1.6, everything appears to work as it should. I (and many of my users) are not ready to abandon JDK6, so is it possible to release 2.0.2 compiled for JDK6?

Thanks,

Steve

ExceptionInInitializerError for only a few classes during test

I just started running my tests with Cobertura 2.0.1. From a several hundred test cases, only a few fail with the following exception:

[junit] Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
[junit]     at com.ettex.rialto.utils.collections.LinkedList$ListElement.__cobertura_init(LinkedList.java)
[junit]     at com.ettex.rialto.utils.collections.LinkedList$ListElement.<clinit>(LinkedList.java)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[junit]     at java.lang.reflect.Method.invoke(Method.java:601)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesToSingleClassOnProjectData(TouchCollector.java:120)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesOnProjectData(TouchCollector.java:106)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.saveGlobalProjectData(ProjectData.java:270)
[junit]     at net.sourceforge.cobertura.coveragedata.SaveTimer.run(SaveTimer.java:32)
[junit]     at java.lang.Thread.run(Thread.java:722)
[junit] Caused by: java.lang.IllegalStateException: Shutdown in progress
[junit]     at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
[junit]     at java.lang.Runtime.addShutdownHook(Runtime.java:209)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.initialize(ProjectData.java:237)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.getGlobalProjectData(ProjectData.java:208)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.<clinit>(TouchCollector.java:46)
[junit]     ... 11 more

This also happened here:

[junit] Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
[junit]     at com.ettex.rialto.utils.collections.Hashtable.__cobertura_init(Hashtable.java)

an here:

[junit] Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
[junit]     at com.ettex.rialto.utils.collections.HashTableNode.__cobertura_init(HashTableNode.

This looks suspiciously as if there is some special behavior for classes that "look" like build-in classes... What i mean is that it only happens for HashTable and LinkedList and its inner classes. I'm also suspicious because of the NativeMethodAccessorImpl.invoke because it's actually no native code...

Fails on parsing Java 1.7 multi-catch syntax

Cobertura 2.5.2 is failing for me when it tries to parse Java 1.7 multi-catch syntax. For example:

try {
return Cipher.getInstance("AES/CBC/PKCS5Padding");
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
LOG.error("Failed to get instance of cipher", e);
}

ClassCastException: LineTouchPointDescriptor cannot be cast to JumpTouchPointDescriptor

I get the following ClassCastException with latest Cobertura git master on 4 files during instrumentation. All of them are static inner classes within interfaces, but this might be a coincidence.

[cobertura-instrument] java.lang.ClassCastException: net.sourceforge.cobertura.instrument.tp.LineTouchPointDescriptor cannot be cast to net.sourceforge.cobertura.instrument.tp.JumpTouchPointDescriptor


net.sourceforge.cobertura.instrument.tp.ClassMap.getCounterIdForJumpTrue
                  (ClassMap.java:204)
net.sourceforge.cobertura.instrument.pass3.InjectCodeTouchPointListener.beforeJump
                  (InjectCodeTouchPointListener.java:68)
net.sourceforge.cobertura.instrument.FindTouchPointsMethodAdapter.visitJumpInsn                   (FindTouchPointsMethodAdapter.java:246)
org.objectweb.asm.MethodVisitor.visitJumpInsn
org.objectweb.asm.tree.JumpInsnNode.accept
org.objectweb.asm.tree.InsnList.accept
org.objectweb.asm.tree.MethodNode.accept
org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd
org.objectweb.asm.MethodVisitor.visitEnd
org.objectweb.asm.util.CheckMethodAdapter.visitEnd
org.objectweb.asm.ClassReader.b(Unknown Source)
org.objectweb.asm.ClassReader.accept(Unknown Source)
org.objectweb.asm.ClassReader.accept(Unknown Source)
net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass
                  (CoberturaInstrumenter.java:204)
net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass
                  (CoberturaInstrumenter.java:121)
net.sourceforge.cobertura.instrument.CoberturaInstrumenter.addInstrumentationToSingleClass
                  (CoberturaInstrumenter.java:233)
net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass
                  (Main.java:274)
net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:283)
net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:373)
net.sourceforge.cobertura.instrument.Main.main(Main.java:395)

ClassNotFoundException in instrumented code when calling TouchCollector.registerClass

It seems, that the change in 'version 2.0.1 for 'Fix a problem that occurs if class version lower than 49' introduced this issue.

The problem is, that if the class in neither visible to the bootstrap/system classloader nor to the threads context classloader the lockup of the class by name fails.

This for example can happen in an OSGi env where the code spawns a new class with a Threadpool, the exception is then in class constructor throws a "ClassNotFoundException" for the class being instrumented:

Exception when registering class: a.b.c.DelegateConnection
java.lang.ClassNotFoundException: a.b.c.DelegateConnection

This one is raised in at net.sourceforge.cobertura.coveragedata.TouchCollector.registerClass(TouchCollector.java:80)
at a.b.c..DelegateConnection.__cobertura_init(DelegateConnection.java)

Adding a thread.setContextClassLoader(getClass().getClassLoader()); "solves" the issue, but this won't be always possible.

The javadoc mentioned this should fix some issue with 'anything below .class versions 49 and lower'... maybe this fix should be only enabled/disabled by a systemproperty?

I encountered this while createing a module that dynamically instrument the code for cobertura with the WeavingHook, but I don't see any options to guide cobertura to use a different classlaoder or anything....

Fix bad dependency to icu4j jar

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:~/.m2/repository/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar!/com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class]; nested exception is java.lang.ArrayIndexOutOfBoundsException

Because codebase has a dependency to icu4j. This class is known to be faulty (
http://stackoverflow.com/questions/3026956/javassist-failure-in-hibernate-invalid-constant-type-60 )

[INFO] org.codehaus.mojo:cobertura-maven-plugin:maven-plugin:2.6
[INFO] +- net.sourceforge.cobertura:cobertura:jar:2.0.3:compile
[INFO] | +- org.ow2.asm:asm:jar:4.1:compile
[INFO] | +- org.ow2.asm:asm-tree:jar:4.1:compile
[INFO] | +- org.ow2.asm:asm-commons:jar:4.1:compile
[INFO] | +- org.ow2.asm:asm-util:jar:4.1:compile
[INFO] | +- org.ow2.asm:asm-analysis:jar:4.1:compile
[INFO] | +- oro:oro:jar:2.0.8:compile
[INFO] | +- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | +- jdom:jdom:jar:1.0:compile
[INFO] | | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | | +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] | | - xom:xom:jar:1.0b3:compile
[INFO] | | +- com.ibm.icu:icu4j:jar:2.6.1:compile

Does Cobertura have a problem with the switch statement?

In a recent project of mine I use maven/cobertura and I wonder why a given switch statement reduces overall branch coverage to below 100% while its case branches, including the default branch have been accounted for by 2+ visitations/traversals.

Still, the switch statement will be reported as if there was some branch that was not visited/traversed yet.

Or is this a problem with the maven cobertura plugin?
cobertura-switch

Tomcat Lib Instrumenting Question

Hi all,

Is it possible to get coverage on an instrumented jar inside the Tomcat lib? Say I have a war that's been deployed but uses a jar file held inside the tomcat lib not in the war. Would it possible to get coverage on that external jar? or is the field of view held strictly at whatever java classes is in the war?

if this is possible then what are the steps? and if not how come?

Thanks.

Module not found error with grails

I get the following error when I build my grails project:

Downloading: code-coverage-1.1.8.pom
| Downloading: code-coverage-1.1.8.pom.sha1
:: problems summary ::
:::: WARNINGS
module not found: org.grails.plugins#data-source;1.0
==== grailsPlugins: tried
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/ivy-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/jars/data-source-1.0.zip
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/bundles/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/src/libs/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/dist/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/.grails/2.2.4/cached-installed-plugins/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/plugins/data-source-1.0.zip
==== grailsCentral: tried
http://grails.org/plugins/grails-data-source/tags/RELEASE_1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://grails.org/plugins/grails-data-source/tags/RELEASE_1.0/grails-data-source-1.0.zip
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/data-source/1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://repo1.maven.org/maven2/org/grails/plugins/data-source/1.0/data-source-1.0.zip
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/data-source/1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://repository.codehaus.org/org/grails/plugins/data-source/1.0/data-source-1.0.zip
module not found: org.grails.plugins#hibernate;1.3.4
==== grailsPlugins: tried
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/ivy-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/jars/hibernate-1.3.4.jar
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/bundles/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/src/libs/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/dist/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/.grails/2.2.4/cached-installed-plugins/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/plugins/hibernate-1.3.4.jar
==== grailsCentral: tried
http://grails.org/plugins/grails-hibernate/tags/RELEASE_1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://grails.org/plugins/grails-hibernate/tags/RELEASE_1.3.4/grails-hibernate-1.3.4.jar
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://repo1.maven.org/maven2/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.jar
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://repository.codehaus.org/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.jar
module not found: org.grails.plugins#tomcat;1.3.4
==== grailsPlugins: tried
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/ivy-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/jars/tomcat-1.3.4.jar
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/bundles/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/src/libs/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/dist/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/.grails/2.2.4/cached-installed-plugins/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/plugins/tomcat-1.3.4.jar
==== grailsCentral: tried
http://grails.org/plugins/grails-tomcat/tags/RELEASE_1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://grails.org/plugins/grails-tomcat/tags/RELEASE_1.3.4/grails-tomcat-1.3.4.jar
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://repo1.maven.org/maven2/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.jar
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://repository.codehaus.org/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.grails.plugins#data-source;1.0: not found
:: org.grails.plugins#hibernate;1.3.4: not found
:: org.grails.plugins#tomcat;1.3.4: not found
:: org.grails.plugins#code-coverage;1.1.8: java.text.ParseException: inconsistent module descriptor file found in 'http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom': bad organisation: expected='org.grails.plugins' found='cobertura'; bad module name: expected='code-coverage' found='cobertura'; bad revision: expected='1.1.8' found='';
::::::::::::::::::::::::::::::::::::::::::::::

:::: ERRORS
grailsCentral: bad organisation found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='org.grails.plugins' found='cobertura'
grailsCentral: bad module name found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='code-coverage found='cobertura'
grailsCentral: bad revision found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='1.1.8 found=''
| Downloading: code-coverage-1.1.8.pom
| Downloading: code-coverage-1.1.8.pom.sha1
:: problems summary ::
:::: WARNINGS
module not found: org.grails.plugins#data-source;1.0
==== grailsPlugins: tried
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/ivy-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/jars/data-source-1.0.zip
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/data-source/bundles/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/src/libs/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/dist/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/data-source-1.0.xml
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/.grails/2.2.4/cached-installed-plugins/data-source-1.0.zip
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
/Users/niru/Downloads/grails-2.2.4/plugins/data-source-1.0.zip
==== grailsCentral: tried
http://grails.org/plugins/grails-data-source/tags/RELEASE_1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://grails.org/plugins/grails-data-source/tags/RELEASE_1.0/grails-data-source-1.0.zip
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/data-source/1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://repo1.maven.org/maven2/org/grails/plugins/data-source/1.0/data-source-1.0.zip
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/data-source/1.0/data-source-1.0.pom
-- artifact org.grails.plugins#data-source;1.0!data-source.zip:
http://repository.codehaus.org/org/grails/plugins/data-source/1.0/data-source-1.0.zip
module not found: org.grails.plugins#hibernate;1.3.4
==== grailsPlugins: tried
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/ivy-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/jars/hibernate-1.3.4.jar
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/hibernate/bundles/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/src/libs/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/dist/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/hibernate-1.3.4.xml
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/.grails/2.2.4/cached-installed-plugins/hibernate-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
/Users/niru/Downloads/grails-2.2.4/plugins/hibernate-1.3.4.jar
==== grailsCentral: tried
http://grails.org/plugins/grails-hibernate/tags/RELEASE_1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://grails.org/plugins/grails-hibernate/tags/RELEASE_1.3.4/grails-hibernate-1.3.4.jar
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://repo1.maven.org/maven2/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.jar
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.pom
-- artifact org.grails.plugins#hibernate;1.3.4!hibernate.jar:
http://repository.codehaus.org/org/grails/plugins/hibernate/1.3.4/hibernate-1.3.4.jar
module not found: org.grails.plugins#tomcat;1.3.4
==== grailsPlugins: tried
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/predictivenets-code-a06284f5a86c7a4374d5216a3bfb84a49b4040f8/trunk/predictiveNetworks/lib/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/ivy-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/jars/tomcat-1.3.4.jar
/Users/niru/Downloads/grails-2.2.4/lib/org.grails.plugins/tomcat/bundles/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/src/libs/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/src/libs/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/dist/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/dist/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/.grails/2.2.4/cached-installed-plugins/tomcat-1.3.4.xml
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/.grails/2.2.4/cached-installed-plugins/tomcat-1.3.4.jar
==== grailsHome: tried
/Users/niru/Downloads/grails-2.2.4/plugins/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
/Users/niru/Downloads/grails-2.2.4/plugins/tomcat-1.3.4.jar
==== grailsCentral: tried
http://grails.org/plugins/grails-tomcat/tags/RELEASE_1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://grails.org/plugins/grails-tomcat/tags/RELEASE_1.3.4/grails-tomcat-1.3.4.jar
==== mavenCentral: tried
http://repo1.maven.org/maven2/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://repo1.maven.org/maven2/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.jar
==== http://repository.codehaus.org: tried
http://repository.codehaus.org/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.pom
-- artifact org.grails.plugins#tomcat;1.3.4!tomcat.jar:
http://repository.codehaus.org/org/grails/plugins/tomcat/1.3.4/tomcat-1.3.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.grails.plugins#data-source;1.0: not found
:: org.grails.plugins#hibernate;1.3.4: not found
:: org.grails.plugins#tomcat;1.3.4: not found
:: org.grails.plugins#code-coverage;1.1.8: java.text.ParseException: inconsistent module descriptor file found in 'http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom': bad organisation: expected='org.grails.plugins' found='cobertura'; bad module name: expected='code-coverage' found='cobertura'; bad revision: expected='1.1.8' found='';
::::::::::::::::::::::::::::::::::::::::::::::

:::: ERRORS
grailsCentral: bad organisation found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='org.grails.plugins' found='cobertura'
grailsCentral: bad module name found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='code-coverage found='cobertura'
grailsCentral: bad revision found in http://grails.org/plugins/grails-code-coverage/tags/RELEASE_1_1_8/code-coverage-1.1.8.pom: expected='1.1.8 found=''
| Error Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):

  • org.grails.plugins:data-source:1.0
  • org.grails.plugins:hibernate:1.3.4
  • org.grails.plugins:tomcat:1.3.4
  • org.grails.plugins:code-coverage:1.1.8

Branch coverage may exceed 100%, resulting in awkward HTML reports

With a branch coverage of 200% due to multiple similar tests against a given target, the generated HTML report will make the "greenbar" 200px wide, resulting in the fact that it will overlap the information in the column to the right of the branch coverage column.

I found that in cobertura / cobertura / src / main / java / net / sourceforge / cobertura / reporting / html / HTMLReport.java

in line 713ff, the greenbar width is calculated using (dividend * 100 / divisor)

This can lead to widths > 100px.

Or, perhaps, there is something wrong with the branch coverage calculation, as I also have a much higher line coverage due to those very similar tests being run, yet it will give me just 100% line coverage.

using cobertura 2.0.3 fails with no coverage - fails in saveCoverageData

Cobertura does not report coverage in Sonar for this project. I find the below error in jenkins log.

Using Java7 and Cobertura 2.0.3

[INFO] --- cobertura-maven-plugin:2.6:instrument (default-cli) @ domain-project ---[ERROR] Oct 29, 2013 4:23:53 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
INFO: Cobertura: Saved information on 203 classes.

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.

INFO] --- cobertura-maven-plugin:2.6:cobertura (default-cli) @ domain-payment ---
[INFO] Cobertura 2.0.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file

[ERROR] Oct 29, 2013 4:37:20 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
SEVERE: Cobertura: Error reading file /x/Mobile/projects/domain/domain-project/target/cobertura/cobertura.ser: null
java.io.EOFException

Parse error on Java 1.7 combined exception

The line it had trouble parsing was

catch (InterruptedException | IOException e) {}

which is the new combined exception syntax from JDK 1.7.

[cobertura-report] net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "|" "| "" at line 126, column 39.
[cobertura-report] Was expecting one of:
[cobertura-report] "assert" ...
[cobertura-report] "enum" ...
[cobertura-report] ...
[cobertura-report] "..." ...
[cobertura-report]
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10296)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10172)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.VariableDeclaratorId(JavaParser.java:1747)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.FormalParameter(JavaParser.java:2225)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.TryStatement(JavaParser.java:4631)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3847)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3997)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3947)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:2039)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1082)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:941)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:854)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:761)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:608)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:353)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:137)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:256)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:339)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss.(Javancss.java:419)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:102)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:139)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:224)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:194)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:164)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForTotal(HTMLReport.java:704)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLReport.java:336)
[cobertura-report] net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "|" "| "" at line 126, column 39.
[cobertura-report] Was expecting one of:
[cobertura-report] "assert" ...
[cobertura-report] "enum" ...
[cobertura-report] ...
[cobertura-report] "..." ...
[cobertura-report]
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10296)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10172)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.VariableDeclaratorId(JavaParser.java:1747)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.FormalParameter(JavaParser.java:2225)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.TryStatement(JavaParser.java:4631)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3847)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3997)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3947)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:2039)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1082)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:941)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:854)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:761)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:608)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:353)
[cobertura-report] at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:137)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:256)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:339)
[cobertura-report] at net.sourceforge.cobertura.javancss.Javancss.(Javancss.java:419)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:102)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:139)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:224)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:194)
[cobertura-report] at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:164)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowForTotal(HTMLReport.java:704)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLReport.java:336)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTMLReport.java:271)
[cobertura-report] at net.sourceforge.cobertura.reporting.html.HTMLReport.(HTMLReport.java:96)
[cobertura-report] at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:105)
[cobertura-report] at net.sourceforge.cobertura.reporting.Main.main(Main.java:174)

ParseException: Encountered " "{" "{ "" - this.new AnonymousClass

[cobertura-report] {DATETIME} net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 3 classes.
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "{" "{ "" at line 4, column 34.
Cobertura 2.0.3-SNAPSHOT - GNU GPL License (NO WARRANTY) - See COPYRIGHT file

Was expecting one of:
WARN   getAccumlatedCCNForSource, JavaNCSS got an error while parsing the java file .\src\Outer.java    "instanceof" ...
    ";" ...
    "=" ...
    ">" ...
    "<" ...
    "?" ...
    "==" ...

    "<=" ...ParseException in STDIN

    ">=" ...Last useful checkpoint: "OuterOuter.Outer()"

    "!=" ...Encountered " "{" "{ "" at line 4, column 34.

    "||" ...Was expecting one of:

    "&&" ...
    "instanceof" ...    "++" ...

    ";" ...    "--" ...

    "=" ...    "+" ...

    ">" ...    "-" ...

    "<" ...
    "*" ...    "?" ...

    "/" ...    "==" ...

    "&" ...    "<=" ...

    "|" ...    ">=" ...

    "^" ...
    "!=" ...    "%" ...

    "||" ...    "+=" ...

    "&&" ...    "-=" ...

    "++" ...    "*=" ...

    "--" ...
    "+" ...
    "/=" ...    "-" ...

    "&=" ...    "*" ...

    "|=" ...    "/" ...

    "^=" ...    "&" ...

    "%=" ...
    "<<=" ...
    ">>=" ...
    ">>>=" ...
    ">" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:11845)
    at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:11706)
    "|" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3705)    "^" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3896)    "%" ...

    "+=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ConstructorDeclaration(JavaParser.java:2311)    "-=" ...

    "*=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1010)    "/=" ...

    "&=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:874)    "|=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:801)

    at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:706)
    "^=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:555)    "%=" ...

    "<<=" ...
    at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:303)    ">>=" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:100)    ">>>=" ...

    at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:192)    ">" ...


    at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:268)

Report time: 94ms
    at net.sourceforge.cobertura.javancss.Javancss.<init>(Javancss.java:346)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:105)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:143)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:234)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:201)
    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:167)
    at net.sourceforge.cobertura.reporting.xml.XMLReport.<init>(XMLReport.java:67)
    at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:106)
    at net.sourceforge.cobertura.reporting.Main.main(Main.java:169)

Source:

public class Outer {
    private Inner inner;
    public Outer() {
        inner = this.new Inner() {
            @Override
            public int getI() {
                return 15;
            }
        };
    }
    private class Inner {
        public int getI() {
            return 1;
        }
    }
}

Multiple saveCoverageData when calling [cobertura-instrument]

When calling cobertura-instrument from Ant, I always get two calls to saveCoverageData in log:

[cobertura-instrument] Cobertura 2.0.4-SNAPSHOT - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] sep 18, 2013 9:19:21 FM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
[cobertura-instrument] INFO: Cobertura: Saved information on 1445 classes.
[cobertura-instrument] sep 18, 2013 9:19:22 FM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
[cobertura-instrument] INFO: Cobertura: Saved information on 1445 classes.

Junits are too sensitive

Currently junits that are written are too sensitive. The test units need to be re-written (WebappFunctionalTest) to not fail as often as it does. The slightest changes cause the junit to fail. This is just task one of the junit re-writes.

Missing release tag and source archive for 2.0.1-2.0.3

Releases 2.0.1-2.0.3 don't have any downloadable source archive on SourceForge and also don't have a tag in git. Thus, it isn't clear what code is in those releases (you can guess with reasonable accuracy, but still).

Release 2.0 does have source archives, but also is missing a tag in git.

Source archives are nice, but simply having git tags would be all that's necessary, especially since Github automatically provides archives for tags.

Add super quiet mode

There were a lot of people asking for fixing cobertura to allow for a super quiet mode. This will not publish anything. For this to work cobertura will create a custom logger which at instrumentation time, people can choose if there will be any output.
The argument will be -qq. Adding this will not output anything for any of the ant tasks, or while code is executing.

Repo doesn't build on OSX (with most jdks)

The definition for toolsjar is not correct for OSX; result is that the maven compile phase blows up on the launchpad complaining about an unresolvable dependency (sun.com:tools:jar:0)

I'll submit a one-line fix for this, but it boils down to looking for it in ${java.home}/../Classes/classes.jar instead.

Exception registering instrumented class

Has anyone gotten instrumented classes using 2.0.4-SNAPSHOT to properly loaded using Java 7 and JBoss 7.

Specifics:
Cobertura 2.0.4-SNAPSHOT
Java 1.7.0_21
JBoss 7.1.1.Final

Had to remove some info
CLASSA - our class contained in the deployed WAR(either a.b.c or a/b/c depending on in log)
FILENAME - just the java file name of CLASSA
JBOSS - location of our JBoss installation
OUR_WAR - path and filename of our created war
TMP_DIR - temporary location to do in place instrumentation
OUT_DIR - location our build artifacts reside

Description
We run our component tests against instrumented implmentations to verify coverage. This process worked flawlessly until our recent migration to Java and JBoss 7. We previously were on Java 6, Cobertura 1.9.4.1, and JBoss 6.1. After extensive research, we are at an impass as upon JBoss startup as we receive this.

The interesting piece is that the stacktrace contains the class it says it cannot find......

13:23:19,507 SEVERE [net.sourceforge.cobertura.coveragedata.TouchCollector](MSC service thread 1-7) Exception when registering class: CLASSA: java.lang.ClassNotFoundException: CLASSA from [Module "org.jboss.as.server:main" from local module loader @4b144220 (roots: JBOSS\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.4.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.4.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.4.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.4.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.4.GA]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_21]
at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_21]
at net.sourceforge.cobertura.coveragedata.TouchCollector.registerClass(TouchCollector.java:80)
at CLASSA.__cobertura_init(FILENAME.java) --HOW CAN THIS BE IF THE CLASS CANNOT BE FOUND
at CLASSA.(FILENAME.java) --HOW CAN THIS BE IF THE CLASS CANNOT BE FOUND
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_21]
at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_21]

Again, this is upon JBoss startup, not the instrumentation stage. The code appears to have been instrumented successfully(See below). Basically we take our existing war, expand it, instrument in place, then repackage. The class that is not being found is one of our bean classes in the war. I assume it’s the first one being attempted to load and fails.

-instrument:
[unwar] Expanding: OUR_WAR into TMP_DIR
[cobertura-instrument] Cobertura 2.0.4-SNAPSHOT - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Nov 04, 2013 1:22:41 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
[cobertura-instrument] INFO: Cobertura: Saved information on 87 classes.
[cobertura-instrument] Nov 04, 2013 1:22:41 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler saveCoverageData
[cobertura-instrument] INFO: Cobertura: Saved information on 87 classes.
[war] Building war: <OUR_WAR>
[copy] Copying 1 file to <OUT_DIR>

If I change NOTHING in our process other than just do NOT instrument the classes, the test deploys and runs successfully. It is only when I instrument the classes that it fails to load our war. Looking into it, I noticed that 2.0.4-SNAPSHOT uses asm 4.1 and Jboss AS7.1.1 contains asm 3.3.1. Not sure if this causes issues. I excluded asm.asm from our jboss-deployment-structure and added in net.sourceforge.cobertura into our manifest after adding in the module. I copied all the asm and the oro jars from Coberura’s lib directory into the module directory and added them as resources to the module. None of this worked.

Can anyone shed some insight as I am pretty sure we just are missing something. I assume its probably a classloader issue, but really not sure.

Thanks in advance. Ryan

Add nice html report

It would be nice to see cobertura html reporting get a new look and feel. We should look into automated methods for producing this for us, that way we don't have html code like we currently have.

No coverage reported when using PowerMock

With 2.0.3: Root cause is apparently related to issue#25. For any test that I use with a PowerMock runner of junit rule, using forkMode="perTest" I get the following error at the end of the test:

[junit] Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
[junit]     at com.ettex.rialto.utils.collections.LinkedList$ListElement.__cobertura_init(LinkedList.java)
[junit]     at com.ettex.rialto.utils.collections.LinkedList$ListElement.<clinit>(LinkedList.java)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[junit]     at java.lang.reflect.Method.invoke(Method.java:601)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesToSingleClassOnProjectData(TouchCollector.java:120)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesOnProjectData(TouchCollector.java:106)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.saveGlobalProjectData(ProjectData.java:270)
[junit]     at net.sourceforge.cobertura.coveragedata.SaveTimer.run(SaveTimer.java:32)
[junit]     at java.lang.Thread.run(Thread.java:722)
[junit] Caused by: java.lang.IllegalStateException: Shutdown in progress
[junit]     at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
[junit]     at java.lang.Runtime.addShutdownHook(Runtime.java:209)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.initialize(ProjectData.java:237)
[junit]     at net.sourceforge.cobertura.coveragedata.ProjectData.getGlobalProjectData(ProjectData.java:208)
[junit]     at net.sourceforge.cobertura.coveragedata.TouchCollector.<clinit>(TouchCollector.java:46)
[junit]     ... 11 more

That test then has no coverage reported. The class and methods exist in coverage.xml, but have no interactions reported.

If I run the tests using forkMode="once" then I do not get the issue. Unfortunately that mode causes all sorts of classloader issues with PowerMock, so its not a realistic solution.

Information request: Setting up cobertura to generate cobertura.jar artifact.

Hi

This is a layman question.

When I download Cobertura clicking on ZIP @ https://github.com/cobertura/cobertura/, I don't actually get cobertura.jar artifact.

Now two questions -

  1. If I want gwt-test-utils jar which is also hosted on github, I get it from sonatype.org. Similarly, is there a weblink to get cobertura.jar?
  2. If I want to build cobertura artifact myself, how can I do it? I heard something called pull request, what is it?

Advising a source of step by step information is appreciated.

With 2.0.3 still seeing ClassNotFoundException in-spite of using --auxClasspath during instrumentation

Command Line used :- C:\cobertura-2.0.3\cobertura-instrument.bat --auxClasspath "c:\Program Files (x86)\XX\OIU\CLI\oiucli-1.0.0-jar-with-dependencies" --datafile "c:\cc\SER\oiu_cli.ser" "c:\Program Files (x86)\XX\OIU\CLI"\oiucli-1.0.0-jar-with-dependencies\com

Sep 13, 2013 1:25:01 AM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 40 classes.
Sep 13, 2013 1:25:02 AM net.sourceforge.cobertura.coveragedata.TouchCollector registerClass
SEVERE: Exception when registering class: com/xx/oiu/cli/OIUOption
java.lang.ClassNotFoundException: com.xx.oiu.cli.OIUOption
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at net.sourceforge.cobertura.coveragedata.TouchCollector.registerClass(TouchCollector.java:80)
at com.xx.oiu.cli.OIUOption.__cobertura_init(OIUOption.java)
at com.xx.oiu.cli.OIUOption.(OIUOption.java)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at net.sourceforge.cobertura.instrument.CoberturaClassWriter.getCommonSuperClass(CoberturaClassWriter.java:32)
at org.objectweb.asm.ClassWriter.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
at org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(Unknown Source)
at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:205)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:121)
at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.addInstrumentationToSingleClass(CoberturaInstrumenter.java:234)
at net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:298)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:307)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:316)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:316)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:316)
at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:316)
at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:399)
at net.sourceforge.cobertura.instrument.Main.main(Main.java:421)

Cobertura project doesn't import into Eclipse cleanly

At the moment, when you import a Cobertura Git repo into Eclipse as a Maven project, there are couple issues:

  1. Both project and the only module are named "cobertura", which Eclipse really doesn't like. It allows you to rename the project, but it's an additional step and it's very well hidden in the options.
  2. After import, the Eclipse project files aren't git-ignored, hence the project is immediately marked as modified.
  3. Some of the Ant projects in tests aren't identified as code and hence aren't put on the classpath.

I would have done something to fix these as a pull request, but they pose some significant changes to the code, and so I would like the input of the community before I do. Here's what I propose to do:

  1. Main project will be named "cobertura". The only module will be renamed "cobertura-core".
  2. I add a .gitignore file to ignore the Eclipse resources; it can be further extended to also ignore Netbeans and IntelliJ files.
  3. I don't know yet. It would require some serious refactoring.

What do you think?

Cobertura 2.0.3 with JDK 1.7.0.40 failed to instrument classes

I am trying to run cobertura through ant, using jdk 7. but getting exception while instrumentation.
it was working fine with previous version of cobertura 1.5, with jdk 6.

currently i just upgraded jdk and cobertura.

exception is -

[cobertura-instrument] WARN instrumentClass, Unable to instrument file C:\MyCodeBase\Sample.class
[cobertura-instrument] java.lang.IncompatibleClassChangeError: net/sourceforge/c
obertura/instrument/pass1/DetectIgnoredCodeClassVisitor
[cobertura-instrument] at net.sourceforge.cobertura.instrument.CoberturaInstrum
enter.instrumentClass(CoberturaInstrumenter.java:149)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.CoberturaInstrum
enter.instrumentClass(CoberturaInstrumenter.java:121)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.CoberturaInstrum
enter.addInstrumentationToSingleClass(CoberturaInstrumenter.java:234)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.addInstrume
ntationToSingleClass(Main.java:298)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.addInstrume
ntation(Main.java:307)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.parseArgume
nts(Main.java:399)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.main(Main.j
ava:421)

configuration 'testRuntime' declares a dependency on configuration 'default' which is not declared in the module descriptor cobertura:2.0.3

Hi,

I was using the gradle-cobertura-plugin from https://github.com/stevesaliman/gradl... to run the cobertura tests from gradle. However, recently I started hitting on the following errors


FAILURE: Build failed with an exception.

What went wrong: Could not resolve all dependencies for configuration ':testRuntime'. > Module version misc:myproject:1.0-SNAPSHOT, configuration 'testRuntime' declares a dependency on configuration 'default' which is not declared in the module descriptor for net.sourceforge.cobertura:cobertura:2.0.3

and the snippet of configuration which I use is the following

<code>
buildscript {  
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "net.saliman:gradle-cobertura-plugin:1.2.0"
    }
}
apply plugin: 'java'
apply plugin: 'cobertura'
cobertura {
    cobertura.coverageIgnoreTrivial = true
    coverageFormats = ['xml', 'html']
    cobertura.coverageExcludes = ['.*DTO.*']
}
dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    testCompile 'com.h2database:h2:1.3.164'
    testCompile group: 'org', name: 'mockachino', version: '0.6.1', configuration: 'runtime'
}


apply plugin: 'java'
apply plugin: 'cobertura'

cobertura {
    cobertura.coverageIgnoreTrivial = true
    coverageFormats = ['xml', 'html']
    cobertura.coverageExcludes = ['.*DTO.*']
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    testCompile 'com.h2database:h2:1.3.164'
    testCompile group: 'org', name: 'mockachino', version: '0.6.1', configuration: 'runtime'
}

Was there any reason why the default configuration is not present in cobertura any more?

The way I fixed this issue was to add a default configuration to ivy.xml of cobertura in gradle cache.


<ivy-module version="2.0">
  <info organisation="net.sourceforge.cobertura" module="cobertura" revision="2.0.3"/>
  <configurations>
        <conf name="default" visibility="public" description="runtime dependencies can be used with this conf" extends="runtime"/>
        <conf name="runtime" description="Runtime dependencies (they are transitive)"/>
  </configurations>
  <publications>
    <artifact name="cobertura" type="jar"  conf="runtime" ext="jar"/>
  </publications>
  <dependencies>
    <dependency org="asm" name="asm" rev="4.1" />
    <dependency org="log4j" name="log4j" rev="1.2.16" />
  </dependencies>
</ivy-module>

I raised the issue in gradle forums (http://forums.gradle.org/gradle/topics/configuration_testruntime_declares_a_dependency_on_configuration_default_which_is_not_declared_in_the_module_descriptor_cobertura_2_0_3?rfm=1) and gradle-cobertura-plugin-forum (stevesaliman/gradle-cobertura-plugin#27) and I was asked to raise it here.

cobertura 2.0.3: java.lang.RuntimeException: JSR/RET are not supported with computeFrames option

When instrumenting my classes I run into this exception:

WARN   instrumentClass, Unable to instrument file /PATH-TO-CLASS/MyClass.class
java.lang.RuntimeException: JSR/RET are not supported with computeFrames option
java.lang.RuntimeException: JSR/RET are not supported with computeFrames option
    at org.objectweb.asm.Frame.a(Unknown Source)
    at org.objectweb.asm.MethodWriter.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.MethodVisitor.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.util.CheckMethodAdapter.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.MethodVisitor.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.MethodVisitor.visitJumpInsn(Unknown Source)
    at net.sourceforge.cobertura.instrument.FindTouchPointsMethodAdapter.visitJumpInsn(FindTouchPointsMethodAdapter.java:250)
    at org.objectweb.asm.MethodVisitor.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.tree.JumpInsnNode.accept(Unknown Source)
    at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
    at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
    at org.objectweb.asm.util.CheckMethodAdapter$1.visitEnd(Unknown Source)
    at org.objectweb.asm.MethodVisitor.visitEnd(Unknown Source)
    at org.objectweb.asm.util.CheckMethodAdapter.visitEnd(Unknown Source)
    at org.objectweb.asm.ClassReader.b(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:205)
    at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.instrumentClass(CoberturaInstrumenter.java:121)
    at net.sourceforge.cobertura.instrument.CoberturaInstrumenter.addInstrumentationToSingleClass(CoberturaInstrumenter.java:234)
    at net.sourceforge.cobertura.instrument.Main.addInstrumentationToSingleClass(Main.java:298)
    at net.sourceforge.cobertura.instrument.Main.addInstrumentation(Main.java:307)
    at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:399)
    at net.sourceforge.cobertura.instrument.Main.main(Main.java:421)

What can I do to fix this?

Classpath parameter on <cobertura-instrument> for getCommonSuperClass()

The cobertura-instrument ant task should get a new parameter for a classpath to be used by org.objectweb.asm.ClassWriter.getCommonSuperClass().

In cobertura 2.0, asm uses its own classpath. This is the classpath of the ant script itself. The classpath of ant, howver, does not contain the classes processed by the ant script in most cases.

Cobertura Can't Instrument Classes Generated by Groovy 2.1.8

I'm seeing this on Cobertura 2.0.3 thru the 2.6 Cobertura Maven plugin:
Various errors occur during parsing including:
net.sourceforge.cobertura.instrument.CoberturaInstrumenter - Unable to instrument file xyz
with the following reasons given:
java.lang.IllegalArgumentException: Invalid access flags: 32
java.lang.IllegalArgumentException: Invalid access flags: 33
java.lang.IllegalArgumentException: Invalid access flags: 34

In general, the classes generated by closures don't seem to work and constructors seem to be causing issues as well. Current projects using Groovy 1.8.x seem to work but going to Groovy 2.1.x seems to cause these parse issues.

Primitive class parser problem

[ERROR] j·n 10, 2013 12:45:49 PM net.sourceforge.cobertura.coveragedata.Coverage
DataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 43 classes.
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "." ". "
" at line 105, column 29.
Was expecting:
")" ...

for code

        if ((boolean.class).equals(fieldType.getRawType()) || (Boolean.class).equals(fieldType.getRawType()) && field.getAnnotation(SerializeAsNumber.class) != null) {

but no error if i change code

        Class<?> primitive = boolean.class;
        if ((primitive).equals(fieldType.getRawType()) || (Boolean.class).equals(fieldType.getRawType()) && field.getAnnotation(SerializeAsNumber.class) != null) {

Manually added source folder not reachable in multimodule projects

I use the aggregate option of cobertura maven plugin declared in the master POM file of a multi-module project as follow:

<reporting>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <outputDirectory>./tmpCobertura</outputDirectory>
            <formats>
                <format>html</format>
            </formats>
            <aggregate>true</aggregate>
        </configuration>
      </plugin>
    </plugins>
</reporting>

Some of the children projects use the add-source plugin to add generated source folders, or to have several source folders under src/main/java:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>src/generated/java</source>
                    <source>src/main/java/api</source>
                    <source>src/main/java/impl</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

Each subproject has properly generated HTML reports. The aggregated HTML report is however not able to show the source code of classes that do not stand in a regular maven source folder (src/main/java). Instead, a message says: "Unable to locate org/my/package/MyClass.java. Have you specified the source directory?"

Is that a bug, or did I miss anything in the configuration?

Improve junit tests

Some unit tests require that the environment is built in a *nix environment. Jose suggested that instead of referencing /tmp directory we use the target directory. Some junits also have entire methods which could be improved to not contain any code writing and manual compilation. Also it would be nice to include a tutorial on how to easily add cobertura integration tests.

Performance issue

Recently it was brought to my attention that cobertura 2.0.2 suffers from a substantial performance issue. Mostly the performance issues are seen at runtime, however improvements will not be limited to runtime execution. This Issue is for tracking those issues.

Parsing Problem - Inside a try-with-resources block declarations with 'final' are not allowed

If you have a declaration of a resource inside the try-with-resources Java SE 7 language construction qualified with a 'final' keyword then Cobertura will report a parsing error.

Here is a small code snippet demonstrating the problem. The version below will blow up the Cobertura's parser:

try (
final Connection databaseConnection = dataSource.getConnection();
) {
your code here...
} catch (SQLException ex) {
your exception handler here...
}

However, after removing that 'final' qualifier the code will be properly parsed.

Fix Cobertura Null Version

Currently when executed, we see:
Cobertura null - GNU GPL License (NO WARRANTY) - See COPYRIGHT

The null should contain the version of cobertura. Modifications to the Header.version method are needed to dynamically obtain the cobertura version.

Issue with parsing code

ParseException in STDIN
Last useful checkpoint: "com.thoughtworks.qdox.parser.impl.DefaultJavaCommentParser.yyparse()"
Encountered " "+=" "+= "" at line 395, column 30.
Was expecting one of:
"instanceof" ...
")" ...
"=" ...
">" ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
"<" ...
"<" ...
")" ...
"<" ...

[cobertura] WARN [main] net.sourceforge.cobertura.reporting.ComplexityCalculator - JavaNCSS got an error while parsing the java file E:\java-workspace\codehaus-qdox\qdox\target\generated-sources\parser\com\thoughtworks\qdox\parser\impl\Parser.java
ParseException in STDIN
Last useful checkpoint: com.thoughtworks.qdox.parser.impl.Parser.yyparse()"
Encountered " "+=" "+= "" at line 1687, column 30.
Was expecting one of:
"instanceof" ...
")" ...
"=" ...
">" ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
"<" ...
"<" ...
")" ...
"<" ...

Report time: 9883ms

[ERROR] 9-jul-2013 19:57:31 net.sourceforge.cobertura.coveragedata.CoverageDataF
ileHandler loadCoverageData
INFO: Cobertura: Loaded information on 197 classes.
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "+=" "+= "" at line 395, column 30.
Was expecting one of:
"instanceof" ...
")" ...
"=" ...
">" ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
"<" ...
"<" ...
")" ...
"<" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseExc

eption(JavaParser.java:11808)
at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token
(JavaParser.java:11669)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimaryPrefix(Ja
vaParser.java:3372)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimaryExpressio
n(JavaParser.java:3296)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PostfixExpressio
n(JavaParser.java:3250)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpressionN
otPlusMinus(JavaParser.java:3158)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpression(
JavaParser.java:3092)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MultiplicativeEx
pression(JavaParser.java:3012)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AdditiveExpressi
on(JavaParser.java:2984)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ShiftExpression(
JavaParser.java:2951)
at net.sourceforge.cobertura.javancss.parser.JavaParser.RelationalExpres
sion(JavaParser.java:2915)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InstanceOfExpres
sion(JavaParser.java:2902)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AssigmentExpress
ion(JavaParser.java:2885)
at net.sourceforge.cobertura.javancss.parser.JavaParser.EqualityExpressi
on(JavaParser.java:2857)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AndExpression(Ja
vaParser.java:2832)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ExclusiveOrExpre
ssion(JavaParser.java:2816)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InclusiveOrExpre
ssion(JavaParser.java:2800)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalAndEx
pression(JavaParser.java:2795)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalOrExp
ression(JavaParser.java:2766)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalExpre
ssion(JavaParser.java:2750)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Expression(JavaP
arser.java:2694)
at net.sourceforge.cobertura.javancss.parser.JavaParser.IfStatement(Java
Parser.java:4145)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3709)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3670)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(Jav
aParser.java:4356)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3721)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3670)
at net.sourceforge.cobertura.javancss.parser.JavaParser.WhileStatement(J
avaParser.java:4168)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3713)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaratio
n(JavaParser.java:1972)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclara
tion(JavaParser.java:1049)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaPa
rser.java:911)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassD
eclaration(JavaParser.java:838)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration
(JavaParser.java:743)
at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(
JavaParser.java:592)
at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(
JavaParser.java:340)
at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser
.java:137)
at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.j
ava:208)
at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.jav
a:284)
at net.sourceforge.cobertura.javancss.Javancss.(Javancss.java:362)

    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlate

dCCNForSource(ComplexityCalculator.java:102)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlate
dCCNForSingleFile(ComplexityCalculator.java:140)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSou
rceFileNameInternal(ComplexityCalculator.java:231)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPac
kageInternal(ComplexityCalculator.java:198)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPro
ject(ComplexityCalculator.java:164)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowF
orTotal(HTMLReport.java:603)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(
HTMLReport.java:287)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews
(HTMLReport.java:228)
at net.sourceforge.cobertura.reporting.html.HTMLReport.(HTMLReport
.java:71)
at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:103
)
at net.sourceforge.cobertura.reporting.Main.main(Main.java:169)
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " "+=" "+=
"" at line 1687, column 30.
Was expecting one of:
"instanceof" ...
")" ...
"=" ...
">" ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
">" ...
"<" ...
"<" ...
")" ...
"<" ...

    at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseExc

eption(JavaParser.java:11808)
at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token
(JavaParser.java:11669)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimaryPrefix(Ja
vaParser.java:3372)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PrimaryExpressio
n(JavaParser.java:3296)
at net.sourceforge.cobertura.javancss.parser.JavaParser.PostfixExpressio
n(JavaParser.java:3250)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpressionN
otPlusMinus(JavaParser.java:3158)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnaryExpression(
JavaParser.java:3092)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MultiplicativeEx
pression(JavaParser.java:3012)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AdditiveExpressi
on(JavaParser.java:2984)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ShiftExpression(
JavaParser.java:2951)
at net.sourceforge.cobertura.javancss.parser.JavaParser.RelationalExpres
sion(JavaParser.java:2915)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InstanceOfExpres
sion(JavaParser.java:2902)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AssigmentExpress
ion(JavaParser.java:2885)
at net.sourceforge.cobertura.javancss.parser.JavaParser.EqualityExpressi
on(JavaParser.java:2857)
at net.sourceforge.cobertura.javancss.parser.JavaParser.AndExpression(Ja
vaParser.java:2832)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ExclusiveOrExpre
ssion(JavaParser.java:2816)
at net.sourceforge.cobertura.javancss.parser.JavaParser.InclusiveOrExpre
ssion(JavaParser.java:2800)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalAndEx
pression(JavaParser.java:2795)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalOrExp
ression(JavaParser.java:2766)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ConditionalExpre
ssion(JavaParser.java:2750)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Expression(JavaP
arser.java:2694)
at net.sourceforge.cobertura.javancss.parser.JavaParser.IfStatement(Java
Parser.java:4145)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3709)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3670)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(Jav
aParser.java:4356)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3721)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3670)
at net.sourceforge.cobertura.javancss.parser.JavaParser.WhileStatement(J
avaParser.java:4168)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaPa
rser.java:3713)
at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(J
avaParser.java:3892)
at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser
.java:3841)
at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaratio
n(JavaParser.java:1972)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclara
tion(JavaParser.java:1049)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaPa
rser.java:911)
at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassD
eclaration(JavaParser.java:838)
at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration
(JavaParser.java:743)
at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(
JavaParser.java:592)
at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(
JavaParser.java:340)
at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser
.java:137)
at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.j
ava:208)
at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.jav
a:284)
at net.sourceforge.cobertura.javancss.Javancss.(Javancss.java:362)

    at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlate

dCCNForSource(ComplexityCalculator.java:102)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlate
dCCNForSingleFile(ComplexityCalculator.java:140)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSou
rceFileNameInternal(ComplexityCalculator.java:231)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPac
kageInternal(ComplexityCalculator.java:198)
at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPro
ject(ComplexityCalculator.java:164)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateTableRowF
orTotal(HTMLReport.java:603)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverview(HTMLReport.java:287)
at net.sourceforge.cobertura.reporting.html.HTMLReport.generateOverviews(HTMLReport.java:228)
at net.sourceforge.cobertura.reporting.html.HTMLReport.(HTMLReport.java:71)
at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:103)
at net.sourceforge.cobertura.reporting.Main.main(Main.java:169)

ClassNotFoundException instrumenting code

I'm sorry for the duplicate, but I couldn't find a way to reopen the existing issue.

I've done a pull and build with the latest cobertura code, but I still get a lot of ClassNotFoundExceptions from org.objectweb.asm.ClassWriter.getCommonSuperClass in both java 6 and java 7 during instrumentation. Is there something different I need to do to get the auxiliary classpath to work? Is there code that hasn't been merged yet? Is there something else I need to look at?

Missing DTD File.

Please check this out:

hudson.util.IOException2: Failed to read ...reports/coverage.xml
    at hudson.tasks.junit.TestResult.parse(TestResult.java:291)
    at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:230)
    at hudson.tasks.junit.TestResult.parse(TestResult.java:165)
    at hudson.tasks.junit.TestResult.parse(TestResult.java:148)
    at hudson.tasks.junit.TestResult.<init>(TestResult.java:124)
    at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:117)
    at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:90)
    at hudson.FilePath.act(FilePath.java:906)
    at hudson.FilePath.act(FilePath.java:879)
    at hudson.tasks.junit.JUnitParser.parse(JUnitParser.java:87)
    at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:121)
    at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:133)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
    at hudson.model.Run.execute(Run.java:1618)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:247)
Caused by: org.dom4j.DocumentException: http://cobertura.sourceforge.net/xml/coverage-03.dtd Nested exception: http://cobertura.sourceforge.net/xml/coverage-03.dtd

java.lang.VerifyError when using with AspectJ compile time weaving

I've checked out your current version of the code (thanks for getting some Java 7 compatibility rolling!) and it has worked great, except for some AspectJ generated classes. Any time I try to run my tests on the instrumented AspectJ classes I get the following exception.

Caused by: java.lang.VerifyError: (class: MyClass$AjcClosure7, method: __cobertura_classmap signature: (LnehtClassmapListener;)V) Illegal type in constant pool

My work around for now is to simply keep those classes from being instrumented in the first place, and I really don't care about coverage for them too much so it's not a huge loss. Wanted to make you aware of the issue to see if you think it is something that can be fixed.

By the way, I have no problems instrumenting and testing the same generated classes with the Cobertura 1.9.4.

Thanks,

Dave

persistence.xml in JPA-project

In a JPA project there are a file in the resources folder called persistence.xml in the src/main/resources/META-INF and src/test/resources/META-INF. In Eclipse when running Cobertura though "Cover as" it seems like the persistence.xml in main is used, and then the tests simply isn't working.

Is there a workaround for this scenario?

Only start of file is reported as covered

Hi,

I have a case in which only the the start of a file is reported covered, but the end is reported as uncovered.

http://filebin.ca/utptb3660di/half-covered.zip contains a report.html (including the source code), the instrumented .class file and the cobertura.ser from the test run.

The uncovered section starts around line 500. The first method there is checkVersionConflict in line 506. It is shown as uncovered. In line 409, however, this method is invoked 44 times.

In the past, the coverage report was correct on Java 6 with Cobertura 1.9. The issues occurs on Java 7 with Cobertura 2.0.3 and Cobertura 2.0.4-snapshot.

Cobertura code coverage report does not report on services layer coverage but only presentation

Hi,

I am new using cobertura and have it set up to report on my GEB-Spock test code coverage.
I can see the report generated but it does not report on all the classed/projects the tests uses, looks like only the presentation layer code coverage is reported.

We use groovy 1.7, Grails 1.3.7 and geb-spock 1.6.1

Could you kindly advice if cobertura reports code coverage on all the project classes, API etc.

Regards
N.Marku

No ant tasks for ignoreMethodAnnotations and ignoreTrivial

We forgot to include test cases for the ignoreMethodAnnotations and ignoreTrivial arguments for the cobertura-instrument task. This issue is designed to create a new test unit and make sure there are no issues when adding these arguments to the ant task.

Also it would be nice to improve the documentation for the ant targets as per: http://stackoverflow.com/questions/17475050/has-anyone-used-the-ant-task-for-cobertura-to-exclude-annotated-java-classes

Unable to instrument classes with 2.0.0

I'm using the ant task to instrument some of my files. Perhaps something has changed in 2.0.0 since 1.9.4? I needed the upgrade to handle the JVM change from Java6 to Java7.

My instrumentation task looks like this:

    <path id="cobertura.classpath">
        <fileset dir="${dir.lib}/cobertura">
            <include name="*.jar" />
        </fileset>
        <pathelement location="${dir.lib}/log4j-1.2.16.jar" />
    </path>
    <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

    <target name="coverage.instr" depends="compile" description="Instrument files for code coverage">
        <mkdir dir="${dir.coverage}" />

        <cobertura-instrument datafile="${dir.coverage}/cobertura.ser">
            <fileset dir="${dir.classes}">
                <include name="**/*.class" />
            </fileset>
        </cobertura-instrument>
        <copy file="${dir.coverage}/cobertura.ser" tofile="${dir.coverage}/tomcat-cobertura.ser" />
    </target>

Here is the error message:

[cobertura-instrument] INFO: Cobertura: Loaded information on 267 classes.
[cobertura-instrument] WARN   instrumentClass, Unable to instrument file /home/j
pschewe/projects/fll-sw/working-dir/scoring/build/tomcat/webapps/fll-sw/WEB-INF/
classes/fll/db/GenerateDB.class
[cobertura-instrument] java.lang.RuntimeException: java.lang.ClassNotFoundExcept
ion: fll.xml.ScoreCategory
[cobertura-instrument]  at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unk
nown Source)
[cobertura-instrument]  at org.objectweb.asm.ClassWriter.a(Unknown Source)
[cobertura-instrument]  at org.objectweb.asm.Frame.a(Unknown Source)
[cobertura-instrument]  at org.objectweb.asm.Frame.a(Unknown Source)
[cobertura-instrument]  at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Sour
ce)
[cobertura-instrument]  at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
...

The source code tree can be found at http://sourceforge.net/p/fll-sw/code/ci/master/tree/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.