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

java.lang.SecurityManager doc doesn't say about checkWrite(FileDescriptor)

XMLWordPrintable

    • sparc
    • solaris_2.5

      This bug was found by St.Petersburg Java SQE team (by Alexander Kuzmin)


      22.16.3 public FileOutputStream(FileDescriptor fdObj)
      throws SecurityException

      This constructor initializes a newly created FileOutputStream by using the file
       descriptor fdObj, which represents an existing connection to an actual file in
      the file system.

      First, if there is a security manager, its checkWrite method (§20.17.20) is called
       with the file descriptor fdObj argument as its argument. |
                                                                        |
           _____________________________________________________________|
           |
           | _____ !
           V |
                                        V
      20.17.20 public void checkWrite(int fd)
      throws SecurityException

      The general contract of this method is that it should throw a SecurityException
       if creating an output stream using the specified file descriptor is not
       permitted.

      This method is invoked for the current security manager (§20.18.4) by one constructor
       for java.io.FileOutputStream (§22.16.3).

      The checkWrite method defined by class SecurityManager always throws a
       SecurityException. A subclass must override this method if creating an
       output stream from an existing file descriptor is to be permitted with a
      security manager installed.



      ----------------------------------------------------------
      This is not a problem with javadoc but with the JLS:
      the JLS 20.17.18 describes the method void checkRead(int)
      but there is no such a method in SecurityManager class.
      The correct signature is void checkRead(FileDescriptor)
       
      The same problem with 20.17.20.

      ###@###.### 1998-01-26

            abuckley Alex Buckley
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: