Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4899079

TEST_BUG: javax/print/attribute/mediatest/MediaVMCrash.java

XMLWordPrintable

    • 2d
    • tiger
    • generic
    • generic
    • Verified



      Name: iaR10016 Date: 07/31/2003


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b12
      Testbase : RegTest-test
      Platform[s] : all
      switch/Mode : all
      Falling test : javax/print/attribute/mediatest/MediaVMCrash.java

      Here is the code fragment from the Regression test
      javax/print/attribute/mediatest/MediaVMCrash.java:

      --------- MediaVMCrash.java ---------
      001>
      002> /*
      003> * @test 1.1 01/05/16
      004> * @bug 4458842
      005> * @summary No VM crash should occur.
      006> * @run main MediaVMCrash
      007> */
      ...
      089> class PrintDocument implements Doc {
      090>
      091> File file = new File("./TopLogo.gif");
      ...
      -------------------------------------

      The test tries to open "TopLogo.gif" file.
      The test does not take into account that source directory
      is not current directory during Regression tests execution.
      So the test throws java.io.FileNotFoundException.

      Jtreg 1.23 Specification reads:
      ...
      The names of the source and class directories of a test are made available to
      main and applet actions via the system properties "test.src" and
      "test.classes", respectively. The directory names do not have trailing
      separators. Main and applet actions can read data files defined in the test's
      source directory using this idiom:

           File f = new File(System.getProperty("test.src", "."), "foo");
           InputStream in = new FileInputStream(f);
      ...

      Line 91 should be changed to the following:
      ...
      091> File file = new File(System.getProperty("test.src", "."), "TopLogo.gif");
      ...

      Test source location:
      =====================
      /java/re/jdk/1.4.2/promoted/latest/ws/j2se/test/javax/print/attribute/mediatest/MediaVMCrash.java

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results/tiger/b12/regtest/win32/redhat7.2_gnome_smp_-server_smp_JCC-ITANIUM-02/workDir/test/javax/print/attribute/mediatest/MediaVMCrash.jtr

      How to reproduce:
      =================
      Run the following script (you may need to change its variables)

      --- script start ---
      #!/bin/sh

      RESULT_DIR=`pwd`
      WORK_DIR=$RESULT_DIR/workDir/test
      REPORT_DIR=$RESULT_DIR/reportDir
      JT_HOME="h:/java/jct"
      JAVA_HOME="h:/java/jdk1.5.0/win32"
      TEST_BASE_PATH="h:/java/regtest/test"
      TESTWITH=$JAVA_HOME
      TESTJAVA=$JAVA_HOME
      JTOPTS="-server"
      TESTVMOPTS="-server"

      CLASSPATH="$JT_HOME/classes;$JT_HOME/lib/javatest.jar;$JT_HOME/lib/jtreg.jar;$JT_HOME/jemmy/jemmy.jar"
      export JAVA_HOME
      export JT_HOME
      export TESTWITH
      export CLASSPATH
      cd $WORK_DIR/scratch

      $JAVA_HOME/bin/java -cp $CLASSPATH $JTOPTS -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=:0,windir=$windir,PATH=${SHELL%/*},CPAPPEND=$JT_HOME/jemmy/jemmy.jar,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="JCC-ITANIUM-02" -Dprogram=jtreg com.sun.javatest.regtest.Main -a -v default -batch -params -w "$WORK_DIR" -r "$REPORT_DIR" -t "$TEST_BASE_PATH" "$TEST_BASE_PATH/javax/print/attribute/mediatest/MediaVMCrash.java"
      --- script end ---

      Test output (jtr part):
      =======================
      ----------System.out:(6/217)----------
      Instructions: You must have printer configured into your system that does NOT support 5x7 paper.
      Pass if no VM crash occurs.


      Selected print service: Win32 Printer : HP LaserJet 5MP
      getStreamForBytes called
      ----------System.err:(29/1817)*----------
      java.io.FileNotFoundException: .\TopLogo.gif (The system cannot find the file specified)
           at java.io.FileInputStream.open(Native Method)
           at java.io.FileInputStream.<init>(FileInputStream.java:106)
           at PrintDocument.getPrintData(MediaTest.java:119)
           at sun.print.Win32PrintJob.print(Win32PrintJob.java:288)
           at MediaVMCrash.printImage(MediaVMCrash.java:73)
           at MediaVMCrash.<init>(MediaVMCrash.java:37)
           at MediaVMCrash.main(MediaVMCrash.java:84)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:82)
           at java.lang.Thread.run(Thread.java:549)
      java.io.FileNotFoundException: .\TopLogo.gif (The system cannot find the file specified)
           at java.io.FileInputStream.open(Native Method)
           at java.io.FileInputStream.<init>(FileInputStream.java:106)
           at PrintDocument.getPrintData(MediaTest.java:119)
           at sun.print.Win32PrintJob.initializeAttributeSets(Win32PrintJob.java:568)
           at sun.print.Win32PrintJob.print(Win32PrintJob.java:299)
           at MediaVMCrash.printImage(MediaVMCrash.java:73)
           at MediaVMCrash.<init>(MediaVMCrash.java:37)
           at MediaVMCrash.main(MediaVMCrash.java:84)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:324)
           at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:82)
           at java.lang.Thread.run(Thread.java:549)
      result: Failed. Execution failed: Program `C:/j2sdk1.5.0 in\java' interrupted! (timed out?)

      test result: Failed. Execution failed: Program `C:/j2sdk1.5.0 in\java' interrupted! (timed out?)

      Specific machine info:
      ======================
      Hostname: JCC-ITANIUM-02
      OS: Windows 2003 Enterprise

      ======================================================================

            jgodinez Jennifer Godinez (Inactive)
            irasunw Ira Ira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: