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

Name of first parameter of RandomAccessFile(String,String) is inconsistent

XMLWordPrintable

    • b13

      A DESCRIPTION OF THE PROBLEM :
      The following RandomAccessFile constructor's first parameter is a 'name' string.
      And the comment describes that it is the system-dependent filename as follows:
      /**
      ...
       * @param name the system-dependent filename
       * @param mode the access <a href="#mode">mode</a>
       */
      RandomAccessFile constructor:
      public RandomAccessFile(String name, String mode)
      throws FileNotFoundException
      {
      this(name != null ? new File(name) : null, mode);
      }
       
      BUT, it is actually a pathname string.
       
      /**
       * Creates a new <code>File</code> instance by converting the given
       * pathname string into an abstract pathname. If the given string is
       * the empty string, then the result is the empty abstract pathname.
       *
       * @param pathname A pathname string
       * @throws NullPointerException
       * If the <code>pathname</code> argument is <code>null</code>
       */
      File constructor:
      public File(String pathname) {
      if (pathname == null) {
      throw new NullPointerException();
      }
      this.path = fs.normalize(pathname);
      this.prefixLength = fs.prefixLength(this.path);
      }


            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: