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

IOException should have subclasses to better describe failure

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.1, 1.1.3, 1.1.4, 1.1.6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.5.1, windows_nt

      Description

      Name: tb29552 Date: 09/15/97


       Trying to write to a write-protected file yields
       a FileNotFound exception. Looking at the source
       code, we see that an IOException is being caught
       and re-thrown as a FileNotFoundException.

       Therefore, we are losing the actual error (file
       can't be read) and gaining a bogus error (file can't
       be found). Since the original exception is lost,
       we don't know (without further work) whether the
       file doesn't exist or is just not writable.

       excerpting out of FileOutputStream.java <colon>

          public FileInputStream(String name) throws FileNotFoundException {
              SecurityManager security = System.getSecurityManager();
              if (security != null) {
                  security.checkRead(name);
              }
              try {
                  fd = new FileDescriptor();
                  open(name);
              } catch (IOException e) {
                  throw new FileNotFoundException(name);
              }
          }

       company - Integrated Measurement Systems , email - ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              smarks Stuart Marks
              Reporter:
              tbell Tim Bell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: