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

java.io: Different file-opening constructors throw different exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.1, 1.1.3, 1.1.6, 1.2.0
    • core-libs
    • None
    • 1.2fcs
    • x86, sparc
    • solaris_2.5.1, windows_95, windows_nt
    • Not verified



      Name: rlT66838 Date: 07/18/97


      The constructor for the FileOutputStream declares that it can
      throw an IOException. This is not accurate, as the code clearly
      shows - the IOException is caught, and a FileNotFoundException
      is thrown:

          public FileOutputStream(String name, boolean append) throws IOException {
              SecurityManager security = System.getSecurityManager();
              if (security != null) {
                  security.checkWrite(name);
              }
              try {
                  fd = new FileDescriptor();
                  if(append)
                      openAppend(name);
                  else
                      open(name);
              } catch (IOException e) {
                  throw new FileNotFoundException(name);
              }
          }

      This should be a quick and easy fix - please do so!
      company - PointCast, Inc. , email - ###@###.###
      ======================================================================

            mr Mark Reinhold
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: