From paul{XdotX}field{YatY}db{ZdotZ}com
Using Cobertura v1.8. Here's my method:
public <K,V> NullCache<K,V> getCache(String cacheName) {
assert cacheName != null;
synchronized (caches) {
NullCache<K, V> result = caches.get(cacheName);
if (result == null) {
result = new NullCache<K, V>(cacheName);
caches.put(cacheName, result);
}
return result;
} // THIS LINE GETS A COUNT OF '0'
}
I call this method in my unit tests and all the lines
get a non-zero cound except for the closing brace of
the 'synchronized' (see the comment above).
This also happens for me as well. Here is my method (note that a mock security manager is used to generate the security exception):
try {
System.exit(0);
} catch (final SecurityException exception) {
exception.printStackTrace();
} // This curly brace shows as never being covered, although the next line shows as covered.
System.err.println("The program never exited!");
Also a problem for us as well. This is happening when instrumenting jars, merging ser files and then generating reports using the shell scripts.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Another case is a synchronized block - the closing brace is marked as untested. Example:
public boolean foo(int number) {
synchronized (this.monitor) {
if(number>0) return true;
return false;
}
}