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

REGRESSION: Regression-test .../PrinterJob/CheckPrivilege.java fails on Tiger-b1

XMLWordPrintable

    • 2d
    • tiger
    • x86
    • solaris_9, solaris_10
    • Verified



      Name: vsR10238 Date: 08/21/2003


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b15
      Testbase : Regression-test
      Platform[s] : Solaris 10 (sparc) (GNOME), Solaris 9 (x86) (CDE), RedHat Linux
      switch/Mode : -client, -server
      Falling test[s]:
               java/awt/print/PrinterJob/CheckPrivilege.java

      Regression-test java/awt/print/PrinterJob/CheckPrivilege.java test fails with JDK1.5.0-b15
      on unix platforms with java.lang.ExceptionInInitializerError at sun.print.CUPSPrinter.isCupsRunning(CUPSPrinter.java:348).

      The test passes with JDK1.5.0-b14,b13,b12, JDK1.4.2 (tested with b28).

      Please see test output below.

      Test source location:
      =====================
      /java/re/jdk/1.5.0/promoted/latest/ws/j2se/test/java/awt/print/PrinterJob/CheckPrivilege.java

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b15/regtest/x86/sol9_x86_cde_smp_linux-6/workDir/test/java/awt/print/PrinterJob/CheckPrivilege.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="/net/linux-15/export/home/java/jct"
      JAVA_HOME="/net/linux-15/export/home/java/jdk1.5.0/x86"
      TEST_BASE_PATH="/net/linux-15/export/home/java/regtest.tiger/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

      mkdir -p $WORK_DIR/scratch 2>&1
      mkdir -p $WORK_DIR/jtData 2>&1
      mkdir -p $REPORT_DIR 2>&1

      #rm $WORK_DIR/jtData/ResultCache.jtw 2>&1

      cd $WORK_DIR/scratch

      $JAVA_HOME/bin/java -cp $CLASSPATH $JTOPTS -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=:0,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JT_HOME/jemmy/jemmy.jar,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="linux-6" -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/java/awt/print/PrinterJob/CheckPrivilege.java"

      --- script end ---


      Test output (jtr part):
      =======================
      ----------System.out:(4/325)----------
      -----------------------------------------------------------------------
      INSTRUCTIONS: You should have a printer configured in your system to do this test. Test fails if you get this error message:
          "Regression: printing causes a NullPointerException"
      -----------------------------------------------------------------------
      ----------System.err:(26/1678)----------
      java.lang.ExceptionInInitializerError
      at sun.print.CUPSPrinter.isCupsRunning(CUPSPrinter.java:348)
      at sun.print.UnixPrintServiceLookup.getDefaultPrintService(UnixPrintServiceLookup.java:379)
      at javax.print.PrintServiceLookup.lookupDefaultPrintService(PrintServiceLookup.java:166)
      at sun.print.RasterPrinterJob.getPrintService(RasterPrinterJob.java:354)
      at CheckPrivilege.main(CheckPrivilege.java:69)
      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)
      Caused by: java.security.AccessControlException: access denied (java.io.FilePermission
      /net/linux-15/export/home/results_full/tiger/b15/regtest/x86/sol9_x86_cde_smp_linux-6/workDir/test/scratch/./out.prn read)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
      at java.security.AccessController.checkPermission(AccessController.java:401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
      at java.lang.SecurityManager.checkRead(SecurityManager.java:863)
      at java.io.File.isDirectory(File.java:713)
      at java.io.File.toURI(File.java:622)
      at sun.print.IPPPrintService.<clinit>(IPPPrintService.java:109)
      ... 11 more

      JavaTest Message: Test threw exception: java.lang.ExceptionInInitializerError
      JavaTest Message: shutting down test

      STATUS:Failed.`main' threw exception: java.lang.ExceptionInInitializerError
      result: Failed. Execution failed: `main' threw exception: java.lang.ExceptionInInitializerError


      test result: Failed. Execution failed: `main' threw exception: java.lang.ExceptionInInitializerError


      Specific machine info:
      ======================
      Hostname: linux-6
      OS: Solaris 9 (x86) (CDE)
      Hostname: linux-8
      OS: Solaris 10 (sparc) (GNOME)



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

      Name: vsR10238 Date: 09/01/2003



      I ran the test manually using the following script:

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

      RESULT_DIR=`pwd`
      WORK_DIR=$RESULT_DIR/workDir/test
      PLATFORM="sparc"
      TESTJAVAHOME="/net/linux-15/export/home/java/jdk1.5.0/$PLATFORM"
      TESTVMOPTS="-server"

      TEST=java/awt/print/PrinterJob/CheckPrivilege.java

      #CLASSPATH assumes that the test was run before using jtreg in the same $WORK_DIR to build the classes
      CLASSPATH=$WORK_DIR/classes/`dirname $TEST`

      DISPLAY=:0
      LPDEST=lp@linux-15

      export TESTJAVAHOME
      export TESTVMOPTS
      export DISPLAY
      export LPDEST

      $TESTJAVAHOME/bin/java -version
      CMD="$TESTJAVAHOME/bin/java $TESTVMOPTS -cp $CLASSPATH `basename $TEST | cut -d . -f 1`"
      echo $CMD
      $CMD
      ------------ script end --------------

      The test run using the script above fails with JDK1.5.0 (tested with b16, b17)
      on Linux, Solaris (both Sparc and x86).

      The test passes with JDK1.4.2-b28 and the same other conditions.

      The test passes with JDK1.5.0 if the user home directory contains .java.policy file
      with the necessary permissions.

      I decompiled sun.com.IPPPrintService.class and discovered that it contained approximately the following code:
      in its static initializer:

               printReqAttribDefault = (new Object[] {
                   Chromaticity.COLOR, new Copies(1), new Destination((new File("./out.prn")).toURI()), Fidelity.FIDELITY_FALSE, Finishings.NONE, new JobName("",
                   new PageRanges(1), new RequestingUserName("", Locale.getDefault()), Sides.ONE_SIDED
               });

      Since the test installs a security manager, the code
      called by toURI checks for the necessary permissions to out.prn
      which are not defined in any policy file.
      This causes the test to fail with the static initializer error
      shown in the test output.

        ###@###.###






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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: