Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7900496

Static Instrumenter breaks on invalid class files

XMLWordPrintable

    • 1.2
    • generic
    • generic
    • Verified



      Name: dkR10031 Date: 07/15/2003



      Current implementation of the Static Instrumenter stops
      processing a class files if it meets an empty class file.
      As a result the tool can't instrument all class files in a
      directory which contains the empty file.

      Such behavior of the tool is incorrect because a 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', tryes to instrument all class files in the current
      directory using Static Instrumenter and finally tries to get properties of
      the instrumented files to show that 'test' class has not the instrumented
      version ("file with 'test.iclass' extension"):

      -------------------------- 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
      $TESTED_JAVA -showversion $CLASS_SINSTR -verbose empty.class test.class

      ls -l test.iclass
      -------------------------- 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)

      instrumenting class file empty.class...*** Fatal error : Unexpected end of
      class file :null
      *** Exiting...
      ls: test.iclass: No such file or directory
      $ ./run.ksh
      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)

      instrumenting class file empty.class...*** Fatal error : Unexpected end of class file :null
      *** Exiting...
      ls: test.iclass: No such file or directory
      -------------------------- script output end -------------------------
      ======================================================================

            lmesnik Leonid Mesnik
            klooney Kevin Looney (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: