In certain situations EMMA can not used at all, because the internal logger throws a RuntimeException on initalization. A typical stack trace looks like this:
java.lang.ExceptionInInitializerError
at com.vladium.emma.Processor.run(Processor.java:40)
at com.mountainminds.eclemma.internal.core.instr.ClassFiles.instrument(ClassFiles.java:119)
at
[...]
Caused by: java.lang.IllegalArgumentException: null or corrupt input: out
at com.vladium.logging.Logger.create(Logger.java:74)
at com.vladium.logging.Logger.<clinit>(Logger.java:604)
... 9 more
The Logger.create() calls checkError() on the passed PrintWriter, which is always based on System.out for the STATIC_LOGGER. In certain situations (Java >= 1.5 called without console, e.g. by eclipse.exe) checkError() returns true and EMMA can not be used at all.
By any chance, can this check be removed? Internal logging should not prevent one from using the EMMA library. See the following bug submitted for the Eclipse plug-in EclEmma:
http://sourceforge.net/tracker/index.php?func=detail&aid=1618360&group_id=177969&atid=883351
Many thanks,
marc
Logged In: YES
user_id=1689492
Originator: NO
I have created a patch that is very simple, but works within EclEmma on JDK1.6:
$ diff Logger.java.bak Logger.java
73,74c73,74
< if ((out == null) || out.checkError ())
< throw new IllegalArgumentException ("null or corrupt input: out");
---
> if ((out == null))// || out.checkError ())
> throw new IllegalArgumentException ("null: out");
Applying this patch and then rebuilding emma.jar seems to work fine.