Name: dkR10031 Date: 07/07/2003
Current edition of the Jcov User Guide contains
the description of the following feature:
"-output=path: Output directory where the generated .txt
or .html files are placed. Files are stored in the
current directory by default."
If user tries to save coverage data to the directory
which does not exist then stack trace and error message
are generated. However, those stack trace and error message
does not contain clear comment about the source of the problem
- about the directory which does not exist.
To resolve this issue needed comments should be added
to the output of the program.
To reproduce this situation please execute the test using
the script below. This script contains the next stages:
1. Compilation of the test source.
2. Execution of the test class with JVMPI agent.
3. Generation of the txtbase report to the directory 'dir'
which does not exist using the Report Generator.
-------------------------- test.java source begin --------------------
public class test {
public static void main(String[] args) {
System.out.println("-----------");
System.exit(0);
}
}
-------------------------- test.java source end ----------------------
-------------------------- script begin ------------------------------
uname -a
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 JCOV_JAR=/export/home/gary/QA.JCOV/ws-jcov/test.linux-x86/lib/jcov.jar
# Setting the classpath
CLASSPATH=${JCOV_JAR}:.
export CLASSPATH
# Compile the test program
echo 'Compilation begin'
$TESTED_JAVAC -Xjcov test.java
echo 'Compilation end'
# For the JVMPI Instrumentation mechanism: Instrument and execute the test
program with JVMPI agent
$TESTED_JAVA -showversion -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:file=jvm.jcov test
# Execute the Report Generator with the -fmt=html and with
# the -rel_links options for the coverage data
# generated by the Static Instrumenter
$TESTED_JAVA -showversion com.sun.tdk.jcov.RepGenMain -fmt=txtbase -output=dir jvm.jcov
-------------------------- 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
Compilation begin
Compilation end
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)
-----------
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)
java.io.FileNotFoundException: dir/report.txt (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at java.io.FileWriter.<init>(FileWriter.java:45)
at
com.sun.tdk.jcov.report.TextReportGenerator.<init>(TextReportGenerator.java:82)
at com.sun.tdk.jcov.RepGenMain.run(RepGenMain.java:202)
at com.sun.tdk.jcov.RepGenMain.main(RepGenMain.java:239)
*** Fatal error : cannot open report.txt for writing
*** Exiting...
-------------------------- script output end -------------------------
======================================================================