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

Tk.getPrintJob() returns null when security manager is installed, on unix

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • client-libs
    • 2d
    • beta
    • x86
    • linux_sun
    • Verified

      JDK: Tiger-beta
      Platform: Solaris9, 10, Linux Cinnabar, RH 9
      Other details: Occurs only CUPS
      Win32: Not reproducible
      1.4.2: Not reproducible

      I have installed the security manager in my app by calling System.setSecurityManager(new SecurityManager()). I am trying to get the PrintJob from the toolkit by calling Toolkit.getPrintJob() but it is returning null without giving any error on solaris and linux platforms with CUPS. On a Non-CUPS system / Win32, it works fine.

      I have the following permissions in my policy file - .java.policy
      permission java.lang.RuntimePermission "queuePrintJob"
      permission java.io.FilePermission "<<ALL FILES>>","read, write, delete, execute"

      The API doc for getPrintJob() specifies that only the above 2 policy entries are needed for getting the print job but does not work that way.

      This is reproducible with any tiger build on SolarisSparc9, Linux-JDS, RH 9 when CUPS is enabled. This is not reproducible on Win32. This is not reproducible with JDK 1.4.2. It does not give any clue to the user as to why getPrintJob() returns null. It must throw a meaningful exception if any of the security restrictions are violated.

      I have attached a sample test. Open policytool and add the above permissions. Run the attached test on any sol, linux system with CUPS. Click on any of the buttons displayed on the frame. You will get a 'PJOB null' message on the console. Try the same with 1.4.2 or on a non-cups system with tiger, it will work fine. On win32, this will work fine.

      -------------------------------------------------------------------------------
      This is not a regression since it is reproducible only with CUPS. Removed the 'REG' tag from the synopsis.

      ###@###.### 2004-09-11

            jgodinez Jennifer Godinez (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: