Name: dkR10031 Date: 07/15/2003
Current implementation of the Template Generator stops processing
of the class files if it meets empty class file. All gathered
from the correct class files coverage data is lost.
Such behavior of the Template Generator is incorrect since it user can't
process directories and jar files which contains files with '.class'
extensions and these files are not class files (current edition
of the Jcov User Guide does not prohibit it).
To reproduce the bug please execute the test below. This test
compiles the sources with jcov support, creates empty class file
'empty.class', executes Template Generator, and finally dumps java.jcov
file to show that coverage data is lost:
-------------------------- test.java begin ---------------------------
public class test {
public static void main(String[] args) {
System.out.println("-----------");
System.exit(0);
}
}
-------------------------- test.java end -----------------------------
-------------------------- script begin ------------------------------
uname -a
export JCOV_JAR=/export/home/gary/QA.JCOV/ws-control/test.linux-x86/lib/jcov.jar
export TESTED_JAVA=/net/novo172/export/home/java/dest/jdk1.4.0-b92/linux-i386/bin/java
export TESTED_JAVAC=/net/novo172/export/home/java/dest/jdk1.4.0-b92/linux-i386/bin/javac
export CLASS_TPLGEN=com.sun.tdk.jcov.TmplGenMain
export CLASS_SINSTR=com.sun.tdk.jcov.InstrMain
CLASSPATH=${JCOV_JAR}
CLASSPATH=${CLASSPATH}:.
export CLASSPATH
# Compile the test program
$TESTED_JAVAC -Xjcov test.java
touch empty.class
# Execute the Template Generator with the -output option
$TESTED_JAVA -showversion $CLASS_TPLGEN -dtype=M -verbose -classpath=.
echo "---- java.jcov begin ----"
cat java.jcov
echo "---- java.jcov end ------"
-------------------------- script end --------------------------------
-------------------------- script output begin -----------------------
Linux linux-11 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
GNU/Linux
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
Type of jcov data is: M
processing class: test
processing class: empty
*** Fatal error : Unexpected end of class file :null
*** Exiting...
---- java.jcov begin ----
JCOV-DATA-FILE-VERSION: 2.0
---- java.jcov end ------
-------------------------- script output end -------------------------
======================================================================
- relates to
-
CODETOOLS-7900496 Static Instrumenter breaks on invalid class files
- Closed